Model of

Adaptable Unary Function

Type requirements

AdaptableBinaryFunction must be a model of Adaptable Binary Function.

Public base classes

unary_function<AdaptableBinaryFunction::first_argument_type, AdaptableBinaryFunction::result_type>

Members
Member Where defined Description
argument_type Adaptable Unary Function The type of the function object's argument, which is AdaptableBinaryFunction::first_argument_type
result_type Adaptable Unary Function The type of the result: AdaptableBinaryFunction::result_type
result_type operator()(const argument_type& x) const Adaptable Unary Function Function call. Returns F(x, c) , where F and c are the arguments with which this binder1st was constructed.
binder2nd(const AdaptableBinaryFunction& F, AdaptableBinaryFunction::second_argument_type c) binder2nd See below
template <class AdaptableBinaryFunction, class T> binder2nd<AdaptableBinaryFunction> bind2nd(const AdaptableBinaryFunction& F, const T& c); binder2nd See below
New members

These members are not defined in the Adaptable Unary Function requirements, but are specific to binder2nd.

Member Description
binder2nd(const AdaptableBinaryFunction& F, AdaptableBinaryFunction::second_argument_type c) The constructor. Creates a binder2nd such that calling it with the argument x (where x is of type AdaptableBinaryFunction::first_argument_type) corresponds to the call F(x, c).
template <class AdaptableBinaryFunction, class T> binder2nd<AdaptableBinaryFunction> bind2nd(const AdaptableBinaryFunction& F, const T& c); If F is an object of type AdaptableBinaryFunction, then bind2nd(F, c) is equivalent to binder2nd<AdaptableBinaryFunction>(F, c), but is more convenient. The type T must be convertible to AdaptableBinaryFunction::second_argument_type. This is a global function, not a member function.
Notes

[1] Intuitively, you can think of this operation as 'binding' the second argument of a binary function to a constant, thus yielding a unary function. This is a special case of a closure.

See also

The function object overview, binder1st, Adaptable Unary Function, Adaptable Binary Function

ptr_fun

Categories: functors, adaptors

Component type: function

Prototype

template <class Arg, class Result>

pointer_to_unary_function<Arg, Result> ptr_fun(Result (*x)(Arg));

template <class Arg1, class Arg2, class Result>

pointer_to_binary_function<Arg1, Arg2, Result> ptr_fun(Result (*x)(Arg1, Arg2));

Description

Ptr_fun takes a function pointer as its argument and returns a function pointer adaptor, a type of function object. It is actually two different functions, not one (that is, the name ptr_fun is overloaded). If its argument is of type Result (*)(Arg) then ptr_fun creates a

Добавить отзыв
ВСЕ ОТЗЫВЫ О КНИГЕ В ИЗБРАННОЕ

0

Вы можете отметить интересные вам фрагменты текста, которые будут доступны по уникальной ссылке в адресной строке браузера.

Отметить Добавить цитату