C++ prvalue


Example

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").
  • A function call expression that does not return a reference
  • A literal (except a string literal - those are lvalues), such has 1, true, 0.5f, or 'a'
  • A lambda expression

The built-in addressof operator (&) cannot be applied on these expressions.