Moved-from Objects in C++
summary
Argues that C++’s core is uncompromising performance achieved by allowing undefined behavior, then drills into move semantics: moved-from objects are partially formed objects and should only be assigned-to or destroyed. Shows concrete costs and surprises: vector move forces zeroing size/capacity under the standard note, list with sentinel nodes can make moves throw, a viewport ID wrapper forces expensive reallocation or faked accessors, and std::sort with unique_ptr comparators exposes inconsistent guarantees. C++26 tweaks are noted; slides and examples are on the uploader’s links.
AI-written summary · about
chapters (9)
- 0:00C++ philosophy and goals
- 7:43C++ superpower: performance
- 11:43Undefined behavior in C++
- 23:04Move semantics introduction
- 27:36Problem with moved-from objects
- 35:55Restrict moved-from objects
- 48:11Proposed move semantics
- 56:38Safety vs performance
- 1:03:38Q&A
related talks
05mLightning Talk: find-move-candidates in Cpp
01h 11mPragmatic Simplicity - Actionable Guidelines To Tame Cpp Complexity
01h 02mEveryday Efficiency: In-Place Construction (Back to Basics?)
56mC++ Code Smells
51mSimplicity: Not Just for Beginners
05mTransforming C++ Code with DMS
31m“New standards to the rescue: the view through an IDE’s glasses”
44mAdventures In Updating A Legacy Codebase
