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
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: ...