Parameter | Description |
Result | The member function's return type. |
X | The class whose member function the mem_fun1_ref_t invokes. |
Arg | The member function's argument type. |
Model of Adaptable Binary Function
Type requirements X has at least one member function that takes a single argument of type Arg and that returns a value of type Result. [1]
Public base classes binary_function<X, Arg, Result>
Members Member | Where defined | Description |
first_argument_type | Adaptable Binary Function | The type of the first argument: X |
second_argument_type | Adaptable Binary Function | The type of the second argument: Arg |
result_type | Adaptable Binary Function | The type of the result: Result |
Result operator()(X& x, Arg a) const | Binary Function | Function call operator. Invokes x.f(a), where f is the member function that was passed to the constructor. |
explicit mem_fun1_ref_t(Result (X::*f)(Arg)) | mem_fun1_ref_t | See below. |
template <class Result, class X, class Arg> mem_fun1_ref_t<Result, X, Arg> mem_fun_ref(Result (X::*f)(Arg)); [2] | mem_fun1_ref_t | See below. |
New members These members are not defined in the Adaptable Binary Function requirements, but are specific to mem_fun1_ref_t.
Member | Description |
explicit mem_fun1_ref_t(Result (X::*f)(Arg)) | The constructor. Creates a mem_fun1_ref_t that calls the member function f. |
template <class Result, class X, class Arg> mem_fun1_ref_t<Result, X, Arg> mem_fun1_ref(Result (X::*f)(Arg)); [2] | If f is of type Result (X::*)(Arg) then mem_fun_ref(f) is the same as mem_fun1_ref_t<Result, X, Arg>(f) , but is more convenient. This is a global function, not a member function. |
Notes [1] The type Result is permitted to be void. That is, this adaptor may be used for functions that return no value. However, this presents implementation difficulties. According to the draft C++ standard, it is possible to return from a void function by writing return void instead of just return. At present, however (early 1998), very few compilers support that feature. As a substitute, then, mem_fun1_ref_t uses partial specialization to support void member functions. If your compiler has not implemented partial specialization, then you will not be able to use mem_fun1_ref_t with member functions whose return type is void.
[2] This helper function was called mem_fun1_ref in drafts of the C++ standard, but it is called mem_fun_ref in the final standard. This implementation provides both versions for backward compatibility, but mem_fun1_ref will be removed in a future release.
See also