~/talk

Let's Look at Lambdas

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

Timeline from C++98 tricks to C++20: lambdas are compiler-generated unnamed classes that let you pass small callables into algorithms, support capture-by-value vs capture-by-reference, require auto for their type, and can be generic lambdas with auto or use init-capture and move semantics. Pitfalls: dangling references when returning a lambda that captured by reference, implicit this capture is deprecated, capturing lambdas cannot convert to function pointers, and template-heavy code can cause code bloat. Performance: debug builds show extra calls, but -O1 usually inlines and erases them.

AI-written summary · about

  1. 0:00Start
  2. 13:00Pre Standardization
  3. 16:10Boost Bind
  4. 17:42Recap
  5. 18:41Lambda Expression
  6. 19:57The Lambda Introducer
  7. 20:29Lambda Introducer
  8. 28:10Capture Local Variables That Are in Scope
  9. 31:59Does the Compiler Name the Local Struct
  10. 37:16Implicitly Capture Variables
  11. 38:43Implicit Capture of Fields
  12. 45:44With Implicit Capture Does the Anonymous Class Contain Only the Set of Variables Used in the Body
  13. 47:35Generic Lambdas
  14. 49:42Syntactic Sugar
  15. 51:29Initialize the Capture Variable
  16. 52:20Rename Capture Variable
  17. 56:53Delayed Initialization
  18. 1:00:18Refactoring
  19. 1:01:42Template Arguments
  20. 1:06:39Code Bloat
  21. 1:09:07Runtime Cost
  22. 1:19:23Implicit Capture
  23. 1:20:10Advantage of Using a Lambda inside a Class versus a Function
  24. 1:20:25When Is the Right Time Uh To Use a Lambda inside a Class Rather than To Use a Free Function a Member Function
  25. 1:24:05Can a Lambda with Captures Be Passed as a Function Pointer
~/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.