0Pricing
C++ Academy · Lesson

Lvalue vs Rvalue The Distinction

Reason about value categories: lvalues, prvalues and xvalues.

Two Worlds: Lvalue and Rvalue

Every expression in C++ is either an lvalue (a thing with a name and an address) or an rvalue (a temporary that has no name).

Lvalues

An lvalue refers to a persistent object — you can take its address with &.

int x = 42;           // x is an lvalue
int* p = &x;          // taking the address of an lvalue

int& r = x;           // r is an lvalue reference

All lessons in this course

  1. Lvalue vs Rvalue The Distinction
  2. Rvalue References and the && Syntax
  3. std::move and std::forward
  4. Move Constructors and Move Assignment
← Back to C++ Academy