Lambdas from First Principles: A Whirlwind Tour of C++""
summary
Claim: lambdas are just syntactic sugar over ordinary C++ constructs and compile into anonymous functor classes with the same codegen as hand‑written classes. Demonstrations use Clang disassembly to show name mangling and instantiation patterns, show surprising pitfalls (static locals per instantiation, three puzzles), and compare C++11 vs C++14 init-capture and generic lambdas. Builds anonymous closure objects ($_0), shows they avoid heap/GC, and proves the approach produces identical machine code.
AI-written summary · about
chapters (11)
- 0:00Introduction to lambdas
- 1:28Plain old functions
- 8:49Member functions and operator()
- 13:38What is a lambda?
- 21:18Capture modes explained
- 28:01Puzzle: globals and captures
- 32:13Static locals in lambdas
- 43:43Generic lambdas
- 50:44Variadic lambdas
- 55:37Capturing parameter packs
- 58:12Q&A and summary
related talks
05mC++20 Lambdas: Familiar Template Syntax
38mLambda? You Keep Using that Letter
50mC++ Costless Abstractions: the compiler view
01h 16mCallable Objects in Java, C#, Rust, and C++
01h 01mBack To Basics: Lambda Expressions
01h 01mLambda? You Keep Using that Letter
45mWhat Java Compiles To
49mLambda? You Keep Using that Letter
