~/talk

Reintroduction to Generic Programming for C++ Engineers

Talkat C++Now 2024 · 2024-04-29..05-03· [compilers-and-language-design]
links:none on file
slides:none on file

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

  1. 0:00Introduction to generics
  2. 11:07Analyzing TypeScript arrays
  3. 18:31Defining concepts in C++
  4. 23:55Intertwined semantics
  5. 33:00Testing with counter
  6. 36:41Over-constraining algorithms
  7. 43:25Checked generics and archetypes
  8. 52:49Product vs library code
  9. 56:46Generalizing stable code
  10. 1:01:41Leman's laws and conclusion
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.