When Function Arguments Won’t Change Across Invocations
Suppose that another function has an argument that will always take the same value when invoked by the functor. The function looks like this:
double function2 (char c, double f);
Instead of requiring the value of the double to be specified at every invocation, the functor stores the value via a binder object, and adds it to the end of the function call. When the functor object is constructed, for example, a value of 3.14 might be specified for the second argument. That value always stays the same for every function call. Arguments like this, which are stored within the binder object for as long as it exists, are often referred to as callee or client data. In this case, the functor contains a binder object, which in turn contains both a function pointer and callee data.
The caller knows nothing about the second argument. The caller invokes the functor with one argument:
functor2('y');
The functor in turn invokes the binder object, which adds the second argument when it launches the function:
function2('y',3.14);
Now the process looks something like
Figure 47.
You can use callee data to handle a function that has more arguments than the functor invocation specifies, provided that the extra arguments do not have to change across calls.