- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
template <class ResultBinaryFunc, class BinaryFunc1, class BinaryFunc2>
class complex_binary_compose: public std::binary_function<BinaryFunc1::first_argument_type,
BinaryFunc1::second_argument_type,
ResultBinaryFunc::result_type>
{
public:
complex_binary_compose(const ResultBinaryFunc & BF, const BinaryFunc1 & UF1, const BinaryFunc2 & UF2) :
_bf(BF), _f1(UF1), _f2(UF2) {}
result_type operator()(first_argument_type arg1, second_argument_type arg2)
{
return _bf(_f1(arg1, arg2), _f2(arg1, arg2));
}
private:
ResultBinaryFunc _bf;
BinaryFunc1 _f1;
BinaryFunc2 _f2;
};
template <class ResultBinaryFunc, class BinaryFunc1, class BinaryFunc2>
complex_binary_compose<ResultBinaryFunc, BinaryFunc1, BinaryFunc2>
complex_compose2(const ResultBinaryFunc & BF, const BinaryFunc1 & UF1, const BinaryFunc2 & UF2)
{
return complex_binary_compose<ResultBinaryFunc, BinaryFunc1, BinaryFunc2>(BF, UF1, UF2);
}