我的印象是下面的脚注 32 适用于整个段落 §3.4.1/8 而不仅仅是它的第三个要点
I have the impression that footnote 32 below applies to the entire paragraph §3.4.1/8 and not only to its third bullet point
[basic.lookup.unqual]/8
For the members of a class X
, a name used in a member function body,
in a default argument, in an exceptions-pecification, in the
brace-or-equal-initializer of a non-static data member (9.2), or in the definition of a class member outside of the definition of X
,
following the member’s declarator-id 31, shall be
declared in one of the following ways:
- before its use in the block in which it is used or in an enclosing block (6.3), or
- shall be a member of class
X
or be a member of a base class of X
(10.2), or
- if
X
is a nested class of class Y
(9.7), shall be a member of Y
, or shall be a member of a base class of Y
(this lookup applies
in turn to Y
’s enclosing classes, starting with the innermost
enclosing class),32 or
- ...
脚注:
32) This lookup applies whether the member function is defined within
the definition of class X
or whether the member function is defined
in a namespace scope enclosing X
’s definition.
我说得对吗?
我看不出有任何理由将脚注与要点 3 联系起来。脚注唯一说的是 in-class 中定义的成员函数可以 "see" 整个 class(如果它以非 class 方式定义,就会出现这种情况)。它同样适用于所有要点。
例如脚注32再次确认此代码有效
struct S
{
void foo() { i = 42; }
int i;
};
即S::foo()
的定义可以 "see" S::i
的声明,即使 S::i
声明在 下方 S::foo()
的定义之下].您可以立即看到,上面的示例没有嵌套 classes,因此与要点 3.
无关
脚注不是"this statement is only true for bullet point 3"的意思。
表示"by the way, this statement is [also] true for bullet point 3, a slightly more complex scenario with which you may have had your doubts as to the fact so stated".
因此,虽然您在客观上并没有错,但这也不是任何类型的编辑问题。
[basic.lookup.unqual]/8
For the members of a class
X
, a name used in a member function body, in a default argument, in an exceptions-pecification, in the brace-or-equal-initializer of a non-static data member (9.2), or in the definition of a class member outside of the definition ofX
, following the member’s declarator-id 31, shall be declared in one of the following ways:
- before its use in the block in which it is used or in an enclosing block (6.3), or
- shall be a member of class
X
or be a member of a base class ofX
(10.2), or- if
X
is a nested class of classY
(9.7), shall be a member ofY
, or shall be a member of a base class ofY
(this lookup applies in turn toY
’s enclosing classes, starting with the innermost enclosing class),32 or- ...
脚注:
32) This lookup applies whether the member function is defined within the definition of class
X
or whether the member function is defined in a namespace scope enclosingX
’s definition.
我说得对吗?
我看不出有任何理由将脚注与要点 3 联系起来。脚注唯一说的是 in-class 中定义的成员函数可以 "see" 整个 class(如果它以非 class 方式定义,就会出现这种情况)。它同样适用于所有要点。
例如脚注32再次确认此代码有效
struct S
{
void foo() { i = 42; }
int i;
};
即S::foo()
的定义可以 "see" S::i
的声明,即使 S::i
声明在 下方 S::foo()
的定义之下].您可以立即看到,上面的示例没有嵌套 classes,因此与要点 3.
脚注不是"this statement is only true for bullet point 3"的意思。
表示"by the way, this statement is [also] true for bullet point 3, a slightly more complex scenario with which you may have had your doubts as to the fact so stated".
因此,虽然您在客观上并没有错,但这也不是任何类型的编辑问题。