What Classes We Design and How
summary
Categorizes C++ types as Value, Subject, Relation, Manager (scope, unique, general) and gives concrete rules: prefer the Rule of Zero, treat relation types (references, pointers, span, string_view) only as function parameters to avoid dangling, never define empty destructors (they inhibit moves), and implement unique managers with an optional or unique_ptr, lvalue‑qualify assignment, swap and reset the source, mark move operations noexcept where possible. Shows real UB example (vector::at on a temporary) caught by AddressSanitizer.
AI-written summary · about
chapters (12)
- 0:00Introduction and philosophy
- 2:49Categorizing C++ types
- 7:11Value types and semantics
- 13:00Understanding subject types
- 17:11Relation and dangling types
- 22:40Safe use of relation types
- 34:56Threading and global variables
- 37:20Manager types overview
- 44:02Class design principles
- 50:00Rule of zero and its limits
- 54:25Polymorphic base and the mover
- 59:28Implementation of manager types








