“Operator Overloading: History, Principles and Practice”
summary
History and concrete rules for operator overloading, with C++17 fold expressions and the new C++20 three-way (spaceship) comparison, showing where it generates comparisons and where it currently hurts performance (string equality vs lexicographical_compare_3way). Covers chrono time_point/duration as an affine space example, operator/ for path concatenation, Boost SML’s multi-operator DSL, and a case-insensitive string implemented via lexicographical_compare_3way. Advises preferring free functions, keeping associativity and completeness, avoiding &&/|| overloads, and supplying specialized == when needed for performance.
AI-written summary · about
chapters (31)
- 0:00Introduction
- 0:58Operators in C
- 2:22Why use operators
- 4:02Convention change
- 5:11Mathematical notation
- 6:37More Effective C
- 9:30Motivation
- 10:03Equality
- 10:39Associativity
- 11:06Law of the excluded middle
- 11:39Nicetohaves
- 12:52Distributive Law
- 15:09Fine Spaces
- 15:50Chrono
- 16:51Why overload conventionally
- 17:27Leverage outside users
- 18:07Fold expressions
- 20:56WriteFold
- 22:05Spaceship
- 22:57Comparison Categories
- 27:26Strong Ordering
- 28:30Partial Ordering
- 29:01Last Years SCM Challenge
- 36:00The problem with this approach
- 40:23Where are we
- 41:56DSLs
- 43:22Chrono Dates Example
- 44:58One Operator DSL
- 45:43Multi Operator DSL
- 51:20Futures
- 55:42Operator Functions
related talks
58mUsing C++20's Three-way Comparison <=>
51mSpace Invaders: The C++20 Spaceship Operator is Upon Us
04mGeneralized fold expressions
01h 01mMoving to C++20 for Fun, Beauty... and Results!
15mThe Simple Essence of Overloading: Making ad-hoc polymorphism more algebraic with(…)
58mC++17 in Practice - The good and the ugly
58mExploration of C++20 Meta Programming
49mC++17 Features (part 1 of 2)
