What this C++ lambda question tests
This is an easy language-fundamentals question that quant interviewers use to check whether you understand what a lambda actually is at the implementation level, not just how to write one. It separates candidates who have memorized syntax from those who grasp the underlying mechanism.
The question probes your mental model of how the compiler translates lambda syntax into executable code. A solid answer connects lambdas to the broader C++ object model and explains the relationship between convenience syntax and what the machine actually does.
- Compiler code generation and syntactic sugar
- Closure and capture semantics
- Function objects and the functor pattern
- Stack vs. heap allocation of captured state