Is it right to say that the values ​​of x are identical and mobile?

In accordance with this document:

http://www.stroustrup.com/terminology.pdf

  • l-values ​​have an identity and cannot move.
  • pr-values ​​are movable, but do not have identifiers.
  • x-values ​​are identical and mobile.

I have a few questions around them.

and. What is an example of an x-value having a personality? The following is not legal:

Foo f;
&std::move(f);

b. I could overload the & operator of the Foo class and make it return this one so that the following becomes legal:

&Foo(5);

But pr-values ​​like Foo (5) cannot have identities. Or is there a more subtle interpretation of identity?

+4
2

?

, , :

  • " " - , , , ..
  • " " - "" ,

, ( § 1.8/1):

- .

, §1.7/1:

.

. , (rvalue, xvalue, prvalue, lvalue ..).


x-, ?

, x ( § 5/7):

- x, :

  • , , rvalue ,
  • rvalue ,
  • , , x,
  • a. * pointer-to-member, xvalue, .

, , rvalue lvalues, rvalue xvalues; rvalue lvalues ​​ , namedornot.

. :

struct A { int m; };

A&& operator+(A, A);
A a;
A b;
a + b;   // xvalue

A&& f();
f();     // xvalue
f().m;   // xvalue

A a;
static_cast<A&&>(a);  // xvalue
std::move(a);         // xvalue
+4

Stroutrup ++ :

... std:: move (vs) - x: ( vs), std:: move ( ) (§3.3.2, §35.5.1).

+4

Source: https://habr.com/ru/post/1531971/