~/talk

C++ Lambda Idioms

Talkat CppCon 2022 · 2022-09-11..09-16· [javascript]
links:none on file
slides:none on file

Covers concrete techniques and gotchas: how closure types are generated, the unary-plus trick for forcing conversion to function pointer, using immediately-invoked lambda for complex const initialization (works for move-only types via init-capture), init-capture to avoid per-iteration allocations, generic lambdas create operator() templates, inheriting lambdas to make an overload set, a static-local lambda trick to run initialization exactly once (faster than std::call_once in one benchmark), and C++23’s deducing-this enabling natural recursive lambdas.

AI-written summary · about

  1. 0:00Introduction
  2. 1:25Lambda Expressions
  3. 6:15Unary Trick
  4. 8:30Captures
  5. 13:08Local Variables
  6. 16:35Immediately Invoked Functions
  7. 22:57Never Again
  8. 26:24Generic Lambda
  9. 30:38Variable Template
  10. 38:14Init Capture
  11. 41:15Class Template Argument Deduction
  12. 46:36C20 Lambda Changes
  13. 53:22C23 Lambda Changes
  14. 53:33C23 Deducing
  15. 55:53Recursive Lambda
  16. 58:38Tree Traversal
~/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.