Binding Functor Arguments
The Functor package supports creation of binder objects via the rwBind() function. Combined with RWTFunctor, this binder functionality can provide a powerful tool when adapting an existing function to match a common interface. For example, if a caller has specified a functor interface of RWTFunctor<void()>, but the function you would like to invoke takes a parameter, rwBind() can be used to specify the function argument when the functor is created instead of when it is invoked:
 
void function1(int);
RWTFunctor<void()> functor1 = rwBind(function1, 5);
When functor1 is invoked, function1 will be called with the bound argument 5.
rwBind() has the following signature:
 
rwBind(<callable>, <arg type 1>, <arg type 2>, …, <arg type N>)
Where <callable> is the callable object that will be invoked and <arg type 1>, <arg type 2>, …, <arg type N> are the arguments that <callable> will be invoked with. rwBind()returns a binder object, which is itself a function object that wraps <callable>, along with copies of the specified arguments. When the binder object is invoked, it will invoke <callable> with the arguments stored in the binder object.