Is is possible to make any assumption on the integral values of an enum class
defined like this?
enum class
{
ZERO, ONE, TWO
};
Is is possible to make any assumption on the integral values of an enum class
defined like this?
enum class
{
ZERO, ONE, TWO
};
Yes.
Each enumerator is associated with a value of the underlying type. When initializers are provided in the enumerator-list, the values of enumerators are defined by those initializers. If the first enumerator does not have an initializer, the associated value is zero. For any other enumerator whose definition does not have an initializer, the associated value is the value of the previous enumerator plus one.