0

Why this compiles in c++11:

struct foo
{
  enum class Resolution { None=10, Nominal=20 };
  enum class Scale { None, Nominal };
};

while this doesn't:

struct foo
{
  enum Resolution { None=10, Nominal=20 };
  enum Scale { None, Nominal };
};

?

4

1 回答 1

2

在 C++11 枚举值没有作用域之前,这意味着 2 个枚举中的值不能相同。使用时不再是这种情况enum class

于 2015-03-30T11:36:34.880 回答