Boost logo

Boost Users :

From: Martin Pasdzierny (martin_at_[hidden])
Date: 2005-01-30 17:00:15

Hello MPL experts,

I'd like to use meta - vectors of integral constants defined as enums.
But unfortunately the code below does not compile.

#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;

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.

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at