Ok so I have a template class with a static member whose value can be derived from just one of the template parameters, rather than defining the value for every possible value of the second parameter enum is it possible to use another template to define once for all possible values?
Or better illustrated by the code below:
enum Foo
{
FOO,
BAR
};
enum Bar {
OOF,
RAB
};
template<Foo foo, Bar bar>
class FooTemplate
{
public:
static const int RESULT;
};
template<Foo foo, Bar bar>
const int FooTemplate<Foo::FOO, bar>::RESULT = int(bar);
template<Foo foo, Bar bar>
const int FooTemplate<Foo::BAR, bar>::RESULT = 0;
Attempting to compile produces the following compile errors:
C2086 'const int FooTemplate::RESULT': redefinition
C3860 template argument list following class template name must list parameters in the order used in template parameter list
const int
from the second? – erip