一个点从C ++ 0x草稿:n3290 [英] A point from C++0x draft : n3290

查看:105
本文介绍了一个点从C ++ 0x草稿:n3290的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

A point from N3290 draft ISO Standard, §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.

这是添加的新点,任何人都可以解释

This is the added new point, can any one explain this..point with an example (in terms of an example) please?

推荐答案

我们只需要一些代码:

struct X {};

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

这篇关于一个点从C ++ 0x草稿:n3290的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆