I have a templated struct with some enumerations in it and I’d like to make a std::array with the enumerations in it for convenience. Is there any way of doing the following?
template< typename A >
struct someClass{
enum class State{
sA,
sB,
sC
}
static const std::array<State,4> the_states = {{
State::sA,
State::sB,
State::sC
}};
};
No. Only static const integral data members can be initialized within a class.
However, you could do this…