function_dispatch_layer.hpp 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474
  1. // Copyright Daniel Wallin 2006.
  2. // Copyright Cromwell D. Enage 2017.
  3. // Distributed under the Boost Software License, Version 1.0.
  4. // (See accompanying file LICENSE_1_0.txt or copy at
  5. // http://www.boost.org/LICENSE_1_0.txt)
  6. #ifndef BOOST_PARAMETER_AUX_PREPROCESSOR_IMPL_FUNCTION_DISPATCH_LAYER_HPP
  7. #define BOOST_PARAMETER_AUX_PREPROCESSOR_IMPL_FUNCTION_DISPATCH_LAYER_HPP
  8. #include <boost/preprocessor/cat.hpp>
  9. // Expands to keyword_tag_type for some keyword_tag.
  10. #define BOOST_PARAMETER_FUNCTION_DISPATCH_ARG_TYPE(keyword_tag) \
  11. BOOST_PP_CAT(keyword_tag, _type)
  12. /**/
  13. // Expands to a template parameter for each dispatch function.
  14. #define BOOST_PARAMETER_FUNCTION_DISPATCH_TEMPLATE_ARG(r, macro, arg) \
  15. , typename BOOST_PARAMETER_FUNCTION_DISPATCH_ARG_TYPE(macro(arg))
  16. /**/
  17. #include <boost/parameter/config.hpp>
  18. #if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
  19. // Expands to a forwarding parameter for a dispatch function.
  20. #define BOOST_PARAMETER_FUNCTION_DISPATCH_ARG_DEFN(r, macro, arg) \
  21. , BOOST_PARAMETER_FUNCTION_DISPATCH_ARG_TYPE(macro(arg))&& macro(arg)
  22. /**/
  23. #include <utility>
  24. // Expands to an argument passed from one dispatch function to the next.
  25. #define BOOST_PARAMETER_FUNCTION_DISPATCH_ARG_FWD(r, macro, arg) \
  26. , ::std::forward< \
  27. BOOST_PARAMETER_FUNCTION_DISPATCH_ARG_TYPE(macro(arg)) \
  28. >(macro(arg))
  29. /**/
  30. #else // !defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
  31. // Expands to a forwarding parameter for a dispatch function. The parameter
  32. // type stores its const-ness.
  33. #define BOOST_PARAMETER_FUNCTION_DISPATCH_ARG_DEFN(r, macro, arg) \
  34. , BOOST_PARAMETER_FUNCTION_DISPATCH_ARG_TYPE(macro(arg))& macro(arg)
  35. /**/
  36. #include <boost/parameter/aux_/as_lvalue.hpp>
  37. // Expands to an argument passed from one dispatch function to the next.
  38. // Explicit forwarding takes the form of forcing the argument to be an lvalue.
  39. #define BOOST_PARAMETER_FUNCTION_DISPATCH_ARG_FWD(r, macro, arg) \
  40. , ::boost::parameter::aux::as_lvalue(macro(arg))
  41. /**/
  42. #endif // BOOST_PARAMETER_HAS_PERFECT_FORWARDING
  43. #include <boost/parameter/aux_/preprocessor/impl/argument_specs.hpp>
  44. #include <boost/parameter/aux_/preprocessor/impl/split_args.hpp>
  45. #include <boost/preprocessor/seq/for_each.hpp>
  46. #include <boost/preprocessor/seq/first_n.hpp>
  47. // Iterates through all required arguments and the first n optional arguments,
  48. // passing each argument to the specified macro.
  49. #define BOOST_PARAMETER_FUNCTION_DISPATCH_ARG_REPEAT(macro, n, split_args) \
  50. BOOST_PP_SEQ_FOR_EACH( \
  51. macro \
  52. , BOOST_PARAMETER_FN_ARG_NAME \
  53. , BOOST_PARAMETER_SPLIT_ARG_REQ_SEQ(split_args) \
  54. ) \
  55. BOOST_PP_SEQ_FOR_EACH( \
  56. macro \
  57. , BOOST_PARAMETER_FN_ARG_NAME \
  58. , BOOST_PP_SEQ_FIRST_N( \
  59. n, BOOST_PARAMETER_SPLIT_ARG_OPT_SEQ(split_args) \
  60. ) \
  61. )
  62. /**/
  63. #include <boost/parameter/aux_/preprocessor/impl/function_dispatch_tuple.hpp>
  64. #include <boost/parameter/aux_/preprocessor/impl/function_name.hpp>
  65. #include <boost/preprocessor/control/if.hpp>
  66. // Produces a name for the dispatch functions.
  67. #define BOOST_PARAMETER_FUNCTION_DISPATCH_NAME(x, n) \
  68. BOOST_PP_CAT( \
  69. BOOST_PP_CAT( \
  70. BOOST_PP_IF( \
  71. BOOST_PARAMETER_FUNCTION_DISPATCH_IS_CONST(x) \
  72. , boost_param_dispatch_const_ \
  73. , boost_param_dispatch_ \
  74. ) \
  75. , BOOST_PP_CAT(BOOST_PP_CAT(n, boost_), __LINE__) \
  76. ) \
  77. , BOOST_PARAMETER_MEMBER_FUNCTION_NAME( \
  78. BOOST_PARAMETER_FUNCTION_DISPATCH_BASE_NAME(x) \
  79. ) \
  80. )
  81. /**/
  82. // Expands to the template parameter list of the dispatch function with all
  83. // required and first n optional parameters; also extracts the static keyword
  84. // if present.
  85. #define BOOST_PARAMETER_FUNCTION_DISPATCH_HEAD_TPL(n, x) \
  86. template < \
  87. typename ResultType, typename Args \
  88. BOOST_PARAMETER_FUNCTION_DISPATCH_ARG_REPEAT( \
  89. BOOST_PARAMETER_FUNCTION_DISPATCH_TEMPLATE_ARG \
  90. , n \
  91. , BOOST_PARAMETER_FUNCTION_DISPATCH_SPLIT_ARGS(x) \
  92. ) \
  93. > BOOST_PARAMETER_MEMBER_FUNCTION_STATIC( \
  94. BOOST_PARAMETER_FUNCTION_DISPATCH_BASE_NAME(x) \
  95. )
  96. /**/
  97. #include <boost/parameter/aux_/use_default_tag.hpp>
  98. #include <boost/preprocessor/control/expr_if.hpp>
  99. #include <boost/preprocessor/punctuation/comma_if.hpp>
  100. // Expands to the result type, name, parenthesized list of all required and
  101. // n optional parameters, and const-ness of the dispatch function; the bit
  102. // value b determines whether or not this dispatch function takes in
  103. // boost::parameter::aux::use_default_tag as its last parameter.
  104. #define BOOST_PARAMETER_FUNCTION_DISPATCH_HEAD_PRN(n, x, b1, b2) \
  105. ResultType BOOST_PARAMETER_FUNCTION_DISPATCH_NAME(x, b1)( \
  106. ResultType(*)(), Args const& args, long \
  107. BOOST_PARAMETER_FUNCTION_DISPATCH_ARG_REPEAT( \
  108. BOOST_PARAMETER_FUNCTION_DISPATCH_ARG_DEFN \
  109. , n \
  110. , BOOST_PARAMETER_FUNCTION_DISPATCH_SPLIT_ARGS(x) \
  111. ) \
  112. BOOST_PP_COMMA_IF(b2) \
  113. BOOST_PP_EXPR_IF(b2, ::boost::parameter::aux::use_default_tag) \
  114. ) BOOST_PP_EXPR_IF(BOOST_PARAMETER_FUNCTION_DISPATCH_IS_CONST(x), const)
  115. /**/
  116. // Expands to a forward declaration of the dispatch function that takes in
  117. // all required and the first n optional parameters, but not
  118. // boost::parameter::aux::use_default_tag.
  119. #define BOOST_PARAMETER_FUNCTION_DISPATCH_FWD_DECL_0_Z(z, n, x) \
  120. BOOST_PARAMETER_FUNCTION_DISPATCH_HEAD_TPL(n, x) \
  121. BOOST_PARAMETER_FUNCTION_DISPATCH_HEAD_PRN(n, x, 0, 0);
  122. /**/
  123. // Expands to a forward declaration of the dispatch function that takes in
  124. // all required parameters, the first n optional parameters, and
  125. // boost::parameter::aux::use_default_tag.
  126. #define BOOST_PARAMETER_FUNCTION_DISPATCH_FWD_DECL_1_Z(z, n, x) \
  127. BOOST_PARAMETER_FUNCTION_DISPATCH_HEAD_TPL(n, x) \
  128. BOOST_PARAMETER_FUNCTION_DISPATCH_HEAD_PRN(n, x, 0, 1);
  129. /**/
  130. #include <boost/preprocessor/seq/elem.hpp>
  131. // Expands to the default value of the (n + 1)th optional parameter.
  132. #define BOOST_PARAMETER_FUNCTION_DISPATCH_DEFAULT_AUX(n, s_args) \
  133. BOOST_PARAMETER_FN_ARG_DEFAULT( \
  134. BOOST_PP_SEQ_ELEM(n, BOOST_PARAMETER_SPLIT_ARG_OPT_SEQ(s_args)) \
  135. )
  136. /**/
  137. #include <boost/parameter/keyword.hpp>
  138. // Expands to the assignment portion which binds the default value to the
  139. // (n + 1)th optional parameter before composing it with the argument-pack
  140. // parameter passed in to the n-th dispatch function.
  141. #define BOOST_PARAMETER_FUNCTION_DISPATCH_DEFAULT(n, s_args, tag_ns) \
  142. ::boost::parameter::keyword< \
  143. tag_ns::BOOST_PARAMETER_FN_ARG_NAME( \
  144. BOOST_PP_SEQ_ELEM(n, BOOST_PARAMETER_SPLIT_ARG_OPT_SEQ(s_args)) \
  145. ) \
  146. >::instance = BOOST_PARAMETER_FUNCTION_DISPATCH_DEFAULT_AUX(n, s_args)
  147. /**/
  148. #include <boost/parameter/aux_/preprocessor/impl/function_cast.hpp>
  149. // Takes in the arg tuple (name, pred) and the tag namespace.
  150. // Extracts the corresponding required argument from the pack.
  151. // This form enables BOOST_PARAMETER_FUNCTION_DISPATCH_LAYER to use it
  152. // from within BOOST_PP_SEQ_FOR_EACH.
  153. #if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
  154. // The boost::parameter::aux::forward wrapper is necessary to transmit the
  155. // target type to the next dispatch function. Otherwise, the argument will
  156. // retain its original type. -- Cromwell D. Enage
  157. #define BOOST_PARAMETER_FUNCTION_DISPATCH_ARG_CAST_R(r, tag_ns, arg) \
  158. , ::boost::parameter::aux::forward< \
  159. BOOST_PARAMETER_FUNCTION_CAST_T( \
  160. tag_ns::BOOST_PARAMETER_FN_ARG_NAME(arg) \
  161. , BOOST_PARAMETER_FN_ARG_PRED(arg) \
  162. , Args \
  163. ) \
  164. , BOOST_PARAMETER_FUNCTION_CAST_B( \
  165. tag_ns::BOOST_PARAMETER_FN_ARG_NAME(arg) \
  166. , BOOST_PARAMETER_FN_ARG_PRED(arg) \
  167. , Args \
  168. ) \
  169. >( \
  170. args[ \
  171. ::boost::parameter::keyword< \
  172. tag_ns::BOOST_PARAMETER_FN_ARG_NAME(arg) \
  173. >::instance \
  174. ] \
  175. )
  176. /**/
  177. #else // !defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
  178. // The explicit type cast is necessary to transmit the target type to the next
  179. // dispatch function. Otherwise, the argument will retain its original type.
  180. // -- Cromwell D. Enage
  181. #define BOOST_PARAMETER_FUNCTION_DISPATCH_ARG_CAST_R(r, tag_ns, arg) \
  182. , BOOST_PARAMETER_FUNCTION_CAST_T( \
  183. tag_ns::BOOST_PARAMETER_FN_ARG_NAME(arg) \
  184. , BOOST_PARAMETER_FN_ARG_PRED(arg) \
  185. , Args \
  186. )( \
  187. args[ \
  188. ::boost::parameter::keyword< \
  189. tag_ns::BOOST_PARAMETER_FN_ARG_NAME(arg) \
  190. >::instance \
  191. ] \
  192. )
  193. /**/
  194. #endif // BOOST_PARAMETER_HAS_PERFECT_FORWARDING
  195. // Takes in the arg tuple (name, pred, default) and the tag namespace.
  196. // Extracts the corresponding optional argument from the pack if specified,
  197. // otherwise temporarily passes use_default_tag() to the dispatch functions.
  198. #if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
  199. // The boost::parameter::aux::forward wrapper is necessary to transmit the
  200. // target type to the next dispatch function. Otherwise, the argument will
  201. // retain its original type. -- Cromwell D. Enage
  202. #define BOOST_PARAMETER_FUNCTION_DISPATCH_OPT_ARG_CAST(arg, tag_ns) \
  203. ::boost::parameter::aux::forward< \
  204. BOOST_PARAMETER_FUNCTION_CAST_T( \
  205. tag_ns::BOOST_PARAMETER_FN_ARG_NAME(arg) \
  206. , BOOST_PARAMETER_FN_ARG_PRED(arg) \
  207. , Args \
  208. ) \
  209. , BOOST_PARAMETER_FUNCTION_CAST_B( \
  210. tag_ns::BOOST_PARAMETER_FN_ARG_NAME(arg) \
  211. , BOOST_PARAMETER_FN_ARG_PRED(arg) \
  212. , Args \
  213. ) \
  214. >( \
  215. args[ \
  216. ::boost::parameter::keyword< \
  217. tag_ns::BOOST_PARAMETER_FN_ARG_NAME(arg) \
  218. >::instance || ::boost::parameter::aux::use_default_tag() \
  219. ] \
  220. )
  221. /**/
  222. #else // !defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
  223. #define BOOST_PARAMETER_FUNCTION_DISPATCH_OPT_ARG_CAST(arg, tag_ns) \
  224. BOOST_PARAMETER_FUNCTION_CAST_B( \
  225. args[ \
  226. ::boost::parameter::keyword< \
  227. tag_ns::BOOST_PARAMETER_FN_ARG_NAME(arg) \
  228. >::instance || ::boost::parameter::aux::use_default_tag() \
  229. ] \
  230. , BOOST_PARAMETER_FN_ARG_PRED(arg) \
  231. , Args \
  232. )
  233. /**/
  234. #endif // BOOST_PARAMETER_HAS_PERFECT_FORWARDING
  235. #include <boost/parameter/aux_/preprocessor/nullptr.hpp>
  236. // Expands to three dispatch functions that take in all required parameters
  237. // and the first n optional parameters. The third dispatch function bears
  238. // the same name as the first but takes in use_default_tag as the last
  239. // parameter. The second dispatch function bears a different name from the
  240. // other two.
  241. //
  242. // x is a tuple:
  243. //
  244. // (name, split_args, is_const, tag_namespace)
  245. //
  246. // Where name is the base name of the functions, and split_args is a tuple:
  247. //
  248. // (required_count, required_args, optional_count, required_args)
  249. //
  250. // The first dispatch function queries args if it has bound the (n + 1)th
  251. // optional parameter to a user-defined argument. If so, then it forwards
  252. // its own arguments followed by the user-defined argument to the dispatch
  253. // function that takes in all required parameters and the first (n + 1)
  254. // optional parameters, but not use_default_tag. Otherwise, it forwards
  255. // its own arguments to the third dispatch function.
  256. //
  257. // The third dispatch function appends the default value of the (n + 1)th
  258. // optional parameter to its copy of args. Then it forwards this copy, all
  259. // required parameters, and the first n (not n + 1) optional parameters to
  260. // the second dispatch function.
  261. //
  262. // The second dispatch function forwards its arguments, then the (n + 1)th
  263. // optional parameter that it extracts from args, to the other-named dispatch
  264. // function that takes in all required parameters and the first (n + 1)
  265. // optional parameters, but not use_default_tag.
  266. #define BOOST_PARAMETER_FUNCTION_DISPATCH_OVERLOAD_Z(z, n, x) \
  267. BOOST_PARAMETER_FUNCTION_DISPATCH_HEAD_TPL(n, x) \
  268. inline BOOST_PARAMETER_FUNCTION_DISPATCH_HEAD_PRN(n, x, 0, 0) \
  269. { \
  270. return BOOST_PP_EXPR_IF( \
  271. BOOST_PARAMETER_FUNCTION_DISPATCH_IS_MEMBER(x) \
  272. , this-> \
  273. ) BOOST_PARAMETER_FUNCTION_DISPATCH_NAME(x, 0)( \
  274. static_cast<ResultType(*)()>(BOOST_PARAMETER_AUX_PP_NULLPTR) \
  275. , args \
  276. , 0L \
  277. BOOST_PARAMETER_FUNCTION_DISPATCH_ARG_REPEAT( \
  278. BOOST_PARAMETER_FUNCTION_DISPATCH_ARG_FWD \
  279. , n \
  280. , BOOST_PARAMETER_FUNCTION_DISPATCH_SPLIT_ARGS(x) \
  281. ) \
  282. , BOOST_PARAMETER_FUNCTION_DISPATCH_OPT_ARG_CAST( \
  283. BOOST_PP_SEQ_ELEM( \
  284. n \
  285. , BOOST_PARAMETER_SPLIT_ARG_OPT_SEQ( \
  286. BOOST_PARAMETER_FUNCTION_DISPATCH_SPLIT_ARGS(x) \
  287. ) \
  288. ) \
  289. , BOOST_PARAMETER_FUNCTION_DISPATCH_TAG_NAMESPACE(x) \
  290. ) \
  291. ); \
  292. } \
  293. BOOST_PARAMETER_FUNCTION_DISPATCH_HEAD_TPL(n, x) \
  294. inline BOOST_PARAMETER_FUNCTION_DISPATCH_HEAD_PRN(n, x, 1, 0) \
  295. { \
  296. return BOOST_PP_EXPR_IF( \
  297. BOOST_PARAMETER_FUNCTION_DISPATCH_IS_MEMBER(x) \
  298. , this-> \
  299. ) BOOST_PARAMETER_FUNCTION_DISPATCH_NAME(x, 0)( \
  300. static_cast<ResultType(*)()>(BOOST_PARAMETER_AUX_PP_NULLPTR) \
  301. , args \
  302. , 0L \
  303. BOOST_PARAMETER_FUNCTION_DISPATCH_ARG_REPEAT( \
  304. BOOST_PARAMETER_FUNCTION_DISPATCH_ARG_FWD \
  305. , n \
  306. , BOOST_PARAMETER_FUNCTION_DISPATCH_SPLIT_ARGS(x) \
  307. ) \
  308. , args[ \
  309. ::boost::parameter::keyword< \
  310. BOOST_PARAMETER_FUNCTION_DISPATCH_TAG_NAMESPACE(x):: \
  311. BOOST_PARAMETER_FN_ARG_NAME( \
  312. BOOST_PP_SEQ_ELEM( \
  313. n \
  314. , BOOST_PARAMETER_SPLIT_ARG_OPT_SEQ( \
  315. BOOST_PARAMETER_FUNCTION_DISPATCH_SPLIT_ARGS(x) \
  316. ) \
  317. ) \
  318. ) \
  319. >::instance \
  320. ] \
  321. ); \
  322. } \
  323. BOOST_PARAMETER_FUNCTION_DISPATCH_HEAD_TPL(n, x) \
  324. inline BOOST_PARAMETER_FUNCTION_DISPATCH_HEAD_PRN(n, x, 0, 1) \
  325. { \
  326. return BOOST_PP_EXPR_IF( \
  327. BOOST_PARAMETER_FUNCTION_DISPATCH_IS_MEMBER(x) \
  328. , this-> \
  329. ) BOOST_PARAMETER_FUNCTION_DISPATCH_NAME(x, 1)( \
  330. static_cast<ResultType(*)()>(BOOST_PARAMETER_AUX_PP_NULLPTR) \
  331. , (args \
  332. , BOOST_PARAMETER_FUNCTION_DISPATCH_DEFAULT( \
  333. n \
  334. , BOOST_PARAMETER_FUNCTION_DISPATCH_SPLIT_ARGS(x) \
  335. , BOOST_PARAMETER_FUNCTION_DISPATCH_TAG_NAMESPACE(x) \
  336. ) \
  337. ) \
  338. , 0L \
  339. BOOST_PARAMETER_FUNCTION_DISPATCH_ARG_REPEAT( \
  340. BOOST_PARAMETER_FUNCTION_DISPATCH_ARG_FWD \
  341. , n \
  342. , BOOST_PARAMETER_FUNCTION_DISPATCH_SPLIT_ARGS(x) \
  343. ) \
  344. ); \
  345. }
  346. /**/
  347. #include <boost/preprocessor/arithmetic/inc.hpp>
  348. #include <boost/preprocessor/control/if.hpp>
  349. #include <boost/preprocessor/repetition/repeat_from_to.hpp>
  350. #include <boost/preprocessor/tuple/eat.hpp>
  351. // x is a tuple:
  352. //
  353. // (base_name, split_args, is_member, is_const, tag_namespace)
  354. //
  355. // Generates all dispatch functions for the function named base_name. Each
  356. // dispatch function that takes in n optional parameters passes the default
  357. // value of the (n + 1)th optional parameter to the next dispatch function.
  358. // The last dispatch function is the back-end implementation, so only the
  359. // header is generated: the user is expected to supply the body.
  360. //
  361. // Also generates the front-end implementation function, which uses
  362. // BOOST_PARAMETER_FUNCTION_CAST to extract each argument from the argument
  363. // pack.
  364. #define BOOST_PARAMETER_FUNCTION_DISPATCH_LAYER(fwd_decl, x) \
  365. BOOST_PP_IF(fwd_decl, BOOST_PP_REPEAT_FROM_TO, BOOST_PP_TUPLE_EAT(4))( \
  366. 0 \
  367. , BOOST_PP_INC( \
  368. BOOST_PARAMETER_SPLIT_ARG_OPT_COUNT( \
  369. BOOST_PARAMETER_FUNCTION_DISPATCH_SPLIT_ARGS(x) \
  370. ) \
  371. ) \
  372. , BOOST_PARAMETER_FUNCTION_DISPATCH_FWD_DECL_0_Z \
  373. , x \
  374. ) \
  375. BOOST_PP_IF(fwd_decl, BOOST_PP_REPEAT_FROM_TO, BOOST_PP_TUPLE_EAT(4))( \
  376. 0 \
  377. , BOOST_PARAMETER_SPLIT_ARG_OPT_COUNT( \
  378. BOOST_PARAMETER_FUNCTION_DISPATCH_SPLIT_ARGS(x) \
  379. ) \
  380. , BOOST_PARAMETER_FUNCTION_DISPATCH_FWD_DECL_1_Z \
  381. , x \
  382. ) \
  383. template <typename Args> BOOST_PARAMETER_MEMBER_FUNCTION_STATIC( \
  384. BOOST_PARAMETER_FUNCTION_DISPATCH_BASE_NAME(x) \
  385. ) inline typename BOOST_PARAMETER_FUNCTION_RESULT_NAME( \
  386. BOOST_PARAMETER_FUNCTION_DISPATCH_BASE_NAME(x) \
  387. , BOOST_PARAMETER_FUNCTION_DISPATCH_IS_CONST(x) \
  388. )<Args>::type BOOST_PARAMETER_FUNCTION_IMPL_NAME( \
  389. BOOST_PARAMETER_FUNCTION_DISPATCH_BASE_NAME(x) \
  390. , BOOST_PARAMETER_FUNCTION_DISPATCH_IS_CONST(x) \
  391. )(Args const& args) \
  392. BOOST_PP_EXPR_IF(BOOST_PARAMETER_FUNCTION_DISPATCH_IS_CONST(x), const) \
  393. { \
  394. return BOOST_PP_EXPR_IF( \
  395. BOOST_PARAMETER_FUNCTION_DISPATCH_IS_MEMBER(x) \
  396. , this-> \
  397. ) BOOST_PARAMETER_FUNCTION_DISPATCH_NAME(x, 0)( \
  398. static_cast< \
  399. typename BOOST_PARAMETER_FUNCTION_RESULT_NAME( \
  400. BOOST_PARAMETER_FUNCTION_DISPATCH_BASE_NAME(x) \
  401. , BOOST_PARAMETER_FUNCTION_DISPATCH_IS_CONST(x) \
  402. )<Args>::type(*)() \
  403. >(BOOST_PARAMETER_AUX_PP_NULLPTR) \
  404. , args \
  405. , 0L \
  406. BOOST_PP_SEQ_FOR_EACH( \
  407. BOOST_PARAMETER_FUNCTION_DISPATCH_ARG_CAST_R \
  408. , BOOST_PARAMETER_FUNCTION_DISPATCH_TAG_NAMESPACE(x) \
  409. , BOOST_PARAMETER_SPLIT_ARG_REQ_SEQ( \
  410. BOOST_PARAMETER_FUNCTION_DISPATCH_SPLIT_ARGS(x) \
  411. ) \
  412. ) \
  413. ); \
  414. } \
  415. BOOST_PP_REPEAT_FROM_TO( \
  416. 0 \
  417. , BOOST_PARAMETER_SPLIT_ARG_OPT_COUNT( \
  418. BOOST_PARAMETER_FUNCTION_DISPATCH_SPLIT_ARGS(x) \
  419. ) \
  420. , BOOST_PARAMETER_FUNCTION_DISPATCH_OVERLOAD_Z \
  421. , x \
  422. ) \
  423. BOOST_PARAMETER_FUNCTION_DISPATCH_HEAD_TPL( \
  424. BOOST_PARAMETER_SPLIT_ARG_OPT_COUNT( \
  425. BOOST_PARAMETER_FUNCTION_DISPATCH_SPLIT_ARGS(x) \
  426. ) \
  427. , x \
  428. ) \
  429. inline BOOST_PARAMETER_FUNCTION_DISPATCH_HEAD_PRN( \
  430. BOOST_PARAMETER_SPLIT_ARG_OPT_COUNT( \
  431. BOOST_PARAMETER_FUNCTION_DISPATCH_SPLIT_ARGS(x) \
  432. ) \
  433. , x \
  434. , 0 \
  435. , 0 \
  436. )
  437. /**/
  438. #endif // include guard