~/talk

Enough TMP to write a Variant

Talkat Meeting C++ 2022 · 2022-11-17..11-19· [frontend-architecture]
links:none on file
slides:none on file

Claims a working std::variant reimplementation in C++20 that fits less than 500 lines and can be taught in an hour, with real support for multiple-dispatch, constexpr, noexcept and return-type deduction. Implementation uses a tagged union, std::construct_at/std::destroy_at, index_sequence math, unrolled get-by-index and a macro-generated jump-table switcher to avoid indirect calls. Error reporting uses a common-type-with-error-tag trick so SFINAE/Concept checks give compact messages. The result compiles and runs and the visit machinery produces optimized direct jumps rather than function-pointer indirection.

AI-written summary · about

  1. 0:00Introduction
  2. 7:13Template metaprogramming basics
  3. 11:28Utility library for TMP
  4. 21:05Custom Union type
  5. 25:59Compile-time switch
  6. 31:15Variant data structure
  7. 36:14Return types and errors
  8. 41:12Finalizing visit
  9. 44:04Integrating components
  10. 46:10Summary
  11. 46:36Q&A
~/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.