File indexing completed on 2025-01-18 09:43:27
0001
0002
0003
0004
0005
0006
0007 #ifndef BOOST_PARAMETER_AUX_PREPROCESSOR_IMPL_FUNCTION_DISPATCH_LAYER_HPP
0008 #define BOOST_PARAMETER_AUX_PREPROCESSOR_IMPL_FUNCTION_DISPATCH_LAYER_HPP
0009
0010 #include <boost/preprocessor/cat.hpp>
0011
0012
0013 #define BOOST_PARAMETER_FUNCTION_DISPATCH_ARG_TYPE(keyword_tag) \
0014 BOOST_PP_CAT(keyword_tag, _type)
0015
0016
0017
0018 #define BOOST_PARAMETER_FUNCTION_DISPATCH_TEMPLATE_ARG(r, macro, arg) \
0019 , typename BOOST_PARAMETER_FUNCTION_DISPATCH_ARG_TYPE(macro(arg))
0020
0021
0022 #include <boost/parameter/config.hpp>
0023
0024 #if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
0025
0026
0027 #define BOOST_PARAMETER_FUNCTION_DISPATCH_ARG_DEFN(r, macro, arg) \
0028 , BOOST_PARAMETER_FUNCTION_DISPATCH_ARG_TYPE(macro(arg))&& macro(arg)
0029
0030
0031 #include <utility>
0032
0033
0034 #define BOOST_PARAMETER_FUNCTION_DISPATCH_ARG_FWD(r, macro, arg) \
0035 , ::std::forward< \
0036 BOOST_PARAMETER_FUNCTION_DISPATCH_ARG_TYPE(macro(arg)) \
0037 >(macro(arg))
0038
0039
0040 #else
0041
0042
0043
0044 #define BOOST_PARAMETER_FUNCTION_DISPATCH_ARG_DEFN(r, macro, arg) \
0045 , BOOST_PARAMETER_FUNCTION_DISPATCH_ARG_TYPE(macro(arg))& macro(arg)
0046
0047
0048 #include <boost/parameter/aux_/as_lvalue.hpp>
0049
0050
0051
0052 #define BOOST_PARAMETER_FUNCTION_DISPATCH_ARG_FWD(r, macro, arg) \
0053 , ::boost::parameter::aux::as_lvalue(macro(arg))
0054
0055
0056 #endif
0057
0058 #include <boost/parameter/aux_/preprocessor/impl/argument_specs.hpp>
0059 #include <boost/parameter/aux_/preprocessor/impl/split_args.hpp>
0060 #include <boost/preprocessor/seq/for_each.hpp>
0061 #include <boost/preprocessor/seq/first_n.hpp>
0062
0063
0064
0065 #define BOOST_PARAMETER_FUNCTION_DISPATCH_ARG_REPEAT(macro, n, split_args) \
0066 BOOST_PP_SEQ_FOR_EACH( \
0067 macro \
0068 , BOOST_PARAMETER_FN_ARG_NAME \
0069 , BOOST_PARAMETER_SPLIT_ARG_REQ_SEQ(split_args) \
0070 ) \
0071 BOOST_PP_SEQ_FOR_EACH( \
0072 macro \
0073 , BOOST_PARAMETER_FN_ARG_NAME \
0074 , BOOST_PP_SEQ_FIRST_N( \
0075 n, BOOST_PARAMETER_SPLIT_ARG_OPT_SEQ(split_args) \
0076 ) \
0077 )
0078
0079
0080 #include <boost/parameter/aux_/preprocessor/impl/function_dispatch_tuple.hpp>
0081 #include <boost/parameter/aux_/preprocessor/impl/function_name.hpp>
0082 #include <boost/preprocessor/control/if.hpp>
0083
0084
0085 #define BOOST_PARAMETER_FUNCTION_DISPATCH_NAME(x, n) \
0086 BOOST_PP_CAT( \
0087 BOOST_PP_CAT( \
0088 BOOST_PP_IF( \
0089 BOOST_PARAMETER_FUNCTION_DISPATCH_IS_CONST(x) \
0090 , boost_param_dispatch_const_ \
0091 , boost_param_dispatch_ \
0092 ) \
0093 , BOOST_PP_CAT(BOOST_PP_CAT(n, boost_), __LINE__) \
0094 ) \
0095 , BOOST_PARAMETER_MEMBER_FUNCTION_NAME( \
0096 BOOST_PARAMETER_FUNCTION_DISPATCH_BASE_NAME(x) \
0097 ) \
0098 )
0099
0100
0101
0102
0103
0104 #define BOOST_PARAMETER_FUNCTION_DISPATCH_HEAD_TPL(n, x) \
0105 template < \
0106 typename ResultType, typename Args \
0107 BOOST_PARAMETER_FUNCTION_DISPATCH_ARG_REPEAT( \
0108 BOOST_PARAMETER_FUNCTION_DISPATCH_TEMPLATE_ARG \
0109 , n \
0110 , BOOST_PARAMETER_FUNCTION_DISPATCH_SPLIT_ARGS(x) \
0111 ) \
0112 > BOOST_PARAMETER_MEMBER_FUNCTION_STATIC( \
0113 BOOST_PARAMETER_FUNCTION_DISPATCH_BASE_NAME(x) \
0114 )
0115
0116
0117 #include <boost/parameter/aux_/use_default_tag.hpp>
0118 #include <boost/preprocessor/control/expr_if.hpp>
0119 #include <boost/preprocessor/punctuation/comma_if.hpp>
0120
0121
0122
0123
0124
0125 #define BOOST_PARAMETER_FUNCTION_DISPATCH_HEAD_PRN(n, x, b1, b2) \
0126 ResultType BOOST_PARAMETER_FUNCTION_DISPATCH_NAME(x, b1)( \
0127 ResultType(*)(), Args const& args, long \
0128 BOOST_PARAMETER_FUNCTION_DISPATCH_ARG_REPEAT( \
0129 BOOST_PARAMETER_FUNCTION_DISPATCH_ARG_DEFN \
0130 , n \
0131 , BOOST_PARAMETER_FUNCTION_DISPATCH_SPLIT_ARGS(x) \
0132 ) \
0133 BOOST_PP_COMMA_IF(b2) \
0134 BOOST_PP_EXPR_IF(b2, ::boost::parameter::aux::use_default_tag) \
0135 ) BOOST_PP_EXPR_IF(BOOST_PARAMETER_FUNCTION_DISPATCH_IS_CONST(x), const)
0136
0137
0138
0139
0140
0141 #define BOOST_PARAMETER_FUNCTION_DISPATCH_FWD_DECL_0_Z(z, n, x) \
0142 BOOST_PARAMETER_FUNCTION_DISPATCH_HEAD_TPL(n, x) \
0143 BOOST_PARAMETER_FUNCTION_DISPATCH_HEAD_PRN(n, x, 0, 0);
0144
0145
0146
0147
0148
0149 #define BOOST_PARAMETER_FUNCTION_DISPATCH_FWD_DECL_1_Z(z, n, x) \
0150 BOOST_PARAMETER_FUNCTION_DISPATCH_HEAD_TPL(n, x) \
0151 BOOST_PARAMETER_FUNCTION_DISPATCH_HEAD_PRN(n, x, 0, 1);
0152
0153
0154 #include <boost/preprocessor/seq/elem.hpp>
0155
0156
0157 #define BOOST_PARAMETER_FUNCTION_DISPATCH_DEFAULT_AUX(n, s_args) \
0158 BOOST_PARAMETER_FN_ARG_DEFAULT( \
0159 BOOST_PP_SEQ_ELEM(n, BOOST_PARAMETER_SPLIT_ARG_OPT_SEQ(s_args)) \
0160 )
0161
0162
0163 #include <boost/parameter/keyword.hpp>
0164
0165
0166
0167
0168 #define BOOST_PARAMETER_FUNCTION_DISPATCH_DEFAULT(n, s_args, tag_ns) \
0169 ::boost::parameter::keyword< \
0170 tag_ns::BOOST_PARAMETER_FN_ARG_NAME( \
0171 BOOST_PP_SEQ_ELEM(n, BOOST_PARAMETER_SPLIT_ARG_OPT_SEQ(s_args)) \
0172 ) \
0173 >::instance = BOOST_PARAMETER_FUNCTION_DISPATCH_DEFAULT_AUX(n, s_args)
0174
0175
0176 #include <boost/parameter/aux_/preprocessor/impl/function_cast.hpp>
0177
0178
0179
0180
0181
0182 #if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
0183
0184
0185
0186 #define BOOST_PARAMETER_FUNCTION_DISPATCH_ARG_CAST_R(r, tag_ns, arg) \
0187 , ::boost::parameter::aux::forward< \
0188 BOOST_PARAMETER_FUNCTION_CAST_T( \
0189 tag_ns::BOOST_PARAMETER_FN_ARG_NAME(arg) \
0190 , BOOST_PARAMETER_FN_ARG_PRED(arg) \
0191 , Args \
0192 ) \
0193 , BOOST_PARAMETER_FUNCTION_CAST_B( \
0194 tag_ns::BOOST_PARAMETER_FN_ARG_NAME(arg) \
0195 , BOOST_PARAMETER_FN_ARG_PRED(arg) \
0196 , Args \
0197 ) \
0198 >( \
0199 args[ \
0200 ::boost::parameter::keyword< \
0201 tag_ns::BOOST_PARAMETER_FN_ARG_NAME(arg) \
0202 >::instance \
0203 ] \
0204 )
0205
0206 #else
0207
0208
0209
0210 #define BOOST_PARAMETER_FUNCTION_DISPATCH_ARG_CAST_R(r, tag_ns, arg) \
0211 , BOOST_PARAMETER_FUNCTION_CAST_T( \
0212 tag_ns::BOOST_PARAMETER_FN_ARG_NAME(arg) \
0213 , BOOST_PARAMETER_FN_ARG_PRED(arg) \
0214 , Args \
0215 )( \
0216 args[ \
0217 ::boost::parameter::keyword< \
0218 tag_ns::BOOST_PARAMETER_FN_ARG_NAME(arg) \
0219 >::instance \
0220 ] \
0221 )
0222
0223 #endif
0224
0225
0226
0227
0228 #if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
0229
0230
0231
0232 #define BOOST_PARAMETER_FUNCTION_DISPATCH_OPT_ARG_CAST(arg, tag_ns) \
0233 ::boost::parameter::aux::forward< \
0234 BOOST_PARAMETER_FUNCTION_CAST_T( \
0235 tag_ns::BOOST_PARAMETER_FN_ARG_NAME(arg) \
0236 , BOOST_PARAMETER_FN_ARG_PRED(arg) \
0237 , Args \
0238 ) \
0239 , BOOST_PARAMETER_FUNCTION_CAST_B( \
0240 tag_ns::BOOST_PARAMETER_FN_ARG_NAME(arg) \
0241 , BOOST_PARAMETER_FN_ARG_PRED(arg) \
0242 , Args \
0243 ) \
0244 >( \
0245 args[ \
0246 ::boost::parameter::keyword< \
0247 tag_ns::BOOST_PARAMETER_FN_ARG_NAME(arg) \
0248 >::instance || ::boost::parameter::aux::use_default_tag() \
0249 ] \
0250 )
0251
0252 #else
0253 #define BOOST_PARAMETER_FUNCTION_DISPATCH_OPT_ARG_CAST(arg, tag_ns) \
0254 BOOST_PARAMETER_FUNCTION_CAST_B( \
0255 args[ \
0256 ::boost::parameter::keyword< \
0257 tag_ns::BOOST_PARAMETER_FN_ARG_NAME(arg) \
0258 >::instance || ::boost::parameter::aux::use_default_tag() \
0259 ] \
0260 , BOOST_PARAMETER_FN_ARG_PRED(arg) \
0261 , Args \
0262 )
0263
0264 #endif
0265
0266 #include <boost/parameter/aux_/preprocessor/nullptr.hpp>
0267
0268
0269
0270
0271
0272
0273
0274
0275
0276
0277
0278
0279
0280
0281
0282
0283
0284
0285
0286
0287
0288
0289
0290
0291
0292
0293
0294
0295
0296
0297
0298 #define BOOST_PARAMETER_FUNCTION_DISPATCH_OVERLOAD_Z(z, n, x) \
0299 BOOST_PARAMETER_FUNCTION_DISPATCH_HEAD_TPL(n, x) \
0300 inline BOOST_PARAMETER_FUNCTION_DISPATCH_HEAD_PRN(n, x, 0, 0) \
0301 { \
0302 return BOOST_PP_EXPR_IF( \
0303 BOOST_PARAMETER_FUNCTION_DISPATCH_IS_MEMBER(x) \
0304 , this-> \
0305 ) BOOST_PARAMETER_FUNCTION_DISPATCH_NAME(x, 0)( \
0306 static_cast<ResultType(*)()>(BOOST_PARAMETER_AUX_PP_NULLPTR) \
0307 , args \
0308 , 0L \
0309 BOOST_PARAMETER_FUNCTION_DISPATCH_ARG_REPEAT( \
0310 BOOST_PARAMETER_FUNCTION_DISPATCH_ARG_FWD \
0311 , n \
0312 , BOOST_PARAMETER_FUNCTION_DISPATCH_SPLIT_ARGS(x) \
0313 ) \
0314 , BOOST_PARAMETER_FUNCTION_DISPATCH_OPT_ARG_CAST( \
0315 BOOST_PP_SEQ_ELEM( \
0316 n \
0317 , BOOST_PARAMETER_SPLIT_ARG_OPT_SEQ( \
0318 BOOST_PARAMETER_FUNCTION_DISPATCH_SPLIT_ARGS(x) \
0319 ) \
0320 ) \
0321 , BOOST_PARAMETER_FUNCTION_DISPATCH_TAG_NAMESPACE(x) \
0322 ) \
0323 ); \
0324 } \
0325 BOOST_PARAMETER_FUNCTION_DISPATCH_HEAD_TPL(n, x) \
0326 inline BOOST_PARAMETER_FUNCTION_DISPATCH_HEAD_PRN(n, x, 1, 0) \
0327 { \
0328 return BOOST_PP_EXPR_IF( \
0329 BOOST_PARAMETER_FUNCTION_DISPATCH_IS_MEMBER(x) \
0330 , this-> \
0331 ) BOOST_PARAMETER_FUNCTION_DISPATCH_NAME(x, 0)( \
0332 static_cast<ResultType(*)()>(BOOST_PARAMETER_AUX_PP_NULLPTR) \
0333 , args \
0334 , 0L \
0335 BOOST_PARAMETER_FUNCTION_DISPATCH_ARG_REPEAT( \
0336 BOOST_PARAMETER_FUNCTION_DISPATCH_ARG_FWD \
0337 , n \
0338 , BOOST_PARAMETER_FUNCTION_DISPATCH_SPLIT_ARGS(x) \
0339 ) \
0340 , args[ \
0341 ::boost::parameter::keyword< \
0342 BOOST_PARAMETER_FUNCTION_DISPATCH_TAG_NAMESPACE(x):: \
0343 BOOST_PARAMETER_FN_ARG_NAME( \
0344 BOOST_PP_SEQ_ELEM( \
0345 n \
0346 , BOOST_PARAMETER_SPLIT_ARG_OPT_SEQ( \
0347 BOOST_PARAMETER_FUNCTION_DISPATCH_SPLIT_ARGS(x) \
0348 ) \
0349 ) \
0350 ) \
0351 >::instance \
0352 ] \
0353 ); \
0354 } \
0355 BOOST_PARAMETER_FUNCTION_DISPATCH_HEAD_TPL(n, x) \
0356 inline BOOST_PARAMETER_FUNCTION_DISPATCH_HEAD_PRN(n, x, 0, 1) \
0357 { \
0358 return BOOST_PP_EXPR_IF( \
0359 BOOST_PARAMETER_FUNCTION_DISPATCH_IS_MEMBER(x) \
0360 , this-> \
0361 ) BOOST_PARAMETER_FUNCTION_DISPATCH_NAME(x, 1)( \
0362 static_cast<ResultType(*)()>(BOOST_PARAMETER_AUX_PP_NULLPTR) \
0363 , (args \
0364 , BOOST_PARAMETER_FUNCTION_DISPATCH_DEFAULT( \
0365 n \
0366 , BOOST_PARAMETER_FUNCTION_DISPATCH_SPLIT_ARGS(x) \
0367 , BOOST_PARAMETER_FUNCTION_DISPATCH_TAG_NAMESPACE(x) \
0368 ) \
0369 ) \
0370 , 0L \
0371 BOOST_PARAMETER_FUNCTION_DISPATCH_ARG_REPEAT( \
0372 BOOST_PARAMETER_FUNCTION_DISPATCH_ARG_FWD \
0373 , n \
0374 , BOOST_PARAMETER_FUNCTION_DISPATCH_SPLIT_ARGS(x) \
0375 ) \
0376 ); \
0377 }
0378
0379
0380 #include <boost/preprocessor/arithmetic/inc.hpp>
0381 #include <boost/preprocessor/control/if.hpp>
0382 #include <boost/preprocessor/repetition/repeat_from_to.hpp>
0383 #include <boost/preprocessor/tuple/eat.hpp>
0384
0385
0386
0387
0388
0389
0390
0391
0392
0393
0394
0395
0396
0397
0398 #define BOOST_PARAMETER_FUNCTION_DISPATCH_LAYER(fwd_decl, x) \
0399 BOOST_PP_IF(fwd_decl, BOOST_PP_REPEAT_FROM_TO, BOOST_PP_TUPLE_EAT(4))( \
0400 0 \
0401 , BOOST_PP_INC( \
0402 BOOST_PARAMETER_SPLIT_ARG_OPT_COUNT( \
0403 BOOST_PARAMETER_FUNCTION_DISPATCH_SPLIT_ARGS(x) \
0404 ) \
0405 ) \
0406 , BOOST_PARAMETER_FUNCTION_DISPATCH_FWD_DECL_0_Z \
0407 , x \
0408 ) \
0409 BOOST_PP_IF(fwd_decl, BOOST_PP_REPEAT_FROM_TO, BOOST_PP_TUPLE_EAT(4))( \
0410 0 \
0411 , BOOST_PARAMETER_SPLIT_ARG_OPT_COUNT( \
0412 BOOST_PARAMETER_FUNCTION_DISPATCH_SPLIT_ARGS(x) \
0413 ) \
0414 , BOOST_PARAMETER_FUNCTION_DISPATCH_FWD_DECL_1_Z \
0415 , x \
0416 ) \
0417 template <typename Args> BOOST_PARAMETER_MEMBER_FUNCTION_STATIC( \
0418 BOOST_PARAMETER_FUNCTION_DISPATCH_BASE_NAME(x) \
0419 ) inline typename BOOST_PARAMETER_FUNCTION_RESULT_NAME( \
0420 BOOST_PARAMETER_FUNCTION_DISPATCH_BASE_NAME(x) \
0421 , BOOST_PARAMETER_FUNCTION_DISPATCH_IS_CONST(x) \
0422 )<Args>::type BOOST_PARAMETER_FUNCTION_IMPL_NAME( \
0423 BOOST_PARAMETER_FUNCTION_DISPATCH_BASE_NAME(x) \
0424 , BOOST_PARAMETER_FUNCTION_DISPATCH_IS_CONST(x) \
0425 )(Args const& args) \
0426 BOOST_PP_EXPR_IF(BOOST_PARAMETER_FUNCTION_DISPATCH_IS_CONST(x), const) \
0427 { \
0428 return BOOST_PP_EXPR_IF( \
0429 BOOST_PARAMETER_FUNCTION_DISPATCH_IS_MEMBER(x) \
0430 , this-> \
0431 ) BOOST_PARAMETER_FUNCTION_DISPATCH_NAME(x, 0)( \
0432 static_cast< \
0433 typename BOOST_PARAMETER_FUNCTION_RESULT_NAME( \
0434 BOOST_PARAMETER_FUNCTION_DISPATCH_BASE_NAME(x) \
0435 , BOOST_PARAMETER_FUNCTION_DISPATCH_IS_CONST(x) \
0436 )<Args>::type(*)() \
0437 >(BOOST_PARAMETER_AUX_PP_NULLPTR) \
0438 , args \
0439 , 0L \
0440 BOOST_PP_SEQ_FOR_EACH( \
0441 BOOST_PARAMETER_FUNCTION_DISPATCH_ARG_CAST_R \
0442 , BOOST_PARAMETER_FUNCTION_DISPATCH_TAG_NAMESPACE(x) \
0443 , BOOST_PARAMETER_SPLIT_ARG_REQ_SEQ( \
0444 BOOST_PARAMETER_FUNCTION_DISPATCH_SPLIT_ARGS(x) \
0445 ) \
0446 ) \
0447 ); \
0448 } \
0449 BOOST_PP_REPEAT_FROM_TO( \
0450 0 \
0451 , BOOST_PARAMETER_SPLIT_ARG_OPT_COUNT( \
0452 BOOST_PARAMETER_FUNCTION_DISPATCH_SPLIT_ARGS(x) \
0453 ) \
0454 , BOOST_PARAMETER_FUNCTION_DISPATCH_OVERLOAD_Z \
0455 , x \
0456 ) \
0457 BOOST_PARAMETER_FUNCTION_DISPATCH_HEAD_TPL( \
0458 BOOST_PARAMETER_SPLIT_ARG_OPT_COUNT( \
0459 BOOST_PARAMETER_FUNCTION_DISPATCH_SPLIT_ARGS(x) \
0460 ) \
0461 , x \
0462 ) \
0463 inline BOOST_PARAMETER_FUNCTION_DISPATCH_HEAD_PRN( \
0464 BOOST_PARAMETER_SPLIT_ARG_OPT_COUNT( \
0465 BOOST_PARAMETER_FUNCTION_DISPATCH_SPLIT_ARGS(x) \
0466 ) \
0467 , x \
0468 , 0 \
0469 , 0 \
0470 )
0471
0472
0473 #endif
0474