c++ - C++0x 草案 : n3290 中的一点

标签 c++ c++11

N3290 ISO 标准草案 §3.4.1/12 中的一点:

During the lookup of a name used in the constant-expression of an enumerator-definition, previously declared enumerators of the enumeration are visible and hide the names of entities declared in the block, class, or namespace scopes containing the enum-specifier.

这是添加的新点,任何人都可以用一个例子(就例子而言)解释这个点吗?

最佳答案

让我们来写一些代码:

struct X {};

enum Foo
{
  X = 0,
  Y,
  Z = X // X refers to the enum, not the type
};

关于c++ - C++0x 草案 : n3290 中的一点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6120348/

相关文章:

c++ - 未定义的行为和顺序点

c++ - 难以理解的简单递归排序算法

c++ - 如何对 std::map 中的部分键进行二进制搜索?

c++ - 如何请求操作系统发送邮件?

c++11 - 如何在基于范围的循环中从向量中删除?

C++11 - 编译时多态性解决方案

c++ - 确定选择了哪个重载

c++ - 运行时的动态函数调用(va_list)

c++ - 存储和传递 std::function - 按值还是按引用?

c++ - 在 C++ 11 中使用 initializer_list 初始化 unique_ptr