#include <qgarlib/stl.H>
mem_fun2_ptr_t is an adaptor for member functions that take two arguments. If T is some class with a member Result T::f(Arg1, Arg2) (Result type can be void), and t an instance of T. Then the mem_ptr_fun2_t<Result, T, Arg1, Arg2> 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, and if t a pointer to an instance of T (T*) and a is a value of type Arg, then the expression F(a, b) is equivalent to the expression t->f(a, b). 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_fun2_t directly. It is better to use the helper function qst_mem_ptr_fun instead.
Definition at line 347 of file stl.H.
Public Member Functions | |
| mem_ptr_fun2_t (X *inst, Result(X::*ptr)(Arg1, Arg2)) | |
| Creates an adapter to a binary member function of an instance of class X. | |
| Result | operator() (Arg1 a, Arg2 b) |
| Executes the binary 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 )(Arg1, Arg2) |
| Pointer to the member function to be called. | |
|
||||||||||||||||
|
Creates an adapter to a binary member function of an instance of class X.
|
|
||||||||||||||||
|
Executes the binary member function passed on creation and return the result.
Definition at line 375 of file stl.H. References qgar::mem_ptr_fun2_t< Result, X, Arg1, Arg2 >::_inst, and qgar::mem_ptr_fun2_t< Result, X, Arg1, Arg2 >::_ptr. |
|
|||||
|
Pointer to the instance whose member function is to be called.
Definition at line 383 of file stl.H. Referenced by qgar::mem_ptr_fun2_t< Result, X, Arg1, Arg2 >::operator()(). |
|
|||||
|
Pointer to the member function to be called.
Referenced by qgar::mem_ptr_fun2_t< Result, X, Arg1, Arg2 >::operator()(). |