假设我们有以下声明
enum visibility
{
On = 0,
Off = 1,
maxVisibility
};
C++11/C++0x标准中maxVisibility
枚举数2
的保证值是?
最佳答案
是的,这是有保证的。
§ 7.2.2
If the first enumerator has no initializer,the value of the corresponding constant is zero. An enumerator-definition without an initializer gives the enumerator the value obtained by increasing the value of the previous enumerator by one.
关于c++ - 未初始化的枚举器默认值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18868599/