Lecture 2 - Slide 22 : 29
Lvalue references versus Rvalue references
A similar example that compares Lvalue and Rvalue references in the
swap
function
Two versions of swap - with Lvalue references and Rvalue references.
The C++ Prog. Lang. (4. edition)
: Page 193-195
Observations
It may be expensive to use the copy constructor and the copy assignment on large objects
Forcing move semantics (by casting to a rvalue reference) alleviates the problem
Rvalues and move constructors