O'Reilly logo

Sams Teach Yourself C++ in One Hour a Day, Seventh Edition by Siddhartha Rao

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Lesson 21. Understanding Function Objects

Function objects or functors might sound exotic or intimidating, but they are entities of C++ that you have probably seen, if not also used, without having realized it. In this lesson, you learn

• The concept of function objects

• The usage of function objects as predicates

• How unary and binary predicates are implemented using function objects

The Concept of Function Objects and Predicates

On a conceptual level, function objects are objects that work as functions. On an implementation level, however, function objects are objects of a class that implement operator(). Although functions and function-pointers can also be classified as function objects, it is the capability of an object of a class that ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required