请不要转载本文;请不要以任何形式重新出版,发布本文;请在下载本文 24 小时内将其删除;禁止将本文用于商业目的。
3.4 Name lookup [basic.lookup]
3.4 名字查找 【基本.查找】
The name lookup rules apply uniformly to all names (including typedef-names (7.1.3), namespace-names (7.3) and class-names (9.1)) wherever the grammar allows such names in the context discussed by a particular rule. Name lookup associates the use of a name with a declaration (3.1) of that name. Name lookup shall find an unambiguous declaration for the name (see 10.2). Name lookup may associate more than one declaration with a name if it finds the name to be a function name; the declarations are said to form a set of overloaded functions (13.1). Overload resolution (13.3) takes place after name lookup has succeeded. The access rules (clause 11) are considered only once name lookup and function overload resolution (if applicable) have succeeded. Only after name lookup, function overload resolution (if applicable) and access checking have succeeded are the attributes introduced by the name's declaration used further in expression processing (clause 5).
无论语法对某条特定规则论述的语境中的名字允许出现在何处,名称查找规则统一地应用到所有名字上(包括 typedef-名称(7.1.3),名字空间-名称(7.3)和类-名称(9.1))。名字查找将名字的应用羽其名字的声明(3.1)联系起来。名字查找应该找到该名字的一个明确的声明(见 10.2)。名字查找如果发现名字为函数名字,可能将其联系到多于一个声明上;这些声明被认为构成一组重载函数(13.1)。重载解析(13.3)在名字查找成功之后进行。访问规则(章节 11)仅当名字查找和函数重载解析(如果适用)成功后被考虑,仅在名字查找,函数重载解析(如果适用)和访问检查成功后,由该名字的声明引入的属性才被表达式处理(章节 5)中进一步使用。
A name "looked up in the context of an expression" is looked up as an unqualified name in the scope where the expression is found.
在“表达式的语境中查找”的名字是被出现该表达式的作用域中作为非限定名称查找的。
Because the name of a class is inserted in its class scope (clause 9), the name of a class is also considered a member of that class for the purposes of name hiding and lookup.
由于类的名称是被插入到其类作用域(章节 9)中,所以处理名字隐藏和查找时,类的名字同样被看作该类的成员。
[Note: 3.5 discusses linkage issues. The notions of scope, point of declaration and name hiding are discussed in 3.3. ]
【注:3.5 讨论连接性的问题。作用域,声明点和名字隐藏的概念在 3.3 中讨论。】
3.4.1 Unqualified name lookup [basic.lookup.unqual]
3.4.2 Argument-dependent name lookup [basic.lookup.koenig]
3.4.2 自变量关联名称查找 【基本.查找.koenig】
3.4.3 Qualified name lookup [basic.lookup.qual]
3.4.4 Elaborated type specifiers [basic.lookup.elab]
3.4.5 Class member access [basic.lookup.classref]
3.4.6 Using-directives and namespace aliases [basic.lookup.udir]
3.4.6 Using-指令和名字空间别名 【基本.查找.u指令】