1 #ifndef BOOST_BIND_MAKE_ADAPTABLE_HPP_INCLUDED
2 #define BOOST_BIND_MAKE_ADAPTABLE_HPP_INCLUDED
7 // Copyright (c) 2002 Peter Dimov and Multi Media Ltd.
9 // Permission to copy, use, modify, sell and distribute this software
10 // is granted provided this copyright notice appears in all copies.
11 // This software is provided "as is" without express or implied
12 // warranty, and with no claim as to its suitability for any purpose.
21 template<class F> void instantiate(F)
25 template<class R, class F> class af0
29 typedef R result_type;
31 explicit af0(F f): f_(f)
35 result_type operator()()
45 template<class R, class A1, class F> class af1
49 typedef R result_type;
50 typedef A1 argument_type;
53 explicit af1(F f): f_(f)
57 result_type operator()(A1 a1)
67 template<class R, class A1, class A2, class F> class af2
71 typedef R result_type;
72 typedef A1 first_argument_type;
73 typedef A2 second_argument_type;
77 explicit af2(F f): f_(f)
81 result_type operator()(A1 a1, A2 a2)
91 template<class R, class A1, class A2, class A3, class F> class af3
95 typedef R result_type;
100 explicit af3(F f): f_(f)
104 result_type operator()(A1 a1, A2 a2, A3 a3)
106 return f_(a1, a2, a3);
114 template<class R, class A1, class A2, class A3, class A4, class F> class af4
118 typedef R result_type;
119 typedef A1 arg1_type;
120 typedef A2 arg2_type;
121 typedef A3 arg3_type;
122 typedef A4 arg4_type;
124 explicit af4(F f): f_(f)
128 result_type operator()(A1 a1, A2 a2, A3 a3, A4 a4)
130 return f_(a1, a2, a3, a4);
140 template<class R, class F> _bi::af0<R, F> make_adaptable(F f)
142 _bi::instantiate( &_bi::af0<R, F>::operator() ); // for early error detection
143 return _bi::af0<R, F>(f);
146 template<class R, class A1, class F> _bi::af1<R, A1, F> make_adaptable(F f)
148 instantiate( &_bi::af1<R, A1, F>::operator() );
149 return _bi::af1<R, A1, F>(f);
152 template<class R, class A1, class A2, class F> _bi::af2<R, A1, A2, F> make_adaptable(F f)
154 instantiate( &_bi::af2<R, A1, A2, F>::operator() );
155 return _bi::af2<R, A1, A2, F>(f);
158 template<class R, class A1, class A2, class A3, class F> _bi::af3<R, A1, A2, A3, F> make_adaptable(F f)
160 instantiate( &_bi::af3<R, A1, A2, A3, F>::operator() );
161 return _bi::af3<R, A1, A2, A3, F>(f);
164 template<class R, class A1, class A2, class A3, class A4, class F> _bi::af4<R, A1, A2, A3, A4, F> make_adaptable(F f)
166 instantiate( &_bi::af4<R, A1, A2, A3, A4, F>::operator() );
167 return _bi::af4<R, A1, A2, A3, A4, F>(f);
172 #endif // #ifndef BOOST_BIND_MAKE_ADAPTABLE_HPP_INCLUDED