File indexing completed on 2025-01-18 09:41:39
0001
0002 #if !defined(BOOST_PP_IS_ITERATING)
0003
0004
0005
0006 #ifndef BOOST_MPL_AUX_TEMPLATE_ARITY_HPP_INCLUDED
0007 #define BOOST_MPL_AUX_TEMPLATE_ARITY_HPP_INCLUDED
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021 #include <boost/mpl/aux_/config/ttp.hpp>
0022 #include <boost/mpl/aux_/config/lambda.hpp>
0023
0024 #if !defined(BOOST_MPL_PREPROCESSING_MODE)
0025 # include <boost/mpl/aux_/template_arity_fwd.hpp>
0026 # include <boost/mpl/int.hpp>
0027 # if !defined(BOOST_MPL_CFG_NO_FULL_LAMBDA_SUPPORT)
0028 # if defined(BOOST_MPL_CFG_EXTENDED_TEMPLATE_PARAMETERS_MATCHING)
0029 # include <boost/mpl/aux_/type_wrapper.hpp>
0030 # endif
0031 # else
0032 # include <boost/mpl/aux_/has_rebind.hpp>
0033 # endif
0034 #endif
0035
0036 #include <boost/mpl/aux_/config/static_constant.hpp>
0037 #include <boost/mpl/aux_/config/use_preprocessed.hpp>
0038
0039 #if !defined(BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS) \
0040 && !defined(BOOST_MPL_PREPROCESSING_MODE)
0041
0042 # define BOOST_MPL_PREPROCESSED_HEADER template_arity.hpp
0043 # include <boost/mpl/aux_/include_preprocessed.hpp>
0044
0045 #else
0046
0047 # if !defined(BOOST_MPL_CFG_NO_FULL_LAMBDA_SUPPORT)
0048 # if defined(BOOST_MPL_CFG_EXTENDED_TEMPLATE_PARAMETERS_MATCHING)
0049
0050 # include <boost/mpl/limits/arity.hpp>
0051 # include <boost/mpl/aux_/preprocessor/range.hpp>
0052 # include <boost/mpl/aux_/preprocessor/repeat.hpp>
0053 # include <boost/mpl/aux_/preprocessor/params.hpp>
0054 # include <boost/mpl/aux_/nttp_decl.hpp>
0055
0056 # include <boost/preprocessor/seq/fold_left.hpp>
0057 # include <boost/preprocessor/comma_if.hpp>
0058 # include <boost/preprocessor/iterate.hpp>
0059 # include <boost/preprocessor/inc.hpp>
0060 # include <boost/preprocessor/cat.hpp>
0061
0062 # define AUX778076_ARITY BOOST_PP_INC(BOOST_MPL_LIMIT_METAFUNCTION_ARITY)
0063
0064 namespace boost { namespace mpl { namespace aux {
0065
0066 template< BOOST_MPL_AUX_NTTP_DECL(int, N) > struct arity_tag
0067 {
0068 typedef char (&type)[(unsigned)N + 1];
0069 };
0070
0071 # define AUX778076_MAX_ARITY_OP(unused, state, i_) \
0072 ( BOOST_PP_CAT(C,i_) > 0 ? BOOST_PP_CAT(C,i_) : state ) \
0073
0074
0075 template<
0076 BOOST_MPL_PP_PARAMS(AUX778076_ARITY, BOOST_MPL_AUX_NTTP_DECL(int, C))
0077 >
0078 struct max_arity
0079 {
0080 BOOST_STATIC_CONSTANT(int, value =
0081 BOOST_PP_SEQ_FOLD_LEFT(
0082 AUX778076_MAX_ARITY_OP
0083 , -1
0084 , BOOST_MPL_PP_RANGE(1, AUX778076_ARITY)
0085 )
0086 );
0087 };
0088
0089 # undef AUX778076_MAX_ARITY_OP
0090
0091 arity_tag<0>::type arity_helper(...);
0092
0093 # define BOOST_PP_ITERATION_LIMITS (1, AUX778076_ARITY)
0094 # define BOOST_PP_FILENAME_1 <boost/mpl/aux_/template_arity.hpp>
0095 # include BOOST_PP_ITERATE()
0096
0097 template< typename F, BOOST_MPL_AUX_NTTP_DECL(int, N) >
0098 struct template_arity_impl
0099 {
0100 BOOST_STATIC_CONSTANT(int, value =
0101 sizeof(::boost::mpl::aux::arity_helper(type_wrapper<F>(),arity_tag<N>())) - 1
0102 );
0103 };
0104
0105 # define AUX778076_TEMPLATE_ARITY_IMPL_INVOCATION(unused, i_, F) \
0106 BOOST_PP_COMMA_IF(i_) template_arity_impl<F,BOOST_PP_INC(i_)>::value \
0107
0108
0109 template< typename F >
0110 struct template_arity
0111 {
0112 BOOST_STATIC_CONSTANT(int, value = (
0113 max_arity< BOOST_MPL_PP_REPEAT(
0114 AUX778076_ARITY
0115 , AUX778076_TEMPLATE_ARITY_IMPL_INVOCATION
0116 , F
0117 ) >::value
0118 ));
0119
0120 typedef mpl::int_<value> type;
0121 };
0122
0123 # undef AUX778076_TEMPLATE_ARITY_IMPL_INVOCATION
0124
0125 # undef AUX778076_ARITY
0126
0127 }}}
0128
0129 # endif
0130 # else
0131
0132 # include <boost/mpl/aux_/config/eti.hpp>
0133
0134 namespace boost { namespace mpl { namespace aux {
0135
0136 template< bool >
0137 struct template_arity_impl
0138 {
0139 template< typename F > struct result_
0140 : mpl::int_<-1>
0141 {
0142 };
0143 };
0144
0145 template<>
0146 struct template_arity_impl<true>
0147 {
0148 template< typename F > struct result_
0149 : F::arity
0150 {
0151 };
0152 };
0153
0154 template< typename F >
0155 struct template_arity
0156 : template_arity_impl< ::boost::mpl::aux::has_rebind<F>::value >
0157 ::template result_<F>
0158 {
0159 };
0160
0161 #if defined(BOOST_MPL_CFG_MSVC_ETI_BUG)
0162 template<>
0163 struct template_arity<int>
0164 : mpl::int_<-1>
0165 {
0166 };
0167 #endif
0168
0169 }}}
0170
0171 # endif
0172
0173 #endif
0174 #endif
0175
0176
0177
0178 #else
0179 #define i_ BOOST_PP_FRAME_ITERATION(1)
0180
0181 template<
0182 template< BOOST_MPL_PP_PARAMS(i_, typename P) > class F
0183 , BOOST_MPL_PP_PARAMS(i_, typename T)
0184 >
0185 typename arity_tag<i_>::type
0186 arity_helper(type_wrapper< F<BOOST_MPL_PP_PARAMS(i_, T)> >, arity_tag<i_>);
0187
0188 #undef i_
0189 #endif