Regular Types: From Stepanov to C++ Concepts
summary
Argues that Stepanov’s notion of regular types matters now because C++20 Concepts and the three-way comparison automate boilerplate but expose equality pitfalls; shows a real performance bug (defaulted equality does member-wise compare without a size short‑circuit) and explains why std::string_view’s shallow assignment but deep comparison and span’s lack of equality break value semantics. Recommends explicitly defining or suppressing copy/equality, using clang-tidy checks for lifetime issues, and treating non‑owning handles as semi-regular by design.
AI-written summary · about
chapters (25)
- 0:00Introduction
- 1:16Regular types matter
- 3:45Stepanov to modern C++
- 7:03Mathematical roots
- 10:00Value objects semantics
- 14:17Fundamentals for developers
- 16:04Stepanov’s paper principles
- 20:27Value semantics and STL
- 23:18C++ Concepts constraints
- 24:46C++ Concepts explained
- 27:13Sorting comparison needs
- 28:39Partial ordering relations
- 31:08Equivalence axioms
- 32:56Equality and Concepts
- 37:34STL equality assumptions
- 38:59Regular vs semi-regular
- 40:24Defining equality challenges
- 42:34Three-way comparison
- 45:05Default equality pitfalls
- 47:42Equality in Rust Swift
- 50:13String view inconsistencies
- 53:48Span reference semantics
- 55:58Designing regular values
- 1:00:13Span non-regular trade-offs
- 1:03:39Regular type best practices
related talks
01h 08mRegular Types and Why Do I Care ?
54mTypical C++, But Why?
59mA Tour of C++ Recognised User Type Categories
01h 13mType safe C++ – LOL! :-)
12mTraits Go Mainstream...
58mModern C++ Design (part 2 of 2)
01h 25mComparing 'Classic C++' and 'Modern C++' Ways to Solve Programming Tasks
58mHow to Build Cpp Interfaces That Are Hard to Use Incorrectly
