~/talk

Implementing variant Visitation Using Lambdas

Talkat ACCU 2017 · 2017-04-24..04-29· [compilers-and-language-design]
slides:none on file

Demonstrates a concrete implementation of lambda-based visitation for std::variant and other variants: builds an overload set via multiple inheritance and using-declarations (works in C++14 via a recursive template), exposes match() and match_recursive() helpers, and handles recursive variants using forward declarations plus indirection (unique_ptr). Introduces a Y-Combinator for recursive lambdas to avoid std::function type-erasure and runtime cost; benchmarks show smaller assembly and no extra runtime overhead. Code compiles and runs, providing local, concise, exhaustive visitors for single and multiple dispatch.

AI-written summary · about

  1. 0:00Introduction to variants
  2. 1:31Variants vs other types
  3. 4:22Traditional tagged unions
  4. 7:55Using std::variant
  5. 10:32Practical variant use cases
  6. 13:27Variant interface and access
  7. 17:31Introduction to visitation
  8. 20:32Traditional visitation methods
  9. 24:39Modern lambda visitation
  10. 29:18Implementing lambda overloads
  11. 34:40Advanced lambda overloading
  12. 43:47Implementing the match function
  13. 50:10Recursive variant structures
  14. 55:15Traditional recursive visitation
  15. 58:53Challenge of recursive lambdas
  16. 1:07:10The Y Combinator technique
  17. 1:15:13Recursive lambda visitation
  18. 1:27:47Conclusion and guidelines
~/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.