A lambda expression defines an unnamed callable inline. It can capture variables from its surrounding scope, avoiding a separately named function object or extra arguments. section 2.1.1 section 4.1.1
std::thread my_thread([]{
do_something();
do_something_else();
});
This lambda supplies the work for a new thread without defining a separate callable type. section 2.1.1
A lambda as a wait predicate
The condition-variable wait uses []{return !data_queue.empty();} to check whether work is available. The empty capture list is sufficient because the lambda reads no surrounding variables. section 4.1.1
Lambdas also handle typed messages: a handler can capture state by reference, update it, and choose the next state in a message-driven ATM. section 4.4.2

















