Lecture overview -- Keyboard shortcut: 'u'  Previous page: The for-each algorithm -- Keyboard shortcut: 'p'  Next page: Using the sort algorithm -- Keyboard shortcut: 'n'  Lecture notes - all slides together  Annotated slide -- Keyboard shortcut: 't'  Alphabetic index  Help page about these notes  Course home    Templates and The Standard Library - slide 35 : 39

Function objects

A function object (function-like object or functor) is a an object with an application operator, operator()

point.h
Class Point with overloadings of the application operator.
point.cc
Definition of Point application operators.
prog.cc
Sample uses of the application operators - Funny and artificial.
As another example, we provide access to x and y in point p via p(1) and p(2)
point.h
Class Point with another overloading of the application operator.
point.cc
Definition of then Point application operator.
prog.cc
Sample uses of the application operators - slightly more realistic.