Binding Member Functions
Along with normal functions, rwBind() also supports binding member functions. When binding member functions, the signature of rwBind() is interpreted slightly differently, as follows:
 
rwBind(<member function>, <object>, <arg type 1>, <arg type 2>, …, <arg type N>)
In this variant, <member function> is a pointer to the member function that will be invoked, <object> is the instance of an object on which <member function> will be invoked, and <arg type 1>, <arg type 2>, …, <arg type N> are the arguments that will be passed to the member function. For example, to create a functor that invokes RWCString::length() on an RWCString instance, you could use the following:
 
RWCString str;
RWTFunctor<size_t()> functor1 =
rwBind(&RWCString::length, rwRef(str));
When functor1 is invoked, it will invoke the equivalent of:
 
str.length();