What Classes We Design and How
summary
Clear decision rules replace magic: a compact taxonomy of class roles (value, subject, relation, manager) maps specific special‑member combinations to why they work, when Rule of Zero applies, and when to implement a unique manager using optional for moved‑from state. Concrete patterns show why const/reference members break assignability, why deleting move assignment suppresses copying for polymorphic or scope managers, and offer working move/assign recipes and a template sketch that compiles and behaves as claimed.
AI-written summary · about
chapters (41)
- 0:00Intro
- 0:44Philosophy
- 1:51Objects
- 4:25Value
- 6:44Value Semantic
- 7:49Cons
- 8:48Subject
- 9:13Identity
- 10:25Polymorphic
- 12:27Relation Types
- 12:43Relation
- 13:47Fan Vehicle
- 16:14Relation Type
- 17:50Manager Types
- 20:16Detecting Manager Types
- 23:48Mental Model
- 25:08Special Member Functions
- 28:44Subobjects
- 30:42Defining Classes
- 31:02Core Guidelines
- 32:17Rule of Three
- 32:49Polymorphic Base
- 33:07How to prevent copying
- 34:03Defining a move assignment
- 34:49The MVA rule
- 35:11Polymorphic base class
- 35:51Managers
- 36:10Resource Acquisition
- 37:17Scope Manager
- 38:13Unique Manager
- 40:59How Move Works
- 41:48Move Constructor
- 44:21Duplicating Resources
- 45:17Default Constructor
- 45:58General Managers
- 46:29Takeaways
- 48:41Premature optimization
- 49:16Take it home
- 49:30Never define a destructor
- 50:08The 3 kinds of managers
- 50:58What was missing
related talks
01h 05mWhat Classes We Design and How
01h 06mThe Canonical Class
01h 02mBack To Basics: The Special Member Functions
01h 07mBack to Basics: Templates (part 2 of 2)
39mBack to Basics: The Rule of Five in C++
51mBack to Basics: Master C++ Value Categories With Standard Tools
01h 02mBack to Basics: C++ Move Semantics
01h 01mC++ Design Patterns - The Most Common Misconceptions (2 of N)
