“Regular Types and Why Do I Care ?”
summary
Explains why STL expects value-like types, shows std::sort actually requires a strict weak ordering (example: a naive 2D point comparator yields unordered pairs and breaks sort), and demonstrates correct lexicographic and distance-based comparators. Covers Concepts Lite / C++20 three-way comparison (three-way comparison / spaceship) and how std::optional and string_view as borrow type interact with equality and ordering. Recommends designing types as SemiRegular/Regular when possible and treating non-owning spans and views with contextual care.
AI-written summary · about
chapters (20)
- 0:00Intro
- 0:55Why Regular Types
- 2:40Terminology
- 4:53YOP
- 6:52Mathematics Really Does Matter
- 8:16Algorithmic Journeys
- 9:06Fundamentals of Genetic Programming
- 10:47Simplicity
- 13:07STL Design Principles
- 18:46Why Do I Care
- 20:16stdssort
- 25:23strict weak ordering
- 26:07equivalence relations and equivalence classes
- 27:31dictionary order
- 29:41equality comparable
- 33:25wholepart semantics
- 36:53STD optional
- 39:57StringView
- 43:31Span
- 46:01Questions
related talks
01h 08mRegular Types and Why Do I Care ?
58mUsing C++20's Three-way Comparison <=>
46mComparison is not simple, but it can be simpler
56m“Type Traits - what are they and why should I use them?"
01h 10mBack to Basics: Algebraic Data Types
01h 14mReintroduction to Generic Programming for C++ Engineers
58mC++17 in Practice - The good and the ugly
38mWhat's New In C++23
