Back to Basics: Rvalues and Move Semantics in C++
Talkat CppCon 2024 · on Friday, 2024-09-20· at 10:30· Adams A, 6700 North Gaylord Rockies Boulevard·
summary
Implements a minimal string type and implements a minimal string with move ctor/assign showing the actual code changes and prints that prove the move happened, experiments with compiler flags to demos -fno-elide-constructors and RVO/NVRO, measures where copy elision hides moves, demonstrates when to add noexcept to moves and the concrete impact on std::vector reallocation, explains std::move vs std::forward, fixes a real pop/swap bug (avoids dangling references) and follows rule‑of‑zero/design guidance.
AI-written summary · about
chapters (14)
- 0:00Move semantics motivation
- 1:05Introduction
- 6:44Lvalues vs rvalues
- 12:45Overloading with references
- 17:46Move operations for string
- 27:26Move semantics optimizations
- 32:53Overload resolution and std::move
- 38:06Safe use of std::move
- 42:03Rule of Zero
- 45:39Rule of Five
- 48:04Why noexcept matters
- 50:09Forwarding references
- 53:22Forwarding examples
- 57:14Summary
related talks
01h 02mEveryday Efficiency: In-Place Construction (Back to Basics?)
01h 11mPragmatic Simplicity - Actionable Guidelines To Tame Cpp Complexity
51mSimplicity: Not Just for Beginners
56mC++ Code Smells
06mWhat did I learn teaching C++ to beginners
40mLessons from two decades of writing bad code
05mLightning Talk: find-move-candidates in Cpp
01h 00mThe hidden rules of world-class C++ code
