#include <qgarlib/stl.H>
mem_fun_ptr_t is an adaptor for const 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 mem_ptr_fun_t that was constructed to use the member function T::f(Arg), 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 270 of file stl.H.
Public Member Functions | |
| const_mem_ptr_fun_t (const X *const inst, Result(X::*ptr)(Arg) const) | |
| Creates an adapter to a unary member function of an instance of class X. | |
| Result | operator() (Arg a) const |
| 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) const |
| 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 297 of file stl.H. References qgar::const_mem_ptr_fun_t< Result, X, Arg >::_inst, and qgar::const_mem_ptr_fun_t< Result, X, Arg >::_ptr. |
|
|||||
|
Pointer to the instance whose member function is to be called.
Definition at line 305 of file stl.H. Referenced by qgar::const_mem_ptr_fun_t< Result, X, Arg >::operator()(). |
|
|||||
|
Pointer to the member function to be called.
Referenced by qgar::const_mem_ptr_fun_t< Result, X, Arg >::operator()(). |