Predefined Function Objects of the Standard Template Library

Many predefined function objects can be found in the header <functional>. Figure 16.14 lists several of the dozens of Standard Library function objects, which are all implemented as class templates. Section 20.8 of the C++ standard contains the complete list of function objects. We used the function object less<T> in the set, multiset and priority_queue examples, to specify the sorting order for elements in a container.

Image

Fig. 16.14. Function objects in the Standard Library.

Get C++11 for Programmers, Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.