I would like something like this:
class MyClass
{
public:
static const int n = some_traits_class<SomeClass>::value;
template <BOOST_PP_ENUM_PARAMS(MyClass::n, typename P)>
void operator()( BOOST_PP_ENUM_BINARY_PARAMS(MyClass::n, const P, & p) )
{
....
}
}
The compiler doesn’t seem to like this — is there some sort of fix to get to where I want to be?
No, the first argument to
BOOST_PP_ENUM_PARAMSmust be an integer: an actual integer token or the name of a macro that expands to one.Macro replacement occurs long before the compiler starts parsing the code and evaluating integral constant expressions (the only constant expressions evaluated during preprocessing are those that appear in a
#ifor#elifdirective, which have a restricted set of operations that may be used).