result_type | Adaptable Unary Function | The type of the result: |
result_type operator()(const argument_type& x) const | Adaptable Unary Function | Function call. Returns |
binder1st(const AdaptableBinaryFunction& F, AdaptableBinaryFunction::first_argument_type c) | binder1st | See below |
template <class AdaptableBinaryFunction, class T> binder1st<AdaptableBinaryFunction> bind1st(const AdaptableBinaryFunction& F, const T& c); | binder1st | See below |
These members are not defined in the Adaptable Unary Function requirements, but are specific to
Member | Description |
---|---|
binder1st(const AdaptableBinaryFunction& F, AdaptableBinaryFunction::first_argument_type c) | The constructor. Creates a |
template <class AdaptableBinaryFunction, class T> binder1st<AdaptableBinaryFunction> bind1st(const AdaptableBinaryFunction& F, const T& c); | If |
[1] Intuitively, you can think of this operation as 'binding' the first argument of a binary function to a constant, thus yielding a unary function. This is a special case of a closure.
The function object overview,
binder2nd<AdaptableBinaryFunction>
Categories: functors, adaptors
Component type: type
The easiest way to create a
Finds the first positive number in a list.
list<int> L;
…
list<int>::iterator first_positive = find_if(L.begin(), L.end(), bind2nd(greater<int>(), 0));
assert(first_positive == L.end() || *first_positive > 0);
Defined in the standard header functional, and in the nonstandard backward-compatibility header function.h.
Parameter | Description |
---|---|
AdaptableBinaryFunction | The type of the binary function whose second argument is being bound to a constant. |