| 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.
- 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