The Canonical Class
summary
Concrete advice about C++11 class design: prefer use =default or =delete explicitly for each special member, decide whether default construction is meaningful for the type, and pick move semantics (destructive or preservative) as a team rule. Use std::copy for copies, treat std::move as a cast, and avoid patterns that break RVO — avoid breaking RVO. Mark move operations noexcept to enable moves when safe. If tuning performance, provide a custom swap and implement it as "using std::swap" then call swap.
AI-written summary · about
chapters (10)
- 0:00Introduction
- 7:35Rigid coding rules problem
- 17:21Default constructibility
- 24:31Destructors implications
- 30:14Move semantics motivation
- 37:47R-values and move operations
- 44:58Move semantics definition
- 52:17Perfect forwarding
- 55:50Semantics and design
- 59:02Q&A
related talks
01h 02mBack To Basics: The Special Member Functions
01h 02mBack to Basics: C++ Move Semantics
58mUnderstanding and Mastering C++'s Complexity
01h 01mBack to Basics: C++ API Design
01h 04mBack to Basics: Move Semantics
49mBack to Basics: C++ Smart Pointers
01h 05mWhat Classes We Design and How
04m(don't) Copy Paste All The Things
