~/talk

Generic Programming Without (Writing Your Own) Templates

Talkat ACCU 2021 Online · 2021-03-10..03-13· [c-and-cpp]
slides:none on file

Shows concrete replacements for hand-rolled templates using C++17/C++20: use std::span (or GSL span) to accept any contiguous range and avoid template bloat but beware const placement and dangling lifetimes; return heterogeneous results with std::variant (example: quadratic solver returning monostate / double / pair<double,double>) and handle cases with visit/overload; use std::any for truly dynamic values but expect heap allocations and runtime type checks; std::function trades compile-time templates for runtime type-erasure and possible allocations.

AI-written summary · about

  1. 0:00Intro
  2. 1:04Templates
  3. 6:23How to use a span
  4. 8:54Pitfalls
  5. 20:24a type-safe union?
  6. 23:08Example
  7. 30:07overload pattern
  8. 35:39void
  9. 40:36Use cases
  10. 49:03function_ref
~/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.