Classes C++23 Style
summary
Practical checklist of modern C++ class construction: shows how to pick lifecycle strategy (value, container, resource, singleton) and which special members to implement, demonstrates rule of zero vs rule of five, introduces move-only std::function for move-only wrappers, explains using deducing this to avoid accessor-dangling bugs, and gives working examples of constexpr compile-time checks, transient allocations with constexpr unique_ptr, and std::formatter specializations. Useful if you want concrete code patterns and compiler-checked recipes rather than theory.
AI-written summary · about
chapters (23)
- 0:00Introduction
- 1:26What is a class?
- 3:30Class semantics and lifecycle
- 5:59Simple value types
- 7:23Rule of zero
- 9:14Containers and rule of five
- 10:17Resource wrappers
- 12:03Non-copyable helper
- 13:08Move-only function objects
- 14:12Semantic singletons
- 15:14Compile-time checks
- 16:41Comparison for regular types
- 18:47Implementing comparison correctly
- 22:27Compile-time evaluation
- 24:39const, consteval, and constinit
- 26:25C++23 compile-time asserts
- 28:13Compile-time unique pointers
- 31:46Transient allocations
- 32:30Making types formattable
- 35:48Runtime formatting
- 36:51Accessing members safely
- 41:28Deducing this explained
- 44:17Summary and best practices
