An expression that refers to a memory location, and therefore, we can get the address via the
&
operator
int area = height * width
, area
is the lvalueAn expression that is not a lvalue
int area = height * width
, height * width
is the rvaluefoo()
returns an lvaluebar()
returns an rvaluei
is an lvaluefoo()
is an lvaluefoo()
bar()
swap()
swap()
type operationsswap()
method, and it's difficult to add a method to a class that is not yoursswap()
methodType Modifier | Description |
---|---|
A& |
lvalue reference |
A&& |
rvalue reference |
swap()
Implementationstd::move()
std::move()
Implementationstd::move()