Sane and Safe C++ Class Types
summary
Gives a compact map of which C++ class patterns are safe, which require expert care, and which are dangerous, with concrete gotchas and fixes: set of double with NaN collapsing to one element shows how IEEE NaN breaks ordering, endless unsigned loop demonstrates unsigned underflow producing nonterminating loops, and examples show how raw pointers, implicit single-arg constructors and mixed special-member functions cause bugs. Recommends wrapping primitives as domain types, prefer value types, make polymorphic types noncopyable/move-deleted, and treat spans/string_view as dangling-risk pointing types.
AI-written summary · about
chapters (27)
- 0:00Intro
- 1:04Safety Critical Systems
- 3:46Regular
- 4:56Other types
- 11:38Sane
- 13:20Not a number
- 16:22Loops
- 18:05Integral Promotions
- 20:09Primitive Types
- 24:27unsigned and ins
- 26:03check pattern
- 28:54different types
- 30:08default constructor
- 36:07weightcounter
- 37:28empty classes
- 38:06iterate attacks
- 38:37emptybase
- 39:40Equality
- 40:51Adapters
- 41:34Pointing Types
- 43:02Iterators
- 44:08No pointers
- 46:41Inheritance
- 47:15The Table
- 48:31My Recommendation
- 48:59Polymorphic Classes
- 52:01Conclusion








