Lesson 22. C++11 Lambda Expressions
Lambda expressions are a compact way to define and construct function objects without a name. These expressions are new to C++11. In this lesson, you find out
• How to program a lambda expression
• How to use lambda expressions as predicates
• How to program lambda expressions that can hold and manipulate a state
What Is a Lambda Expression?
A lambda expression can be visualized as a compact version of an unnamed
class) with a public
operator(). In that sense, a lambda expression is a function object like those in Lesson 21, “Understanding Function Objects.” Before jumping into analyzing the programming of lambda functions, take a function object from Listing 21.1 (from Lesson 21) as an example: ...