
30 Jan
2005
30 Jan
'05
10 p.m.
Hello MPL experts, I'd like to use meta - vectors of integral constants defined as enums. But unfortunately the code below does not compile. <code> #include <iostream> #include <boost/mpl/vector_c.hpp> #include <boost/mpl/size.hpp> enum MY_ENUM {X,Y}; // (*) typedef boost::mpl::vector_c<MY_ENUM,X,Y> my_vector_c; static const int size = boost::mpl::size<my_vector_c>::value; int main(int argc, char** argv) { std::cout << "\nsize:" << size << "\n... bye" << std::endl; } </code> After replacing line (*) with typedef boost::mpl::vector_c<int,X,Y> my_vector_c; the code compiles and runs fine, but this does not look type safe any more. Any suggestions ?! regards, Martin.