Skip to content

Move Semantics and Rvalue References ​

Move semantics is one of the most important features C++11 gave us—it makes "transferring ownership of resources" a first-class citizen and has completely changed how we deal with the cost of copying. In this chapter we start from the value category system, getting clear on what an lvalue is, what an rvalue is, and why we need rvalue references; then we dig into how move construction and move assignment are actually implemented, sort out how the special member functions of the Rule of Five fit together, and see how much work the compiler's RVO optimization saves you; next, perfect forwarding ties everything together; and finally we land on two articles of hands-on practice: the payoff from standard library containers with measured benchmarks, and how to bring moves into your own types. Move semantics isn't just a performance optimization—it is the cornerstone of understanding resource management in modern C++.

Chapter Contents ​

pdf-latest-4-g85128cc · 85128cc · 2026-10-05