Reintroduction to Generic Programming for C++ Engineers
summary
Uses a TypeScript sort example to show how to add minimal interface constraints, then reproduces the same ideas in C++ by lifting repeated signatures into C++20 concepts named like iterator and range and implementing a tiny counter iterator that compiles but fails when used with std::ranges::advance because post‑increment is missing, demonstrates count working for linked lists and stream readers, argues archetypes are painful and TypeScript‑style checked generics are likely unimplementable, and gives eight concrete takeaways.
AI-written summary · about
chapters (10)
- 0:00Introduction to generics
- 11:07Analyzing TypeScript arrays
- 18:31Defining concepts in C++
- 23:55Intertwined semantics
- 33:00Testing with counter
- 36:41Over-constraining algorithms
- 43:25Checked generics and archetypes
- 52:49Product vs library code
- 56:46Generalizing stable code
- 1:01:41Leman's laws and conclusion
related talks
01h 39m“Concepts: The Future of Generic Programming (the future is here)”
52mConcepts: The Future of Generic Programming
56m“Modern C++ Interfaces..."
57mIntroduction to C++ Template Metaprogramming
46mMeandering Through C++ Creating ranges::to
59mMetaprogramming: From Templates to Concepts
01h 06m“C++ Metaprogramming: Journey from simple to insanity and back"
58mExploration of C++20 Meta Programming
