Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-16 10:10:24

0001 
0002 //  Copyright 2000 John Maddock (john@johnmaddock.co.uk)
0003 //  Use, modification and distribution are subject to the Boost Software License,
0004 //  Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
0005 //  http://www.boost.org/LICENSE_1_0.txt).
0006 //
0007 //  See http://www.boost.org/libs/type_traits for most recent version including documentation.
0008 
0009 #ifndef BOOST_TT_FUNCTION_TRAITS_HPP_INCLUDED
0010 #define BOOST_TT_FUNCTION_TRAITS_HPP_INCLUDED
0011 
0012 #include <boost/config.hpp>
0013 #include <boost/type_traits/is_function.hpp>
0014 #include <boost/type_traits/add_pointer.hpp>
0015 
0016 namespace boost {
0017 
0018 namespace detail {
0019 
0020 template<typename Function> struct function_traits_helper;
0021 
0022 template<typename R>
0023 struct function_traits_helper<R (*)(void)>
0024 {
0025   BOOST_STATIC_CONSTANT(unsigned, arity = 0);
0026   typedef R result_type;
0027 };
0028 
0029 template<typename R, typename T1>
0030 struct function_traits_helper<R (*)(T1)>
0031 {
0032   BOOST_STATIC_CONSTANT(unsigned, arity = 1);
0033   typedef R result_type;
0034   typedef T1 arg1_type;
0035   typedef T1 argument_type;
0036 };
0037 
0038 template<typename R, typename T1, typename T2>
0039 struct function_traits_helper<R (*)(T1, T2)>
0040 {
0041   BOOST_STATIC_CONSTANT(unsigned, arity = 2);
0042   typedef R result_type;
0043   typedef T1 arg1_type;
0044   typedef T2 arg2_type;
0045   typedef T1 first_argument_type;
0046   typedef T2 second_argument_type;
0047 };
0048 
0049 template<typename R, typename T1, typename T2, typename T3>
0050 struct function_traits_helper<R (*)(T1, T2, T3)>
0051 {
0052   BOOST_STATIC_CONSTANT(unsigned, arity = 3);
0053   typedef R result_type;
0054   typedef T1 arg1_type;
0055   typedef T2 arg2_type;
0056   typedef T3 arg3_type;
0057 };
0058 
0059 template<typename R, typename T1, typename T2, typename T3, typename T4>
0060 struct function_traits_helper<R (*)(T1, T2, T3, T4)>
0061 {
0062   BOOST_STATIC_CONSTANT(unsigned, arity = 4);
0063   typedef R result_type;
0064   typedef T1 arg1_type;
0065   typedef T2 arg2_type;
0066   typedef T3 arg3_type;
0067   typedef T4 arg4_type;
0068 };
0069 
0070 template<typename R, typename T1, typename T2, typename T3, typename T4,
0071          typename T5>
0072 struct function_traits_helper<R (*)(T1, T2, T3, T4, T5)>
0073 {
0074   BOOST_STATIC_CONSTANT(unsigned, arity = 5);
0075   typedef R result_type;
0076   typedef T1 arg1_type;
0077   typedef T2 arg2_type;
0078   typedef T3 arg3_type;
0079   typedef T4 arg4_type;
0080   typedef T5 arg5_type;
0081 };
0082 
0083 template<typename R, typename T1, typename T2, typename T3, typename T4,
0084          typename T5, typename T6>
0085 struct function_traits_helper<R (*)(T1, T2, T3, T4, T5, T6)>
0086 {
0087   BOOST_STATIC_CONSTANT(unsigned, arity = 6);
0088   typedef R result_type;
0089   typedef T1 arg1_type;
0090   typedef T2 arg2_type;
0091   typedef T3 arg3_type;
0092   typedef T4 arg4_type;
0093   typedef T5 arg5_type;
0094   typedef T6 arg6_type;
0095 };
0096 
0097 template<typename R, typename T1, typename T2, typename T3, typename T4,
0098          typename T5, typename T6, typename T7>
0099 struct function_traits_helper<R (*)(T1, T2, T3, T4, T5, T6, T7)>
0100 {
0101   BOOST_STATIC_CONSTANT(unsigned, arity = 7);
0102   typedef R result_type;
0103   typedef T1 arg1_type;
0104   typedef T2 arg2_type;
0105   typedef T3 arg3_type;
0106   typedef T4 arg4_type;
0107   typedef T5 arg5_type;
0108   typedef T6 arg6_type;
0109   typedef T7 arg7_type;
0110 };
0111 
0112 template<typename R, typename T1, typename T2, typename T3, typename T4,
0113          typename T5, typename T6, typename T7, typename T8>
0114 struct function_traits_helper<R (*)(T1, T2, T3, T4, T5, T6, T7, T8)>
0115 {
0116   BOOST_STATIC_CONSTANT(unsigned, arity = 8);
0117   typedef R result_type;
0118   typedef T1 arg1_type;
0119   typedef T2 arg2_type;
0120   typedef T3 arg3_type;
0121   typedef T4 arg4_type;
0122   typedef T5 arg5_type;
0123   typedef T6 arg6_type;
0124   typedef T7 arg7_type;
0125   typedef T8 arg8_type;
0126 };
0127 
0128 template<typename R, typename T1, typename T2, typename T3, typename T4,
0129          typename T5, typename T6, typename T7, typename T8, typename T9>
0130 struct function_traits_helper<R (*)(T1, T2, T3, T4, T5, T6, T7, T8, T9)>
0131 {
0132   BOOST_STATIC_CONSTANT(unsigned, arity = 9);
0133   typedef R result_type;
0134   typedef T1 arg1_type;
0135   typedef T2 arg2_type;
0136   typedef T3 arg3_type;
0137   typedef T4 arg4_type;
0138   typedef T5 arg5_type;
0139   typedef T6 arg6_type;
0140   typedef T7 arg7_type;
0141   typedef T8 arg8_type;
0142   typedef T9 arg9_type;
0143 };
0144 
0145 template<typename R, typename T1, typename T2, typename T3, typename T4,
0146          typename T5, typename T6, typename T7, typename T8, typename T9,
0147          typename T10>
0148 struct function_traits_helper<R (*)(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10)>
0149 {
0150   BOOST_STATIC_CONSTANT(unsigned, arity = 10);
0151   typedef R result_type;
0152   typedef T1 arg1_type;
0153   typedef T2 arg2_type;
0154   typedef T3 arg3_type;
0155   typedef T4 arg4_type;
0156   typedef T5 arg5_type;
0157   typedef T6 arg6_type;
0158   typedef T7 arg7_type;
0159   typedef T8 arg8_type;
0160   typedef T9 arg9_type;
0161   typedef T10 arg10_type;
0162 };
0163 
0164 } // end namespace detail
0165 
0166 template<typename Function>
0167 struct function_traits : 
0168   public boost::detail::function_traits_helper<typename boost::add_pointer<Function>::type>
0169 {
0170 };
0171 
0172 }
0173 
0174 #endif // BOOST_TT_FUNCTION_TRAITS_HPP_INCLUDED