Re: [eigen] proposal to use static const integer class members instead of enum values

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]


On 15.12.2014 09:17, Daniel.Vollmer@xxxxxx wrote:
Well, wouldn't you then just have all these constants be derived from
integral_constant (in C++11-speak) and then call IsColVector::value etc.?

I'm not sure if I understand your suggestion correctly, but we definitely can't do this (reduced example):

template<class Scalar, int Rows, int Cols>
class Matrix {
  Scalar[Rows*Cols];
  integral_constant<Rows> RowsAtCompileTime;
  integral_constant<Cols> ColsAtCompileTime;
};

Not only because the API will change, but more crucially because we'd add an empty class as a member which will cause the class to get bigger (Try out the above and check sizeof(Matrix<...>), sizeof(integral_constant<...>), etc. We have a similar effect in Maps with fixed sized dimensions, but we don't care too much at the moment, because Maps are most of the time only used as temporaries.

Adding these integral_constants as static member, obviously does not solve anything either (especially there is no gain vs adding static const Index in the first place).

As a slight aside, I'm looking forward to a much simplified Eigen4 that is allowed to use
C++11 features... ;-)

There has been a feature request to add initializer lists (IIRC also with a proof of concept implementation, but I'd have to find that discussion again). std::move support is already automatically enabled in the devel branch.

We won't add features which will require having a second code bases for C++03 compatibility, but perhaps we will drop C++03 support in the far future of Eigen4 (that's hard to foresee at the moment).


Christoph



--
----------------------------------------------
Dipl.-Inf., Dipl.-Math. Christoph Hertzberg
Cartesium 0.049
Universität Bremen
Enrique-Schmidt-Straße 5
28359 Bremen

Tel: +49 (421) 218-64252
----------------------------------------------



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/