Frage

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?

War es hilfreich?

Lösung

No, the first argument to BOOST_PP_ENUM_PARAMS must 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 #if or #elif directive, which have a restricted set of operations that may be used).

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top