Evolving a Nice Trick
summary
A concrete evolution: a generic "close enough" comparator is implemented from C++98 to C++20, starting with tag dispatching and hand‑rolled type traits that compile on ancient toolchains, moving through std::type_traits and enable_if, adding a constexpr abs and compile‑time tests, then using variable templates and generic lambdas, and ending with if consteval and concepts plus common_type so mixed float/integral cases work. The claim is tangible (one function becomes a constrained, debuggable overload), the tools are real, static_asserts prove it at compile time, and the implementation is small, efficient and testable.
AI-written summary · about
chapters (15)
- 0:00Introduction
- 2:27The problem
- 5:15The goal
- 10:25Nonintrusive solutions
- 13:17Functions
- 14:30Traits
- 19:03Comparison
- 21:05Changes
- 27:52Algorithms
- 31:42Generics
- 35:32Values
- 39:17Recap
- 40:41Simon Says 20
- 41:54Concepts
- 51:16Questions
related talks
01h 36mPlenary: Cooperative C++ Evolution - Toward a Typescript for C++
02h 02mPeering forward: C++'s next decade
01h 02mEmbedded Friendly C++: Features That Make a Difference
56mConcepts - Evolution or Revolution
01h 03mUnlocking the value of C++20
01h 02mC++20 Templates - the next level
01h 02mC++20 - My Favorite Code Examples
59mConcepts driven design
