C++ - Use enum from template class without template parameter
If you want to enclose your enum in a class definition for reasons (I cannot say what's the real problem), you can still introduce one more class that isn't a class template and contains the enum, then inherit from that with your class template. That's all.
As an example:
struct SomeBase {
enum SomeEnum { SOME_FLAG };
};
template<typename>
struct SomeClass: SomeBase {
// ...
};
Use this:
SomeBase::SomeEnum::SOME_FLAG;
Instead of this:
SomeClass::SomeEnum::SOME_FLAG;
Whenever you want to access the enum directly.
Something like the following remains valid anyway:
SomeClass<void>::SomeEnum foo = SomeClass<void>::SomeEnum::SOME_FLAG;