Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-16 09:44:12

0001 #ifndef BOOST_BIND_MAKE_ADAPTABLE_HPP_INCLUDED
0002 #define BOOST_BIND_MAKE_ADAPTABLE_HPP_INCLUDED
0003 
0004 //
0005 //  make_adaptable.hpp
0006 //
0007 //  Copyright (c) 2002 Peter Dimov and Multi Media Ltd.
0008 //
0009 // Distributed under the Boost Software License, Version 1.0. (See
0010 // accompanying file LICENSE_1_0.txt or copy at
0011 // http://www.boost.org/LICENSE_1_0.txt)
0012 //
0013 
0014 namespace boost
0015 {
0016 
0017 namespace _bi
0018 {
0019 
0020 template<class R, class F> class af0
0021 {
0022 public:
0023 
0024     typedef R result_type;
0025 
0026     explicit af0(F f): f_(f)
0027     {
0028     }
0029 
0030     result_type operator()()
0031     {
0032         return f_();
0033     }
0034 
0035     result_type operator()() const
0036     {
0037         return f_();
0038     }
0039 
0040 private:
0041 
0042     F f_;
0043 };
0044 
0045 template<class R, class A1, class F> class af1
0046 {
0047 public:
0048 
0049     typedef R result_type;
0050     typedef A1 argument_type;
0051     typedef A1 arg1_type;
0052 
0053     explicit af1(F f): f_(f)
0054     {
0055     }
0056 
0057     result_type operator()(A1 a1)
0058     {
0059         return f_(a1);
0060     }
0061 
0062     result_type operator()(A1 a1) const
0063     {
0064         return f_(a1);
0065     }
0066 
0067 private:
0068 
0069     F f_;
0070 };
0071 
0072 template<class R, class A1, class A2, class F> class af2
0073 {
0074 public:
0075 
0076     typedef R result_type;
0077     typedef A1 first_argument_type;
0078     typedef A2 second_argument_type;
0079     typedef A1 arg1_type;
0080     typedef A2 arg2_type;
0081 
0082     explicit af2(F f): f_(f)
0083     {
0084     }
0085 
0086     result_type operator()(A1 a1, A2 a2)
0087     {
0088         return f_(a1, a2);
0089     }
0090 
0091     result_type operator()(A1 a1, A2 a2) const
0092     {
0093         return f_(a1, a2);
0094     }
0095 
0096 private:
0097 
0098     F f_;
0099 };
0100 
0101 template<class R, class A1, class A2, class A3, class F> class af3
0102 {
0103 public:
0104 
0105     typedef R result_type;
0106     typedef A1 arg1_type;
0107     typedef A2 arg2_type;
0108     typedef A3 arg3_type;
0109 
0110     explicit af3(F f): f_(f)
0111     {
0112     }
0113 
0114     result_type operator()(A1 a1, A2 a2, A3 a3)
0115     {
0116         return f_(a1, a2, a3);
0117     }
0118 
0119     result_type operator()(A1 a1, A2 a2, A3 a3) const
0120     {
0121         return f_(a1, a2, a3);
0122     }
0123 
0124 private:
0125 
0126     F f_;
0127 };
0128 
0129 template<class R, class A1, class A2, class A3, class A4, class F> class af4
0130 {
0131 public:
0132 
0133     typedef R result_type;
0134     typedef A1 arg1_type;
0135     typedef A2 arg2_type;
0136     typedef A3 arg3_type;
0137     typedef A4 arg4_type;
0138 
0139     explicit af4(F f): f_(f)
0140     {
0141     }
0142 
0143     result_type operator()(A1 a1, A2 a2, A3 a3, A4 a4)
0144     {
0145         return f_(a1, a2, a3, a4);
0146     }
0147 
0148     result_type operator()(A1 a1, A2 a2, A3 a3, A4 a4) const
0149     {
0150         return f_(a1, a2, a3, a4);
0151     }
0152 
0153 private:
0154 
0155     F f_;
0156 };
0157 
0158 } // namespace _bi
0159 
0160 template<class R, class F> _bi::af0<R, F> make_adaptable(F f)
0161 {
0162     return _bi::af0<R, F>(f);
0163 }
0164 
0165 template<class R, class A1, class F> _bi::af1<R, A1, F> make_adaptable(F f)
0166 {
0167     return _bi::af1<R, A1, F>(f);
0168 }
0169 
0170 template<class R, class A1, class A2, class F> _bi::af2<R, A1, A2, F> make_adaptable(F f)
0171 {
0172     return _bi::af2<R, A1, A2, F>(f);
0173 }
0174 
0175 template<class R, class A1, class A2, class A3, class F> _bi::af3<R, A1, A2, A3, F> make_adaptable(F f)
0176 {
0177     return _bi::af3<R, A1, A2, A3, F>(f);
0178 }
0179 
0180 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)
0181 {
0182     return _bi::af4<R, A1, A2, A3, A4, F>(f);
0183 }
0184 
0185 } // namespace boost
0186 
0187 #endif // #ifndef BOOST_BIND_MAKE_ADAPTABLE_HPP_INCLUDED