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 Mon, 15 Dec 2014, Christoph Hertzberg wrote:
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
Note that integral_constant<T,x> is implicitly convertible to T.
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.
I thought he meant: typedef integral_constant<int,Rows> RowsAtCompileTime; but it still changes the API. -- Marc Glisse
Mail converted by MHonArc 2.6.19+ | http://listengine.tuxfamily.org/ |