Boost logo

Boost Users :

From: Aleksey Gurtovoy (agurtovoy_at_[hidden])
Date: 2005-02-01 21:35:28


Martin Pasdzierny writes:
>
> 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 ?!

Martin,

There is not much you can do on a user side to make it work, but we'll look
into fixing this for the next release. Meanwhile, I'd suggest to go with
'vector_c<int,X,Y>' version you cite above.

-- 
Aleksey Gurtovoy
MetaCommunications Engineering

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net