Functors are objects that behave like regular functions. The beauty is that functors can be substituted in the place of function pointers. Functors are handy objects that let you extend or complement the behavior of an STL function without compromising the object-oriented coding principles.
Functors are easy to implement; all you need to do is overload the function operator. Functors are also referred to as functionoids.
The following code will demonstrate the way a simple functor can be implemented: