Annex D (normative) Compatibility features [depr]

D.9 Binders [depr.lib.binders]

The binders binder1st, bind1st, binder2nd, and bind2nd are deprecated. [ Note: The function template bind ([bind]) provides a better solution. — end note ]

D.9.1 Class template binder1st [depr.lib.binder.1st]

template <class Fn> class binder1st : public unary_function<typename Fn::second_argument_type, typename Fn::result_type> { protected: Fn op; typename Fn::first_argument_type value; public: binder1st(const Fn& x, const typename Fn::first_argument_type& y); typename Fn::result_type operator()(const typename Fn::second_argument_type& x) const; typename Fn::result_type operator()(typename Fn::second_argument_type& x) const; };

The constructor initializes op with x and value with y.

operator() returns op(value,x).

D.9.2 bind1st [depr.lib.bind.1st]

template <class Fn, class T> binder1st<Fn> bind1st(const Fn& fn, const T& x);

Returns: binder1st<Fn>(fn, typename Fn::first_argument_type(x)).

D.9.3 Class template binder2nd [depr.lib.binder.2nd]

template <class Fn> class binder2nd : public unary_function<typename Fn::first_argument_type, typename Fn::result_type> { protected: Fn op; typename Fn::second_argument_type value; public: binder2nd(const Fn& x, const typename Fn::second_argument_type& y); typename Fn::result_type operator()(const typename Fn::first_argument_type& x) const; typename Fn::result_type operator()(typename Fn::first_argument_type& x) const; };

The constructor initializes op with x and value with y.

operator() returns op(x,value).

D.9.4 bind2nd [depr.lib.bind.2nd]

template <class Fn, class T> binder2nd<Fn> bind2nd(const Fn& op, const T& x);

Returns: binder2nd<Fn>(op, typename Fn::second_argument_type(x)).

Example:

find_if(v.begin(), v.end(), bind2nd(greater<int>(), 5));

finds the first integer in vector v greater than 5;

find_if(v.begin(), v.end(), bind1st(greater<int>(), 5));

finds the first integer in v less than 5.  — end example ]