Chapter 2
Working with Lambda Expressions
IN THIS CHAPTER
Defining why you need lambda expressions
Understanding the parts of a lambda expression
Performing practical tasks with lambda expressions
The “Using Lambda Expressions for Implementation” section of Chapter 1 of this minibook offers a brief overview of lambda expressions as they apply to transforms. However, lambda expressions can do considerably more than you discover in that section’s example. Using lambda expressions isn’t required to write good C++ code, but they can make your C++ code better and allow for certain optimizations in some cases. This chapter discusses in more detail how and when you use lambda expressions.
This chapter also describes the parts of a lambda expression. You may not ever use everything that a lambda expression has to offer, but it’s good to know what’s available. You might find that you can make your code even shorter and easier to understand by creating just the right type of lambda expression.
Finally, the chapter shows some examples of how to use lambda expressions for practical purposes such as sorting data. It also helps you understand some development nuances, such as throwing an exception ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access