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 referenceAll lessons in this course
- Lvalue vs Rvalue The Distinction
- Rvalue References and the && Syntax
- std::move and std::forward
- Move Constructors and Move Assignment