So, I read this answer because I was confused when the values are considered xvalue values, for example when the value expires / near the end of its life. The sad thing is that I'm still very confused.
In any case, the quote included the following:
class member access expression denoting a non-static data item of a non-reference type in which the object expression is xvalue or
a. * pointer-to-member expression, in which the first operand is the value of x, and the second operand is a pointer to a data element.
An example was also given in the answer, but it did not show (I think) the expression "a. * Pointer-to-member", in which the first operand is the value x, and the second operand is a pointer to a data element. "so can someone please show me one?
However, it illustrates a “member access expression denoting a non-static data element of non-reference type in which the object expression is an x value” when executed f().m, and the fact that it mis an xvalue value / value for the end makes sense to me, so how f()rvalue returns a link. But ais an lvalue, so if you did a.m, isn't it an lvalue yet?
There is confusion here that this membership access expression still indicates a non-static data element of a non-reference type. Or when you say "in which the expression of the object is the value of x", does this mean that the class object must be rvalue?
Example mentioned in the answer:
struct A {
int m;
};
A&& operator+(A, A);
A&& f();
A a;
A&& ar = static_cast<A&&>(a);
user8220386
source
share