Class member access is defined in [expr.ref].
It is:
A postfix expression followed by a dot .
or an arrow ->
, optionally followed by the keyword template
, and then followed by an id-expression
x.y
is class member access, get().y
is class member access, x.template y<int>()
is class member access, etc.
But neither x.*ptr
nor X().*ptr
are, because of the *
. They are pointer-to-member operators, which are described in [expr.mptr.oper]. They also have different (lower) precedence from class member access: x.*y.z
evaluates as x.*(y.z)
.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…