Constructing Functors
To create a functor:
Construct a handle
Bind a callable object to that handle
The simplest way to do this is to bind the callable object handle when it is being constructed.
Example 66 shows the minimal code required for building and using a functor.
Example 66 – Creating and using a functor
#include <rw/functor/RWTFunctor.h>
void func(void);
int main(void) {
// build a functor to encapsulate function func
RWTFunctor<void()> functor = func;
//invoke the functor
functor();
return 0;
}