I am trying to use a std::bitset with an enum but I am getting a compilation error saying
template argument 1 is invalid
Funny thing is that when I use any of the enumerated value without the enumeration scope it works fine.
Do you know why?
Below the code
enum MyTypes { Alpha = 1, Beta = 2, Gamma = 3 }; std::bitset<MyTypes::Alpha> bitset_wrong; // It doesn't compile. std::bitset<Alpha > bitset_good; // It works.
-std=c++11in order to use C++11 features.enum struct MyTypes{...}work as a scoped enumerator? I'm not sure if unscoped enumerators support qualified names by default, see en.cppreference.com/w/cpp/language/enum : Each enumerator becomes a named constant of the enumeration's type (that is, name), visible in the enclosing scope...MyTypesis neither, so it would be an error to try and use it as a qualifier.