C++ 0x 中的新“枚举类”声明是否允许开启新奇的枚举?
我问的是标准怎么说,而不是编译器支持。
最佳答案
来自 n3242 草案:
6.4.2 The switch statement [stmt.switch]
[...]
2 The condition shall be of integral type, enumeration type, or of a class type for which a single non-explicit conversion function to integral or enumeration type exists (12.3).
7.2 Enumeration declarations [dcl.enum]
[...]
enum-key:
enum
enum class
enum struct
这意味着是的。
关于c++ - 在 C++ 0x 中打开枚举类,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6327223/