What this C++ lambda fundamentals question tests
This is an easy language-knowledge question that checks whether you can read and reason about lambda expressions in C++. It's the kind of question that separates candidates who have worked with modern C++ from those who haven't, and it appears regularly in coding rounds because lambdas are now standard across production quant systems.
To answer correctly, you need to understand how lambdas capture variables, how they interact with scope, and what the resulting behavior is when the lambda executes. The question rewards careful code reading and a solid grasp of C++'s capture semantics—knowledge that pays off repeatedly in interview problems that use lambdas for sorting, filtering, or state management.
- Capture by value vs. capture by reference
- Lambda scope and variable lifetime
- Type deduction and closure objects