Tutorial by Examples

Expressions in C++ are assigned a particular value category, based on the result of those expressions. Value categories for expressions can affect C++ function overload resolution. Value categories determines two important-but-separate properties about an expression. One property is whether the exp...
A prvalue (pure-rvalue) expression is an expression which lacks identity, whose evaluation is typically used to initialize an object, and which can be implicitly moved from. These include, but are not limited to: Expressions that represent temporary objects, such as std::string("123"). ...
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 implici...
An lvalue expression is an expression which has identity, but cannot be implicitly moved from. Among these are expressions that consist of a variable name, function name, expressions that are built-in dereference operator uses and expressions that refer to lvalue references. The typical lvalue is s...
A glvalue (a "generalized lvalue") expression is any expression which has identity, regardless of whether it can be moved from or not. This category includes lvalues (expressions that have identity but can't be moved from) and xvalues (expressions that have identity, and can be moved from)...
An rvalue expression is any expression which can be implicitly moved from, regardless of whether it has identity. More precisely, rvalue expressions may be used as the argument to a function that takes a parameter of type T && (where T is the type of expr). Only rvalue expressions may be gi...

Page 1 of 1