To Move or not to Move
summary
Interactive code review that answers "should I std::move here" with concrete rules and failing examples: demonstrates a crashing dangling-reference when returning a local by reference, shows implicit move and RVO so don't std::move returned local variables, proves popping-then-moving from std::vector is undefined behavior, explains const rvalue falls back to copy, allows moving Lvalue refs for swap, and insists to mark move constructors noexcept and to use std::forward for forwarding refs where appropriate.
AI-written summary · about
chapters (8)
- 0:00Intro
- 2:24The motivation for Move Semantics
- 8:28What is being called?
- 15:04Alternatives
- 21:46What's wrong here?
- 30:04The proper way - option 2
- 36:24Implementing move forgetting noexcept
- 45:29Summary (2)
related talks
44mPartially-formed Objects for fun and profit
01h 02m“Modern C++ Design (part 1 of 2)”
46mWords of Wisdom
01h 20mRevisiting C++ Observers: Spooky Action at a Distance
05mChoosing an Abstraction
01h 02mImplementing static_vector: How Hard Could it Be?
01h 00mDesign Idioms from an Alternate Universe
01h 03mBreaking Dependencies: The SOLID Principles
