
AMDG Hicham Mouline wrote:
I think I wasn't clear enough:
the 3rd party lib (which I can't change of course) provides, enum Op { OPone = 7, OPtwo = 9, OPthree = 45, OPfour = 7667 // there is no pattern in the names nor the numbers. }; // in fact, there are a hundred entries
and I wished to generate from Op
template<> struct Position<OPone> { static const int value = 0; } template<> struct Position< OPtwo > { static const int value = 1; } template<> struct Position< OPthree > { static const int value = 2; } template<> struct Position< OPfour > { static const int value = 2; }
I suppose there is no way to automagically generate the template specs from the enum?
No there isn't. There is no way to introspect the members of an enum.
The best you can do would be
typedef boost::mpl::vector_c