Standard C++ Library Class Reference
typename Operation::result_type>
{
public:
typedef typename unary_function<typename
Operation::first_argument_type, typename
Operation::result_type>::argument_type argument_type;
typedef typename unary_function<typename
Operation::first_argument_type, typename
Operation::result_type>::result_type result_type;
binder2nd(const Operation&,
const typename Operation::second_argument_type&);
result_type operator() (const argument_type&) const;
};
// Creator bind1st
template <class Operation, class T>
binder1st<Operation> bind1st (const Operation&, const T&);
// Creator bind2nd
template<class Operation, class T>
binder2nd <Operation> bind2nd(const Operation&, const T&);
Example
//
// binders.cpp
//
#include <functional>
#include <algorithm>
#include <vector>
#include <iostream.h>
int main()
{
typedef vector<int>::iterator iterator;
int d1[4] = {1,2,3,4};
//
// Set up a vector
//
vector<int> v1(d1,d1 + 4);
//
// Create an 'equal to 3' unary predicate by binding 3 to
// the equal_to binary predicate.
//
binder1st<equal_to<int> > equal_to_3 =
bind1st(equal_to<int>(),3);