Standard C++ Library Reference ISO/IEC (VERSION3)

pointer_to_binary_function
template<class Arg1, class Arg2, class Result>
class pointer_to_binary_function
: public binary_function<Arg1, Arg2, Result> {
public:
explicit pointer_to_binary_function(
Result (*pfunc)(Arg1, Arg2));
Result operator()(const Arg1 left, const Arg2 right) const;
};
The template class stores a copy of pfunc. It defines its member function operator() as returning (*pfunc)(left,
right).
pointer_to_unary_function
template<class Arg, class Result>
class pointer_to_unary_function
: public unary_function<Arg, Result> {
public:
explicit pointer_to_unary_function(
Result (*pfunc)(Arg));
Result operator()(const Arg left) const;
};
The template class stores a copy of pfunc. It defines its member function operator() as returning
(*pfunc)(left).
ptr_fun
template<class Arg, class Result>
pointer_to_unary_function<Arg, Result>
ptr_fun(Result (*pfunc)(Arg));
template<class Arg1, class Arg2, class Result>
pointer_to_binary_function<Arg1, Arg2, Result>
ptr_fun(Result (*pfunc)(Arg1, Arg2));
The first template function returns pointer_to_unary_function<Arg, Result>(pfunc).
The second template function returns pointer_to_binary_function<Arg1, Arg2, Result>(pfunc).
unary_function
template<class Arg, class Result>
struct unary_function {
typedef Arg argument_type;
typedef Result result_type;
};
The template class serves as a base for classes that define a member function of the form:
result_type operator()(const argument_type&) const
Hence, all such unary functions can refer to their sole argument type as argument_type and their return type as
result_type.