Analyzing Functor Requirements
The type of functor you build depends on the interface you want to expose. Just as with defining a function interface, two key questions need to be answered:
*What parameters will the caller invoke the functor with?
*What does the caller expect the functor to return?
RWTFunctor is a template class with a single template type that encapsulates this information. The template type specifies a function type of the form:
 
<return type>(<arg type 1>, <arg type 2>, …, <arg type N>)
Where <return type> is the type that the functor will return, and <arg type 1>, <arg type 2>, …, <arg type N> are the types of the arguments that the functor will take. For example, if you want to declare a functor that takes no arguments and returns void, the declaration of that functor would be:
 
RWTFunctor<void()> functor1;
Likewise, to declare a functor that takes a double and an int as arguments and returns an int, the declaration would be:
 
RWTFunctor<int(double, int)> functor2;
Just as with a normal function, the types in an RWTFunctor’s signature can be qualified. For example, if you wanted to declare an RWTFunctor that takes a const RWCString& argument, the declaration would be:
 
RWTFunctor<void(const RWCString&)> functor3;