The primary value categories correspond to two properties of expressions: has identity: it's possible to determine whether the expression refers to the same entity as another expression, such as by comparing addresses of the objects or the functions they identify (obtained directly or indirectly); can be moved from: move constructor, move assignment operator, or another function overload that implements move semantics can bind to the expression. Expressions that: .... have identity and cannot be moved from are called lvalue expressions; .... have identity and can be moved from are called xvalue expressions; .... do not have identity and can be moved from are called prvalue expressions; .... do not have identity and cannot be moved from are not used. http://en.cppreference.com/w/cpp/language/value_category |
int i = 5, j = 3;
i+j;
int k = i + j; |
i+j;
This is an invalid statement.
|
|
const int f();
has type const int()
, but the type of the function call expression f()
is int
, and f()
will bind to int&&
.
|
|