Search⌘ K

Rvalues and Lvalues

Explore the concepts of rvalues and lvalues in C++, including how to distinguish them and the use of lvalue and rvalue references. Understand move semantics for efficient object transfer and perfect forwarding to preserve value categories in function templates.

Rvalues vs. Lvalues

Rvalues are

  • temporary objects.
  • objects without a name.
  • objects from which we cannot get an address.
  • always on the right side of an assignment operation.

The rest are lvalues. They can be on either side of an assignment operator.

An lvalue can be on the left hand side of an assignment operation. (and of course on the ...