Chapter 10. STL Function Objects and Using Lambdas
This chapter discusses in detail the features to pass specific functionality to algorithms and member functions, function objects, or functors for short (introduced in Section 6.10, page 233). It covers the full set of predefined function objects and function adapters and binders and the concept of functional composition, provides examples of self-written function objects, and presents details about the application of lambdas (introduced in Section 3.1.10, page 28, and Section 6.9, page 229).
As a consequence, you will learn details and surprising behavior of the algorithms remove_if()
and for_each()
.
10.1. The Concept of Function Objects
A function object, or functor, is an object that has operator ...
Get C++ Standard Library, The: A Tutorial and Reference, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.