When You’re Not Using a Return Value
The previous examples have used the function’s return value, but suppose we have a different caller that needs to call functions with one char argument, but does not use a return value. This routine is written to call a functor of type RWTFunctor <void(char)>.
NOTE: A routine that is not going to use the return value should never specify a functor that has one, to avoid limiting the functions the routine can access.
A functor without a return value, like RWTFunctor <void(char)>, can encapsulate a function with any return type. A functor that specifies a return value, like RWTFunctor <double(char)>, can encapsulate only functions with convertible return types.
Now suppose the callee wants to supply this function to the caller:
double function3 (char c);
A functor without a return value automatically ignores the function’s return value. The caller never sees it. In this case, the process looks something like
Figure 48.
Nothing different is required in the invocation. The caller calls the functor in the usual way:
functor3('y');
and the functor calls the function:
function3('y');