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 13.12.2014 20:57, Marc Glisse wrote:
Hopefully someone else on the list can tell us in what way we are
misunderstanding each other.

Indeed, you can't pass a const static int member without an external definition to a function expecting (const int&). That means, with the proposed changes it wouldn't be possible anymore to pass VectorXd::ColsAtCompileTime to a function expecting (const int&):
http://ideone.com/K26A41 (reduced example)

It is, however, still possible to use those as template parameters for other classes. See plusOne struct in this example:
http://ideone.com/twvYCa
Admittedly, I'm not entirely sure if that must be possible in C++98/03/11, or if the compiler vendor can decide on that.

So the main questions are whether the first thing shall be working, and if the benefits of `const static int` vs `enum` outweigh that. Saving all the int castings would indeed significantly clean up our internal code, but I doubt that we'd get any significant simplification from user's perspective.

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/