#include <qgarlib/stl.H>
qgar::mem_fun_ptr_t is an adaptor for member functions that take one argument. If T is some class with a member Result T::f(Arg) (Result type can be void, and t an instance of T. Then the mem_ptr_fun_t<result, T, Arg> is a valid STL functor that makes possible the call of t->f() as if it was a normal function.
If F is a qgar::mem_ptr_fun_t that was constructed to use the member function T::f, and if t a pointer to an instance of T (T*) and a is a value of type Arg, then the expression F(a) is equivalent to the expression t->f(a). The difference is simply that F can be passed to STL algorithms whose arguments must be function objects.
It is usually rather inconvienient to use the constructor of mem_ptr_fun_t directly. It is better to use the helper function qst_mem_ptr_fun instead.
Definition at line 193 of file stl.H.
Public Member Functions | |
| mem_ptr_fun_t (X *inst, Result(X::*ptr)(Arg)) | |
| Creates an adapter to a unary member function of an instance of class X. | |
| Result | operator() (Arg a) |
| Executes the unary member function passed on creation and return the result. | |
Private Attributes | |
| X * | _inst |
| Pointer to the instance whose member function is to be called. | |
| Result(X::* | _ptr )(Arg) |
| Pointer to the member function to be called. | |
|
||||||||||||||||
|
Creates an adapter to a unary member function of an instance of class X.
|
|
||||||||||
|
Executes the unary member function passed on creation and return the result.
Definition at line 220 of file stl.H. References qgar::mem_ptr_fun_t< Result, X, Arg >::_inst, and qgar::mem_ptr_fun_t< Result, X, Arg >::_ptr. |
|
|||||
|
Pointer to the instance whose member function is to be called.
Definition at line 227 of file stl.H. Referenced by qgar::mem_ptr_fun_t< Result, X, Arg >::operator()(). |
|
|||||
|
Pointer to the member function to be called.
Referenced by qgar::mem_ptr_fun_t< Result, X, Arg >::operator()(). |