/* */ #include #include "SharedHandle.h" // mem_fun_t for SharedHandle template class mem_fun_sh_t:public std::unary_function< SharedHandle, ReturnType> { private: ReturnType (ClassType::*f)(); public: mem_fun_sh_t(ReturnType (ClassType::*f)()):f(f) {} ReturnType operator()(const SharedHandle& x) const { return (x.get()->*f)(); } }; // const_mem_fun_t for SharedHandle template class const_mem_fun_sh_t:public std::unary_function< SharedHandle, ReturnType> { private: ReturnType (ClassType::*f)() const; public: const_mem_fun_sh_t(ReturnType (ClassType::*f)() const):f(f) {} ReturnType operator()(const SharedHandle& x) const { return (x.get()->*f)(); } }; template mem_fun_sh_t mem_fun_sh(ReturnType (ClassType::*f)()) { return mem_fun_sh_t(f); }; template const_mem_fun_sh_t mem_fun_sh(ReturnType (ClassType::*f)() const) { return const_mem_fun_sh_t(f); }; template class adopt2nd_t:public std::binary_function { private: BinaryOp _binaryOp; UnaryOp _unaryOp; public: adopt2nd_t(const BinaryOp& b, const UnaryOp& u): _binaryOp(b), _unaryOp(u) {} typename BinaryOp::result_type operator()(const typename BinaryOp::first_argument_type& x, const typename UnaryOp::argument_type& y) { return _binaryOp(x, _unaryOp(y)); } }; template inline adopt2nd_t adopt2nd(const BinaryOp& binaryOp, const UnaryOp& unaryOp) { return adopt2nd_t(binaryOp, unaryOp); };