
AMDG Hicham Mouline wrote:
we have a 3rd party lib which provides an enum OP with some hundred members, but each member is defined with numbers that are not contiguous.
enum OP { op1=56, op2=6, op3=5 ..... };
We have a performance critical function f that looks like this:
<snip>
Now, the question is about defining the metafunction Position.
template< OP op > struct Position {}; template<> struct Position<OP5> { const size_t value=4; }; ....
The 3rd party enum OP in the header file I can't change.
Is there a way to generate my metafunction automatically? Any facility in mpl or fusion instead of defining my own metafunction?
I would say that the easiest way is to use the preprocessor.
#define BOOST_PP_LOCAL_MACRO(n) template<> struct
Position