~/talk

Lambdas, how to capture everything and stay sane

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

Describes exact capture kinds, gives concrete rules and compiler surprises: simple captures preserve constness while init captures drop CV qualifiers, capture-defaults can silently capture the wrong object (globals aren’t capturable) and create lifetime bugs, move-only objects become usable via init captures and move semantics, and parameter packs are handled with init-capture pack expansion and forwarding. Includes clear code examples, explains why the closure type gets const operator() by default, and shows practical fixes (mutable, explicit captures, overloads for lvalue/rvalue).

AI-written summary · about

  1. 0:00Start
  2. 2:03A casual occurrence
  3. 4:01Lambdas & closures
  4. 6:28Simple captures & capture defaults
  5. 8:03Generalized captures a.k.a init captures
  6. 12:54Capture type deduction rules
  7. 16:39Adding const with init capture
  8. 17:46When (not) to capture
  9. 30:30The magic of this
  10. 36:41Being explicit with this
  11. 48:44Capturing parameter...packs
~/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.