sl@0: #ifndef BOOST_BIND_MAKE_ADAPTABLE_HPP_INCLUDED sl@0: #define BOOST_BIND_MAKE_ADAPTABLE_HPP_INCLUDED sl@0: sl@0: // sl@0: // make_adaptable.hpp sl@0: // sl@0: // Copyright (c) 2002 Peter Dimov and Multi Media Ltd. sl@0: // sl@0: // Distributed under the Boost Software License, Version 1.0. (See sl@0: // accompanying file LICENSE_1_0.txt or copy at sl@0: // http://www.boost.org/LICENSE_1_0.txt) sl@0: // sl@0: sl@0: namespace boost sl@0: { sl@0: sl@0: namespace _bi sl@0: { sl@0: sl@0: template class af0 sl@0: { sl@0: public: sl@0: sl@0: typedef R result_type; sl@0: sl@0: explicit af0(F f): f_(f) sl@0: { sl@0: } sl@0: sl@0: result_type operator()() sl@0: { sl@0: return f_(); sl@0: } sl@0: sl@0: result_type operator()() const sl@0: { sl@0: return f_(); sl@0: } sl@0: sl@0: private: sl@0: sl@0: F f_; sl@0: }; sl@0: sl@0: template class af1 sl@0: { sl@0: public: sl@0: sl@0: typedef R result_type; sl@0: typedef A1 argument_type; sl@0: typedef A1 arg1_type; sl@0: sl@0: explicit af1(F f): f_(f) sl@0: { sl@0: } sl@0: sl@0: result_type operator()(A1 a1) sl@0: { sl@0: return f_(a1); sl@0: } sl@0: sl@0: result_type operator()(A1 a1) const sl@0: { sl@0: return f_(a1); sl@0: } sl@0: sl@0: private: sl@0: sl@0: F f_; sl@0: }; sl@0: sl@0: template class af2 sl@0: { sl@0: public: sl@0: sl@0: typedef R result_type; sl@0: typedef A1 first_argument_type; sl@0: typedef A2 second_argument_type; sl@0: typedef A1 arg1_type; sl@0: typedef A2 arg2_type; sl@0: sl@0: explicit af2(F f): f_(f) sl@0: { sl@0: } sl@0: sl@0: result_type operator()(A1 a1, A2 a2) sl@0: { sl@0: return f_(a1, a2); sl@0: } sl@0: sl@0: result_type operator()(A1 a1, A2 a2) const sl@0: { sl@0: return f_(a1, a2); sl@0: } sl@0: sl@0: private: sl@0: sl@0: F f_; sl@0: }; sl@0: sl@0: template class af3 sl@0: { sl@0: public: sl@0: sl@0: typedef R result_type; sl@0: typedef A1 arg1_type; sl@0: typedef A2 arg2_type; sl@0: typedef A3 arg3_type; sl@0: sl@0: explicit af3(F f): f_(f) sl@0: { sl@0: } sl@0: sl@0: result_type operator()(A1 a1, A2 a2, A3 a3) sl@0: { sl@0: return f_(a1, a2, a3); sl@0: } sl@0: sl@0: result_type operator()(A1 a1, A2 a2, A3 a3) const sl@0: { sl@0: return f_(a1, a2, a3); sl@0: } sl@0: sl@0: private: sl@0: sl@0: F f_; sl@0: }; sl@0: sl@0: template class af4 sl@0: { sl@0: public: sl@0: sl@0: typedef R result_type; sl@0: typedef A1 arg1_type; sl@0: typedef A2 arg2_type; sl@0: typedef A3 arg3_type; sl@0: typedef A4 arg4_type; sl@0: sl@0: explicit af4(F f): f_(f) sl@0: { sl@0: } sl@0: sl@0: result_type operator()(A1 a1, A2 a2, A3 a3, A4 a4) sl@0: { sl@0: return f_(a1, a2, a3, a4); sl@0: } sl@0: sl@0: result_type operator()(A1 a1, A2 a2, A3 a3, A4 a4) const sl@0: { sl@0: return f_(a1, a2, a3, a4); sl@0: } sl@0: sl@0: private: sl@0: sl@0: F f_; sl@0: }; sl@0: sl@0: } // namespace _bi sl@0: sl@0: template _bi::af0 make_adaptable(F f) sl@0: { sl@0: return _bi::af0(f); sl@0: } sl@0: sl@0: template _bi::af1 make_adaptable(F f) sl@0: { sl@0: return _bi::af1(f); sl@0: } sl@0: sl@0: template _bi::af2 make_adaptable(F f) sl@0: { sl@0: return _bi::af2(f); sl@0: } sl@0: sl@0: template _bi::af3 make_adaptable(F f) sl@0: { sl@0: return _bi::af3(f); sl@0: } sl@0: sl@0: template _bi::af4 make_adaptable(F f) sl@0: { sl@0: return _bi::af4(f); sl@0: } sl@0: sl@0: } // namespace boost sl@0: sl@0: #endif // #ifndef BOOST_BIND_MAKE_ADAPTABLE_HPP_INCLUDED