开发者

A point from C++0x draft : n3290

开发者 https://www.devze.com 2023-03-08 01:05 出处:网络
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 vis

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 开发者_JS百科point, can any one explain this..point with an example (in terms of an example) please?


Let's just have some code:

struct X {};

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

精彩评论

暂无评论...
验证码 换一张
取 消