Value categories

Value categories

Each C++ expression (an operator with its operands, a literal, a variable name, etc.) is characterized by two independent properties: a type and a value category. Each expression has some non-reference type, and each expression belongs to exactly one of the three primary value categories: prvalue, xvalue, lvalue, defined as follows:

  • a glvalue is an expression whose evaluation determines the identity of an object, bit-field, or function
  • a prvalue is an expression whose evaluation either
    • computes the value of the operand of an operator (such prvalue has no result object), or
    • initializes an object or a bit-field (such prvalue is said to have a result object). All class and array prvalues have a result object even if it is dis