Although
functors have been identified with
function objects in
print (
Coplien?), calling "
operator()", or an object that defines
it, a "
functor" is not universally agreed-upon usage with
C++. As
far as I know, the term
functor has been used in mathematics for
probably a century or longer for a mapping that maps functions to
other things, for example to numbers. In programming terms, a
functor would be a function whose argument type is a function type.
Example:
typedef void (function_t)(); // Type of a function taking no args and
// returning void
int functor(function_t * const arg); // direct declaration of a function
// that is a functor
Sure,
functor may sound cooler than
function
object or
operator(), but using it with this
meaning unnecessarily ambiguates it.
(Does this make me a pedant? ;-)