xvalue

suggest change

An xvalue (eXpiring value) expression is an expression which has identity and represents an object which can be implicitly moved from. The general idea with xvalue expressions is that the object they represent is going to be destroyed soon (hence the “eXpiring” part), and therefore implicitly moving from them is fine.

Given:

struct X { int n; };
extern X x;

4;                   // prvalue: does not have an identity
x;                   // lvalue
x.n;                 // lvalue
std::move(x);        // xvalue
std::forward<X&>(x); // lvalue
X{4};                // prvalue: does not have an identity
X{4}.n;              // xvalue: does have an identity and denotes resources
                     // that can be reused

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:


Value categories:
* rvalue
* xvalue
* lvalue

Table Of Contents
8 Arrays
11 Loops
39 Streams
51 Unions
56 Lambdas
58 Value categories
60 SFINAE
62 RAII
67 Sorting
84 RTTI
87 Scopes
104 Profiling
107 Recursion
117 Iteration
125 Alignment
134 Semaphore
136 Debugging
139 Mutexes
142 decltype