// fo/compose11.hpp #include /* Класс композиционного адаптера compose_f_gx */ template class compose_f_gx_t : public std::unary_function { private: OP1 op1; // Вычисление: op1(op2(x)) OP2 op2; public: // Конструктор compose_f_gx_t(const OP1& o1, const OP2& o2) : op1(o1), op2(o2) { } // Вызов функции typename OP1::result_type operator()(const typename OP2::argument_type& x) const { return op1(op2(x)); } }; /* Вспомогательные функции для адаптера compose_f_gx */ template inline compose_f_gx_t compose_f_gx (const OP1& o1, const OP2& o2) { return compose_f_gx_t(o1,o2); }