Chapter Overview
Explore how lambda expressions in C++20 enable functional programming and improve code versatility. Understand their use with STL algorithms for predicates, recursion, and polymorphism to write clean and reusable functional code.
We'll cover the following...
In this chapter, we will cover the use of lambdas with the STL, in the following recipes:
- Use lambdas for scoped reusable code
- Use lambdas as predicates with the algorithm library
- Use
std::functionas a polymorphic wrapper - Concatenate lambdas with recursion
- Combine predicates with logical conjunction
- Call multiple lambdas with the same input
- Use mapped lambdas for a jump table