- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
template <class T> class return_1_t: public std::unary_function<T, T> {
public:
return_1_t(const T & Ret) : _ret(Ret) {}
T operator()(T Arg) const { return _ret; }
private:
T _ret;
};
template <class Arg1, class Arg2> class project1st: public std::binary_function<Arg1, Arg2, Arg1> {
public:
Arg1 operator()(const Arg1 & X, const Arg2 & Y) { return X; }
};
template <class Arg1, class Arg2> class project2nd: public std::binary_function<Arg1, Arg2, Arg2> {
public:
Arg2 operator()(const Arg1 & X, const Arg2 & Y) { return Y; }
};
template <class T> class identity: public std::unary_function<T, T> {
public:
T operator()(const T & Arg) const { return Arg; }
};
template <class To, class From> class static_cast_t: public std::unary_function<To, From> {
public:
To operator()(From obj) const { return static_cast<To>(obj); }
};
template <class T> class take_address: public std::unary_function<T&, T*> {
public:
result_type operator()(argument_type arg) const { return &(arg); }
};
template <class T> class take_const_address: public std::unary_function<const T&, const T*> {
public:
result_type operator()(argument_type arg) const { return &(arg); }
};
template <class T> class creator: public std::unary_function<void, T*> {
public:
result_type operator()(void) const { return new T(); }
};
template <class T, class Arg1> class creator_1_par: public std::unary_function<Arg1, T*> {
public:
result_type operator()(argument_type arg) const { return new T(arg); }
};
template <class T, class Arg1, class Arg2> class creator_2_par: public std::binary_function<Arg1, Arg2, T*> {
public:
result_type operator()(first_argument_type arg1, second_argument_type arg2) const { return new T(arg1, arg2); }
};
template <class T> class maker: public std::unary_function<void, T> {
public:
result_type operator()(void) const { return T(); }
};
template <class T, class Arg1> class maker_1_par: public std::unary_function<Arg1, T> {
public:
result_type operator()(argument_type arg) const { return T(arg); }
};
template <class T, class Arg1, class Arg2> class maker_2_par: public std::binary_function<Arg1, Arg2, T> {
Вот до чего доводит людей отсутствие частичного применения и лямбд.