Search⌘ K

Call Operator

Explore how to overload the call operator in C++ to create function objects called functors. Understand their ability to maintain state and act like functions, and how they integrate with STL algorithms such as transform and reduce. Learn the differences between unary and binary functors and the relationship to lambda functions.

We'll cover the following...

By overloading the function call operator, (), we can call objects like ordinary function objects that may or may not have arguments. These special objects are known as function objects or, wrongly, as functors.

The best feature of function objects is that they can have a ...