File indexing completed on 2025-01-18 09:41:37
0001
0002 #if !defined(BOOST_PP_IS_ITERATING)
0003
0004
0005
0006 #ifndef BOOST_MPL_AUX_FULL_LAMBDA_HPP_INCLUDED
0007 #define BOOST_MPL_AUX_FULL_LAMBDA_HPP_INCLUDED
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021 #if !defined(BOOST_MPL_PREPROCESSING_MODE)
0022 # include <boost/mpl/lambda_fwd.hpp>
0023 # include <boost/mpl/bind_fwd.hpp>
0024 # include <boost/mpl/protect.hpp>
0025 # include <boost/mpl/quote.hpp>
0026 # include <boost/mpl/arg.hpp>
0027 # include <boost/mpl/bool.hpp>
0028 # include <boost/mpl/int_fwd.hpp>
0029 # include <boost/mpl/aux_/template_arity.hpp>
0030 # include <boost/mpl/aux_/na_spec.hpp>
0031 # include <boost/mpl/aux_/config/ttp.hpp>
0032 # if defined(BOOST_MPL_CFG_EXTENDED_TEMPLATE_PARAMETERS_MATCHING)
0033 # include <boost/mpl/if.hpp>
0034 # endif
0035 #endif
0036
0037 #include <boost/mpl/aux_/lambda_arity_param.hpp>
0038 #include <boost/mpl/aux_/config/use_preprocessed.hpp>
0039
0040 #if !defined(BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS) \
0041 && !defined(BOOST_MPL_PREPROCESSING_MODE)
0042
0043 # define BOOST_MPL_PREPROCESSED_HEADER full_lambda.hpp
0044 # include <boost/mpl/aux_/include_preprocessed.hpp>
0045
0046 #else
0047
0048 # include <boost/mpl/limits/arity.hpp>
0049 # include <boost/mpl/aux_/preprocessor/default_params.hpp>
0050 # include <boost/mpl/aux_/preprocessor/params.hpp>
0051 # include <boost/mpl/aux_/preprocessor/enum.hpp>
0052 # include <boost/mpl/aux_/preprocessor/repeat.hpp>
0053 # include <boost/mpl/aux_/config/dmc_ambiguous_ctps.hpp>
0054
0055 # include <boost/preprocessor/iterate.hpp>
0056 # include <boost/preprocessor/comma_if.hpp>
0057 # include <boost/preprocessor/inc.hpp>
0058 # include <boost/preprocessor/cat.hpp>
0059
0060 namespace boost { namespace mpl {
0061
0062
0063 # define AUX778076_LAMBDA_PARAMS(i_, param) \
0064 BOOST_MPL_PP_PARAMS(i_, param) \
0065
0066
0067 # define AUX778076_BIND_PARAMS(param) \
0068 BOOST_MPL_PP_PARAMS( \
0069 BOOST_MPL_LIMIT_METAFUNCTION_ARITY \
0070 , param \
0071 ) \
0072
0073
0074 # define AUX778076_BIND_N_PARAMS(i_, param) \
0075 BOOST_PP_COMMA_IF(i_) \
0076 BOOST_MPL_PP_PARAMS(i_, param) \
0077
0078
0079 # define AUX778076_ARITY_PARAM(param) \
0080 BOOST_MPL_AUX_LAMBDA_ARITY_PARAM(param) \
0081
0082
0083
0084 #define n_ BOOST_MPL_LIMIT_METAFUNCTION_ARITY
0085 namespace aux {
0086
0087 template<
0088 BOOST_MPL_PP_DEFAULT_PARAMS(n_,bool C,false)
0089 >
0090 struct lambda_or
0091 : true_
0092 {
0093 };
0094
0095 template<>
0096 struct lambda_or< BOOST_MPL_PP_ENUM(n_,false) >
0097 : false_
0098 {
0099 };
0100
0101 }
0102 #undef n_
0103
0104 template<
0105 typename T
0106 , typename Tag
0107 AUX778076_ARITY_PARAM(typename Arity)
0108 >
0109 struct lambda
0110 {
0111 typedef false_ is_le;
0112 typedef T result_;
0113 typedef T type;
0114 };
0115
0116 template<
0117 typename T
0118 >
0119 struct is_lambda_expression
0120 : lambda<T>::is_le
0121 {
0122 };
0123
0124
0125 template< int N, typename Tag >
0126 struct lambda< arg<N>,Tag AUX778076_ARITY_PARAM(int_<-1>) >
0127 {
0128 typedef true_ is_le;
0129 typedef mpl::arg<N> result_;
0130 typedef mpl::protect<result_> type;
0131 };
0132
0133
0134 #define BOOST_PP_ITERATION_PARAMS_1 \
0135 (3,(0, BOOST_MPL_LIMIT_METAFUNCTION_ARITY, <boost/mpl/aux_/full_lambda.hpp>))
0136 #include BOOST_PP_ITERATE()
0137
0138
0139 template< typename T, typename Tag >
0140 struct lambda< mpl::protect<T>,Tag AUX778076_ARITY_PARAM(int_<1>) >
0141 {
0142 typedef false_ is_le;
0143 typedef mpl::protect<T> result_;
0144 typedef result_ type;
0145 };
0146
0147
0148 template<
0149 typename F, AUX778076_BIND_PARAMS(typename T)
0150 , typename Tag
0151 >
0152 struct lambda<
0153 bind<F,AUX778076_BIND_PARAMS(T)>
0154 , Tag
0155 AUX778076_ARITY_PARAM(int_<BOOST_PP_INC(BOOST_MPL_LIMIT_METAFUNCTION_ARITY)>)
0156 >
0157 {
0158 typedef false_ is_le;
0159 typedef bind<F, AUX778076_BIND_PARAMS(T)> result_;
0160 typedef result_ type;
0161 };
0162
0163
0164 #if defined(BOOST_MPL_CFG_EXTENDED_TEMPLATE_PARAMETERS_MATCHING)
0165
0166 template<
0167 typename F
0168 , typename Tag1
0169 , typename Tag2
0170 , typename Arity
0171 >
0172 struct lambda<
0173 lambda<F,Tag1,Arity>
0174 , Tag2
0175 , int_<3>
0176 >
0177 {
0178 typedef lambda< F,Tag2 > l1;
0179 typedef lambda< Tag1,Tag2 > l2;
0180
0181 typedef typename l1::is_le is_le;
0182 typedef bind1< quote1<aux::template_arity>, typename l1::result_ > arity_;
0183 typedef lambda< typename if_<is_le,arity_,Arity>::type,Tag2 > l3;
0184
0185 typedef aux::le_result3<is_le, Tag2, mpl::lambda, l1, l2, l3> le_result_;
0186 typedef typename le_result_::result_ result_;
0187 typedef typename le_result_::type type;
0188 };
0189
0190 #elif !defined(BOOST_MPL_CFG_DMC_AMBIGUOUS_CTPS)
0191
0192
0193 template<
0194 typename F, typename Tag1, typename Tag2
0195 >
0196 struct lambda<
0197 lambda< F,Tag1 >
0198 , Tag2
0199 >
0200 {
0201 typedef lambda< F,Tag2 > l1;
0202 typedef lambda< Tag1,Tag2 > l2;
0203
0204 typedef typename l1::is_le is_le;
0205 typedef aux::le_result2<is_le, Tag2, mpl::lambda, l1, l2> le_result_;
0206 typedef typename le_result_::result_ result_;
0207 typedef typename le_result_::type type;
0208 };
0209
0210 #endif
0211
0212 # undef AUX778076_ARITY_PARAM
0213 # undef AUX778076_BIND_N_PARAMS
0214 # undef AUX778076_BIND_PARAMS
0215 # undef AUX778076_LAMBDA_PARAMS
0216
0217 #if !defined(BOOST_MPL_CFG_EXTENDED_TEMPLATE_PARAMETERS_MATCHING)
0218 BOOST_MPL_AUX_NA_SPEC(2, lambda)
0219 #else
0220 BOOST_MPL_AUX_NA_SPEC2(2, 3, lambda)
0221 #endif
0222
0223 }}
0224
0225 #endif
0226 #endif
0227
0228
0229
0230
0231
0232 #else
0233 #if BOOST_PP_ITERATION_DEPTH() == 1
0234 #define i_ BOOST_PP_FRAME_ITERATION(1)
0235
0236 #if i_ > 0
0237
0238 namespace aux {
0239
0240 # define AUX778076_RESULT(unused, i_, T) \
0241 BOOST_PP_COMMA_IF(i_) \
0242 typename BOOST_PP_CAT(T, BOOST_PP_INC(i_))::result_ \
0243
0244
0245 # define AUX778076_TYPE(unused, i_, T) \
0246 BOOST_PP_COMMA_IF(i_) \
0247 typename BOOST_PP_CAT(T, BOOST_PP_INC(i_))::type \
0248
0249
0250 template<
0251 typename IsLE, typename Tag
0252 , template< AUX778076_LAMBDA_PARAMS(i_, typename P) > class F
0253 , AUX778076_LAMBDA_PARAMS(i_, typename L)
0254 >
0255 struct BOOST_PP_CAT(le_result,i_)
0256 {
0257 typedef F<
0258 BOOST_MPL_PP_REPEAT(i_, AUX778076_TYPE, L)
0259 > result_;
0260
0261 typedef result_ type;
0262 };
0263
0264 template<
0265 typename Tag
0266 , template< AUX778076_LAMBDA_PARAMS(i_, typename P) > class F
0267 , AUX778076_LAMBDA_PARAMS(i_, typename L)
0268 >
0269 struct BOOST_PP_CAT(le_result,i_)< true_,Tag,F,AUX778076_LAMBDA_PARAMS(i_, L) >
0270 {
0271 typedef BOOST_PP_CAT(bind,i_)<
0272 BOOST_PP_CAT(quote,i_)<F,Tag>
0273 , BOOST_MPL_PP_REPEAT(i_, AUX778076_RESULT, L)
0274 > result_;
0275
0276 typedef mpl::protect<result_> type;
0277 };
0278
0279 # undef AUX778076_TYPE
0280 # undef AUX778076_RESULT
0281
0282 }
0283
0284
0285 # define AUX778076_LAMBDA_TYPEDEF(unused, i_, T) \
0286 typedef lambda< BOOST_PP_CAT(T, BOOST_PP_INC(i_)), Tag > \
0287 BOOST_PP_CAT(l,BOOST_PP_INC(i_)); \
0288
0289
0290 # define AUX778076_IS_LE_TYPEDEF(unused, i_, unused2) \
0291 typedef typename BOOST_PP_CAT(l,BOOST_PP_INC(i_))::is_le \
0292 BOOST_PP_CAT(is_le,BOOST_PP_INC(i_)); \
0293
0294
0295 # define AUX778076_IS_LAMBDA_EXPR(unused, i_, unused2) \
0296 BOOST_PP_COMMA_IF(i_) \
0297 BOOST_PP_CAT(is_le,BOOST_PP_INC(i_))::value \
0298
0299
0300 template<
0301 template< AUX778076_LAMBDA_PARAMS(i_, typename P) > class F
0302 , AUX778076_LAMBDA_PARAMS(i_, typename T)
0303 , typename Tag
0304 >
0305 struct lambda<
0306 F<AUX778076_LAMBDA_PARAMS(i_, T)>
0307 , Tag
0308 AUX778076_ARITY_PARAM(int_<i_>)
0309 >
0310 {
0311 BOOST_MPL_PP_REPEAT(i_, AUX778076_LAMBDA_TYPEDEF, T)
0312 BOOST_MPL_PP_REPEAT(i_, AUX778076_IS_LE_TYPEDEF, unused)
0313
0314 typedef typename aux::lambda_or<
0315 BOOST_MPL_PP_REPEAT(i_, AUX778076_IS_LAMBDA_EXPR, unused)
0316 >::type is_le;
0317
0318 typedef aux::BOOST_PP_CAT(le_result,i_)<
0319 is_le, Tag, F, AUX778076_LAMBDA_PARAMS(i_, l)
0320 > le_result_;
0321
0322 typedef typename le_result_::result_ result_;
0323 typedef typename le_result_::type type;
0324 };
0325
0326
0327 # undef AUX778076_IS_LAMBDA_EXPR
0328 # undef AUX778076_IS_LE_TYPEDEF
0329 # undef AUX778076_LAMBDA_TYPEDEF
0330
0331 #endif
0332
0333 template<
0334 typename F AUX778076_BIND_N_PARAMS(i_, typename T)
0335 , typename Tag
0336 >
0337 struct lambda<
0338 BOOST_PP_CAT(bind,i_)<F AUX778076_BIND_N_PARAMS(i_, T)>
0339 , Tag
0340 AUX778076_ARITY_PARAM(int_<BOOST_PP_INC(i_)>)
0341 >
0342 {
0343 typedef false_ is_le;
0344 typedef BOOST_PP_CAT(bind,i_)<
0345 F
0346 AUX778076_BIND_N_PARAMS(i_, T)
0347 > result_;
0348
0349 typedef result_ type;
0350 };
0351
0352 #undef i_
0353 #endif
0354 #endif