forwarding_overloads.hpp 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509
  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_FORWARDING_OVERLOADS_HPP
  7. #define BOOST_PARAMETER_AUX_PREPROCESSOR_IMPL_FORWARDING_OVERLOADS_HPP
  8. #include <boost/parameter/config.hpp>
  9. #if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
  10. #include <boost/preprocessor/cat.hpp>
  11. // Expands to a forwarding parameter for a constructor or forwarding function.
  12. #define BOOST_PARAMETER_FUNCTION_ARG_TYPE_Z(z, n, type_prefix) \
  13. BOOST_PP_CAT(type_prefix, n)&&
  14. /**/
  15. #include <utility>
  16. // Expands to an argument passed from a forwarding function to the front-end
  17. // implementation function, or from a constructor to its delegate.
  18. #define BOOST_PARAMETER_FUNCTION_FORWARD_PARAM_Z(z, n, type_prefix) \
  19. ::std::forward<BOOST_PP_CAT(type_prefix, n)>(BOOST_PP_CAT(a, n))
  20. /**/
  21. #include <boost/parameter/aux_/preprocessor/impl/parenthesized_type.hpp>
  22. #include <boost/preprocessor/tuple/elem.hpp>
  23. // Expands to the default constructor, whose job is to pass an empty back to
  24. // the delegate constructor of the base class.
  25. #define BOOST_PARAMETER_CONSTRUCTOR_OVERLOAD_0_Z(z, n, data) \
  26. inline BOOST_PP_TUPLE_ELEM(2, 0, data)() \
  27. : BOOST_PARAMETER_PARENTHESIZED_TYPE(BOOST_PP_TUPLE_ELEM(2, 1, data))( \
  28. BOOST_PP_CAT(constructor_parameters, __LINE__)()() \
  29. ) \
  30. { \
  31. }
  32. /**/
  33. #include <boost/parameter/aux_/pp_impl/argument_pack.hpp>
  34. #include <boost/parameter/aux_/preprocessor/impl/function_name.hpp>
  35. #include <boost/preprocessor/control/expr_if.hpp>
  36. // Expands to a 0-arity forwarding function, whose job is to pass an empty
  37. // pack to the front-end implementation function.
  38. #define BOOST_PARAMETER_FUNCTION_FORWARD_OVERLOAD_0_Z(z, n, data) \
  39. BOOST_PARAMETER_MEMBER_FUNCTION_STATIC(BOOST_PP_TUPLE_ELEM(4, 1, data)) \
  40. inline BOOST_PARAMETER_FUNCTION_RESULT_NAME( \
  41. BOOST_PP_TUPLE_ELEM(4, 1, data) \
  42. , BOOST_PP_TUPLE_ELEM(4, 3, data) \
  43. )< \
  44. ::boost::parameter::aux::argument_pack< \
  45. BOOST_PARAMETER_FUNCTION_SPECIFICATION_NAME( \
  46. BOOST_PP_TUPLE_ELEM(4, 1, data) \
  47. , BOOST_PP_TUPLE_ELEM(4, 3, data) \
  48. ) \
  49. >::type \
  50. >::type \
  51. BOOST_PARAMETER_MEMBER_FUNCTION_NAME(BOOST_PP_TUPLE_ELEM(3, 0, data))() \
  52. BOOST_PP_EXPR_IF(BOOST_PP_TUPLE_ELEM(4, 3, data), const) \
  53. { \
  54. return BOOST_PP_EXPR_IF(BOOST_PP_TUPLE_ELEM(4, 2, data), this->) \
  55. BOOST_PARAMETER_FUNCTION_IMPL_NAME( \
  56. BOOST_PP_TUPLE_ELEM(4, 1, data) \
  57. , BOOST_PP_TUPLE_ELEM(4, 3, data) \
  58. )( \
  59. BOOST_PARAMETER_FUNCTION_SPECIFICATION_NAME( \
  60. BOOST_PP_TUPLE_ELEM(4, 1, data) \
  61. , BOOST_PP_TUPLE_ELEM(4, 3, data) \
  62. )()() \
  63. ); \
  64. }
  65. /**/
  66. #include <boost/parameter/aux_/preprocessor/impl/function_forward_match.hpp>
  67. #include <boost/preprocessor/repetition/enum.hpp>
  68. #include <boost/preprocessor/repetition/enum_params.hpp>
  69. #include <boost/preprocessor/repetition/enum_binary_params.hpp>
  70. // Expands to a forwarding function, whose job is to consolidate its arguments
  71. // into a pack for the front-end implementation function to take in.
  72. #define BOOST_PARAMETER_FUNCTION_FORWARD_OVERLOAD_1_Z(z, n, data) \
  73. template <BOOST_PP_ENUM_PARAMS_Z(z, n, typename ParameterArgumentType)> \
  74. BOOST_PARAMETER_MEMBER_FUNCTION_STATIC(BOOST_PP_TUPLE_ELEM(4, 1, data)) \
  75. inline typename BOOST_PARAMETER_FUNCTION_RESULT_NAME( \
  76. BOOST_PP_TUPLE_ELEM(4, 1, data) \
  77. , BOOST_PP_TUPLE_ELEM(4, 3, data) \
  78. )< \
  79. typename ::boost::parameter::aux::argument_pack< \
  80. BOOST_PARAMETER_FUNCTION_SPECIFICATION_NAME( \
  81. BOOST_PP_TUPLE_ELEM(4, 1, data) \
  82. , BOOST_PP_TUPLE_ELEM(4, 3, data) \
  83. ) \
  84. , BOOST_PP_CAT(BOOST_PP_ENUM_, z)( \
  85. n \
  86. , BOOST_PARAMETER_FUNCTION_ARG_TYPE_Z \
  87. , ParameterArgumentType \
  88. ) \
  89. >::type \
  90. >::type \
  91. BOOST_PARAMETER_MEMBER_FUNCTION_NAME(BOOST_PP_TUPLE_ELEM(4, 0, data))( \
  92. BOOST_PP_ENUM_BINARY_PARAMS_Z(z, n, ParameterArgumentType, && a) \
  93. BOOST_PARAMETER_FUNCTION_FORWARD_MATCH_Z( \
  94. z \
  95. , BOOST_PARAMETER_FUNCTION_SPECIFICATION_NAME( \
  96. BOOST_PP_TUPLE_ELEM(4, 1, data) \
  97. , BOOST_PP_TUPLE_ELEM(4, 3, data) \
  98. ) \
  99. , n \
  100. , ParameterArgumentType \
  101. ) \
  102. ) BOOST_PP_EXPR_IF(BOOST_PP_TUPLE_ELEM(4, 3, data), const) \
  103. { \
  104. return BOOST_PP_EXPR_IF(BOOST_PP_TUPLE_ELEM(4, 2, data), this->) \
  105. BOOST_PARAMETER_FUNCTION_IMPL_NAME( \
  106. BOOST_PP_TUPLE_ELEM(4, 1, data) \
  107. , BOOST_PP_TUPLE_ELEM(4, 3, data) \
  108. )( \
  109. BOOST_PARAMETER_FUNCTION_SPECIFICATION_NAME( \
  110. BOOST_PP_TUPLE_ELEM(4, 1, data) \
  111. , BOOST_PP_TUPLE_ELEM(4, 3, data) \
  112. )()( \
  113. BOOST_PP_CAT(BOOST_PP_ENUM_, z)( \
  114. n \
  115. , BOOST_PARAMETER_FUNCTION_FORWARD_PARAM_Z \
  116. , ParameterArgumentType \
  117. ) \
  118. ) \
  119. ); \
  120. }
  121. /**/
  122. #include <boost/preprocessor/comparison/equal.hpp>
  123. // Expands to a constructor whose job is to consolidate its arguments into a
  124. // pack for the delegate constructor of the base class to take in.
  125. #define BOOST_PARAMETER_CONSTRUCTOR_OVERLOAD_1_Z(z, n, data) \
  126. template <BOOST_PP_ENUM_PARAMS_Z(z, n, typename ParameterArgumentType)> \
  127. BOOST_PP_EXPR_IF(BOOST_PP_EQUAL(n, 1), explicit) \
  128. inline BOOST_PP_TUPLE_ELEM(2, 0, data)( \
  129. BOOST_PP_ENUM_BINARY_PARAMS_Z(z, n, ParameterArgumentType, && a) \
  130. BOOST_PARAMETER_FUNCTION_FORWARD_MATCH_Z( \
  131. z \
  132. , BOOST_PP_CAT(constructor_parameters, __LINE__) \
  133. , n \
  134. , ParameterArgumentType \
  135. ) \
  136. ) : BOOST_PARAMETER_PARENTHESIZED_TYPE(BOOST_PP_TUPLE_ELEM(2, 1, data))( \
  137. BOOST_PP_CAT(constructor_parameters, __LINE__)()( \
  138. BOOST_PP_CAT(BOOST_PP_ENUM_, z)( \
  139. n \
  140. , BOOST_PARAMETER_FUNCTION_FORWARD_PARAM_Z \
  141. , ParameterArgumentType \
  142. ) \
  143. ) \
  144. ) \
  145. { \
  146. }
  147. /**/
  148. #include <boost/preprocessor/control/if.hpp>
  149. #define BOOST_PARAMETER_FUNCTION_FORWARD_OVERLOAD_Z(z, n, data) \
  150. BOOST_PP_IF( \
  151. n \
  152. , BOOST_PARAMETER_FUNCTION_FORWARD_OVERLOAD_1_Z \
  153. , BOOST_PARAMETER_FUNCTION_FORWARD_OVERLOAD_0_Z \
  154. )(z, n, data)
  155. /**/
  156. #define BOOST_PARAMETER_CONSTRUCTOR_OVERLOAD_Z(z, n, data) \
  157. BOOST_PP_IF( \
  158. n \
  159. , BOOST_PARAMETER_CONSTRUCTOR_OVERLOAD_1_Z \
  160. , BOOST_PARAMETER_CONSTRUCTOR_OVERLOAD_0_Z \
  161. )(z, n, data)
  162. /**/
  163. #include <boost/preprocessor/repetition/repeat_from_to.hpp>
  164. // Helper macro for BOOST_PARAMETER_FUNCTION_FORWARD_OVERLOADS.
  165. #define BOOST_PARAMETER_FUNCTION_FORWARD_OVERLOADS_AUX(nm, impl, r, is_m, c) \
  166. BOOST_PP_REPEAT_FROM_TO( \
  167. BOOST_PP_TUPLE_ELEM(2, 0, r) \
  168. , BOOST_PP_TUPLE_ELEM(2, 1, r) \
  169. , BOOST_PARAMETER_FUNCTION_FORWARD_OVERLOAD_Z \
  170. , ( \
  171. nm \
  172. , impl \
  173. , BOOST_PP_IF( \
  174. BOOST_PARAMETER_MEMBER_FUNCTION_IS_STATIC(nm) \
  175. , 0 \
  176. , is_m \
  177. ) \
  178. , c \
  179. ) \
  180. )
  181. /**/
  182. // Helper macro for BOOST_PARAMETER_CONSTRUCTOR_OVERLOADS.
  183. #define BOOST_PARAMETER_CONSTRUCTOR_OVERLOADS_AUX(class_, base, range) \
  184. BOOST_PP_REPEAT_FROM_TO( \
  185. BOOST_PP_TUPLE_ELEM(2, 0, range) \
  186. , BOOST_PP_TUPLE_ELEM(2, 1, range) \
  187. , BOOST_PARAMETER_CONSTRUCTOR_OVERLOAD_Z \
  188. , (class_, base) \
  189. )
  190. /**/
  191. #include <boost/parameter/aux_/preprocessor/impl/arity_range.hpp>
  192. // Expands to the layer of forwarding functions for the function with the
  193. // specified name, whose arguments determine the range of arities.
  194. #define BOOST_PARAMETER_FUNCTION_FORWARD_OVERLOADS(name, impl, a, is_m, c) \
  195. BOOST_PARAMETER_FUNCTION_FORWARD_OVERLOADS_AUX( \
  196. name, impl, BOOST_PARAMETER_ARITY_RANGE(a), is_m, c \
  197. )
  198. /**/
  199. // Expands to the layer of forwarding functions for the constructor in the
  200. // specified class, whose arguments determine the range of arities.
  201. #define BOOST_PARAMETER_CONSTRUCTOR_OVERLOADS(class_, base, args) \
  202. BOOST_PARAMETER_CONSTRUCTOR_OVERLOADS_AUX( \
  203. class_, base, BOOST_PARAMETER_ARITY_RANGE(args) \
  204. )
  205. /**/
  206. #else // !defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
  207. #include <boost/parameter/aux_/preprocessor/impl/parenthesized_type.hpp>
  208. #include <boost/preprocessor/seq/seq.hpp>
  209. #include <boost/preprocessor/tuple/elem.hpp>
  210. #include <boost/preprocessor/cat.hpp>
  211. // Expands to the default constructor, whose job is to pass an empty argument
  212. // pack back to the delegate constructor of the base class.
  213. #define BOOST_PARAMETER_DEFAULT_CONSTRUCTOR(z, n, seq) \
  214. inline \
  215. BOOST_PP_TUPLE_ELEM(2, 0, BOOST_PP_SEQ_HEAD(BOOST_PP_SEQ_TAIL(seq)))() \
  216. : BOOST_PARAMETER_PARENTHESIZED_TYPE( \
  217. BOOST_PP_TUPLE_ELEM( \
  218. 2, 1, BOOST_PP_SEQ_HEAD(BOOST_PP_SEQ_TAIL(seq)) \
  219. ) \
  220. )(BOOST_PP_CAT(constructor_parameters, __LINE__)()()) \
  221. { \
  222. }
  223. /**/
  224. #include <boost/parameter/aux_/pp_impl/argument_pack.hpp>
  225. #include <boost/parameter/aux_/preprocessor/impl/function_name.hpp>
  226. #include <boost/preprocessor/control/expr_if.hpp>
  227. // Expands to a 0-arity forwarding function, whose job is to pass an empty
  228. // argument pack to the front-end implementation function.
  229. #define BOOST_PARAMETER_FUNCTION_FORWARD_OVERLOAD_0_ARITY(z, n, seq) \
  230. BOOST_PARAMETER_MEMBER_FUNCTION_STATIC( \
  231. BOOST_PP_TUPLE_ELEM( \
  232. 4, 1, BOOST_PP_SEQ_HEAD(BOOST_PP_SEQ_TAIL(seq)) \
  233. ) \
  234. ) \
  235. inline BOOST_PARAMETER_FUNCTION_RESULT_NAME( \
  236. BOOST_PP_TUPLE_ELEM( \
  237. 4, 1, BOOST_PP_SEQ_HEAD(BOOST_PP_SEQ_TAIL(seq)) \
  238. ) \
  239. , BOOST_PP_TUPLE_ELEM( \
  240. 4, 3, BOOST_PP_SEQ_HEAD(BOOST_PP_SEQ_TAIL(seq)) \
  241. ) \
  242. )< \
  243. ::boost::parameter::aux::argument_pack< \
  244. BOOST_PARAMETER_FUNCTION_SPECIFICATION_NAME( \
  245. BOOST_PP_TUPLE_ELEM( \
  246. 4, 1, BOOST_PP_SEQ_HEAD(BOOST_PP_SEQ_TAIL(seq)) \
  247. ) \
  248. , BOOST_PP_TUPLE_ELEM( \
  249. 4, 3, BOOST_PP_SEQ_HEAD(BOOST_PP_SEQ_TAIL(seq)) \
  250. ) \
  251. ) \
  252. >::type \
  253. >::type \
  254. BOOST_PARAMETER_MEMBER_FUNCTION_NAME( \
  255. BOOST_PP_TUPLE_ELEM( \
  256. 4, 0, BOOST_PP_SEQ_HEAD(BOOST_PP_SEQ_TAIL(seq)) \
  257. ) \
  258. )() BOOST_PP_EXPR_IF( \
  259. BOOST_PP_TUPLE_ELEM( \
  260. 4, 3, BOOST_PP_SEQ_HEAD(BOOST_PP_SEQ_TAIL(seq)) \
  261. ) \
  262. , const \
  263. ) \
  264. { \
  265. return BOOST_PP_EXPR_IF( \
  266. BOOST_PP_TUPLE_ELEM( \
  267. 4, 2, BOOST_PP_SEQ_HEAD(BOOST_PP_SEQ_TAIL(seq)) \
  268. ) \
  269. , this-> \
  270. ) BOOST_PARAMETER_FUNCTION_IMPL_NAME( \
  271. BOOST_PP_TUPLE_ELEM( \
  272. 4, 1, BOOST_PP_SEQ_HEAD(BOOST_PP_SEQ_TAIL(seq)) \
  273. ) \
  274. , BOOST_PP_TUPLE_ELEM( \
  275. 4, 3, BOOST_PP_SEQ_HEAD(BOOST_PP_SEQ_TAIL(seq)) \
  276. ) \
  277. )( \
  278. BOOST_PARAMETER_FUNCTION_SPECIFICATION_NAME( \
  279. BOOST_PP_TUPLE_ELEM( \
  280. 4, 1, BOOST_PP_SEQ_HEAD(BOOST_PP_SEQ_TAIL(seq)) \
  281. ) \
  282. , BOOST_PP_TUPLE_ELEM( \
  283. 4, 3, BOOST_PP_SEQ_HEAD(BOOST_PP_SEQ_TAIL(seq)) \
  284. ) \
  285. )()() \
  286. ); \
  287. }
  288. /**/
  289. #include <boost/parameter/aux_/preprocessor/binary_seq_to_args.hpp>
  290. #include <boost/parameter/aux_/preprocessor/impl/function_forward_match.hpp>
  291. #include <boost/preprocessor/comparison/equal.hpp>
  292. #include <boost/preprocessor/repetition/enum_params.hpp>
  293. #include <boost/preprocessor/seq/size.hpp>
  294. // Expands to a constructor whose job is to consolidate its arguments into a
  295. // pack for the delegate constructor of the base class to take in. Each
  296. // element in BOOST_PP_SEQ_TAIL(seq) determines the const-ness of the
  297. // corresponding argument.
  298. #define BOOST_PARAMETER_CONSTRUCTOR_OVERLOAD_R(r, seq) \
  299. template < \
  300. BOOST_PP_ENUM_PARAMS( \
  301. BOOST_PP_SEQ_SIZE(BOOST_PP_SEQ_TAIL(seq)) \
  302. , typename ParameterArgumentType \
  303. ) \
  304. > \
  305. BOOST_PP_EXPR_IF( \
  306. BOOST_PP_EQUAL(BOOST_PP_SEQ_SIZE(BOOST_PP_SEQ_TAIL(seq)), 1) \
  307. , explicit \
  308. ) \
  309. inline BOOST_PP_TUPLE_ELEM(2, 0, BOOST_PP_SEQ_HEAD(seq))( \
  310. BOOST_PARAMETER_AUX_PP_BINARY_SEQ_TO_ARGS( \
  311. BOOST_PP_SEQ_TAIL(seq), (ParameterArgumentType)(a) \
  312. ) \
  313. BOOST_PARAMETER_FUNCTION_FORWARD_MATCH( \
  314. BOOST_PP_CAT(constructor_parameters, __LINE__) \
  315. , BOOST_PP_SEQ_SIZE(BOOST_PP_SEQ_TAIL(seq)) \
  316. , ParameterArgumentType \
  317. ) \
  318. ) : BOOST_PARAMETER_PARENTHESIZED_TYPE( \
  319. BOOST_PP_TUPLE_ELEM(2, 1, BOOST_PP_SEQ_HEAD(seq)) \
  320. )( \
  321. BOOST_PP_CAT(constructor_parameters, __LINE__)()( \
  322. BOOST_PP_ENUM_PARAMS( \
  323. BOOST_PP_SEQ_SIZE(BOOST_PP_SEQ_TAIL(seq)), a \
  324. ) \
  325. ) \
  326. ) \
  327. { \
  328. }
  329. /**/
  330. // Expands to a forwarding function, whose job is to consolidate its arguments
  331. // into a pack for the front-end implementation function to take in. Each
  332. // element in BOOST_PP_SEQ_TAIL(seq) determines the const-ness of the
  333. // corresponding argument.
  334. #define BOOST_PARAMETER_FUNCTION_FORWARD_OVERLOAD_R(r, seq) \
  335. template < \
  336. BOOST_PP_ENUM_PARAMS( \
  337. BOOST_PP_SEQ_SIZE(BOOST_PP_SEQ_TAIL(seq)) \
  338. , typename ParameterArgumentType \
  339. ) \
  340. > \
  341. BOOST_PARAMETER_MEMBER_FUNCTION_STATIC( \
  342. BOOST_PP_TUPLE_ELEM(4, 1, BOOST_PP_SEQ_HEAD(seq)) \
  343. ) \
  344. inline typename BOOST_PARAMETER_FUNCTION_RESULT_NAME( \
  345. BOOST_PP_TUPLE_ELEM(4, 1, BOOST_PP_SEQ_HEAD(seq)) \
  346. , BOOST_PP_TUPLE_ELEM(4, 3, BOOST_PP_SEQ_HEAD(seq)) \
  347. )< \
  348. typename ::boost::parameter::aux::argument_pack< \
  349. BOOST_PARAMETER_FUNCTION_SPECIFICATION_NAME( \
  350. BOOST_PP_TUPLE_ELEM(4, 1, BOOST_PP_SEQ_HEAD(seq)) \
  351. , BOOST_PP_TUPLE_ELEM(4, 3, BOOST_PP_SEQ_HEAD(seq)) \
  352. ) \
  353. , BOOST_PARAMETER_AUX_PP_BINARY_SEQ_TO_ARGS( \
  354. BOOST_PP_SEQ_TAIL(seq), (ParameterArgumentType) \
  355. ) \
  356. >::type \
  357. >::type \
  358. BOOST_PARAMETER_MEMBER_FUNCTION_NAME( \
  359. BOOST_PP_TUPLE_ELEM(4, 0, BOOST_PP_SEQ_HEAD(seq)) \
  360. )( \
  361. BOOST_PARAMETER_AUX_PP_BINARY_SEQ_TO_ARGS( \
  362. BOOST_PP_SEQ_TAIL(seq), (ParameterArgumentType)(a) \
  363. ) \
  364. BOOST_PARAMETER_FUNCTION_FORWARD_MATCH( \
  365. BOOST_PARAMETER_FUNCTION_SPECIFICATION_NAME( \
  366. BOOST_PP_TUPLE_ELEM(4, 1, BOOST_PP_SEQ_HEAD(seq)) \
  367. , BOOST_PP_TUPLE_ELEM(4, 3, BOOST_PP_SEQ_HEAD(seq)) \
  368. ) \
  369. , BOOST_PP_SEQ_SIZE(BOOST_PP_SEQ_TAIL(seq)) \
  370. , ParameterArgumentType \
  371. ) \
  372. ) BOOST_PP_EXPR_IF( \
  373. BOOST_PP_TUPLE_ELEM(4, 3, BOOST_PP_SEQ_HEAD(seq)), const \
  374. ) \
  375. { \
  376. return BOOST_PP_EXPR_IF( \
  377. BOOST_PP_TUPLE_ELEM(4, 2, BOOST_PP_SEQ_HEAD(seq)) \
  378. , this-> \
  379. ) BOOST_PARAMETER_FUNCTION_IMPL_NAME( \
  380. BOOST_PP_TUPLE_ELEM(4, 1, BOOST_PP_SEQ_HEAD(seq)) \
  381. , BOOST_PP_TUPLE_ELEM(4, 3, BOOST_PP_SEQ_HEAD(seq)) \
  382. )( \
  383. BOOST_PARAMETER_FUNCTION_SPECIFICATION_NAME( \
  384. BOOST_PP_TUPLE_ELEM(4, 1, BOOST_PP_SEQ_HEAD(seq)) \
  385. , BOOST_PP_TUPLE_ELEM(4, 3, BOOST_PP_SEQ_HEAD(seq)) \
  386. )()( \
  387. BOOST_PP_ENUM_PARAMS( \
  388. BOOST_PP_SEQ_SIZE(BOOST_PP_SEQ_TAIL(seq)), a \
  389. ) \
  390. ) \
  391. ); \
  392. }
  393. /**/
  394. #include <boost/parameter/aux_/preprocessor/binary_seq_for_each.hpp>
  395. #include <boost/preprocessor/control/if.hpp>
  396. // Expands to all constructors that take in n arguments. Enables
  397. // BOOST_PARAMETER_CONSTRUCTOR_OVERLOADS_AUX to use
  398. // BOOST_PARAMETER_CONSTRUCTOR_OVERLOAD_Z within BOOST_PP_REPEAT_FROM_TO.
  399. #define BOOST_PARAMETER_CONSTRUCTOR_OVERLOAD_Z(z, n, data) \
  400. BOOST_PP_IF( \
  401. n \
  402. , BOOST_PARAMETER_AUX_PP_BINARY_SEQ_FOR_EACH_Z \
  403. , BOOST_PARAMETER_DEFAULT_CONSTRUCTOR \
  404. )(z, n, (BOOST_PARAMETER_CONSTRUCTOR_OVERLOAD_R)(data))
  405. /**/
  406. // Expands to all forwarding functions that take in n arguments. Enables
  407. // BOOST_PARAMETER_FUNCTION_FORWARD_OVERLOADS_AUX to use
  408. // BOOST_PARAMETER_FUNCTION_FORWARD_OVERLOAD_Z within BOOST_PP_REPEAT_FROM_TO.
  409. #define BOOST_PARAMETER_FUNCTION_FORWARD_OVERLOAD_Z(z, n, data) \
  410. BOOST_PP_IF( \
  411. n \
  412. , BOOST_PARAMETER_AUX_PP_BINARY_SEQ_FOR_EACH_Z \
  413. , BOOST_PARAMETER_FUNCTION_FORWARD_OVERLOAD_0_ARITY \
  414. )(z, n, (BOOST_PARAMETER_FUNCTION_FORWARD_OVERLOAD_R)(data))
  415. /**/
  416. #include <boost/preprocessor/repetition/repeat_from_to.hpp>
  417. // Helper macro for BOOST_PARAMETER_CONSTRUCTOR_OVERLOADS.
  418. #define BOOST_PARAMETER_CONSTRUCTOR_OVERLOADS_AUX(class_, base, range) \
  419. BOOST_PP_REPEAT_FROM_TO( \
  420. BOOST_PP_TUPLE_ELEM(2, 0, range) \
  421. , BOOST_PP_TUPLE_ELEM(2, 1, range) \
  422. , BOOST_PARAMETER_CONSTRUCTOR_OVERLOAD_Z \
  423. , (class_, base) \
  424. )
  425. /**/
  426. // Helper macro for BOOST_PARAMETER_FUNCTION_FORWARD_OVERLOADS.
  427. #define BOOST_PARAMETER_FUNCTION_FORWARD_OVERLOADS_AUX(nm, impl, r, is_m, c) \
  428. BOOST_PP_REPEAT_FROM_TO( \
  429. BOOST_PP_TUPLE_ELEM(2, 0, r) \
  430. , BOOST_PP_TUPLE_ELEM(2, 1, r) \
  431. , BOOST_PARAMETER_FUNCTION_FORWARD_OVERLOAD_Z \
  432. , ( \
  433. nm \
  434. , impl \
  435. , BOOST_PP_IF( \
  436. BOOST_PARAMETER_MEMBER_FUNCTION_IS_STATIC(impl) \
  437. , 0 \
  438. , is_m \
  439. ) \
  440. , c \
  441. ) \
  442. )
  443. /**/
  444. #include <boost/parameter/aux_/preprocessor/impl/arity_range.hpp>
  445. // Expands to the layer of forwarding functions for the constructor in the
  446. // specified class, whose arguments determine the range of arities.
  447. #define BOOST_PARAMETER_CONSTRUCTOR_OVERLOADS(class_, base, args) \
  448. BOOST_PARAMETER_CONSTRUCTOR_OVERLOADS_AUX( \
  449. class_ \
  450. , base \
  451. , BOOST_PARAMETER_ARITY_RANGE(args) \
  452. )
  453. /**/
  454. // Expands to the layer of forwarding functions for the function with the
  455. // specified name, whose arguments determine the range of arities.
  456. #define BOOST_PARAMETER_FUNCTION_FORWARD_OVERLOADS(name, impl, a, is_m, c) \
  457. BOOST_PARAMETER_FUNCTION_FORWARD_OVERLOADS_AUX( \
  458. name \
  459. , impl \
  460. , BOOST_PARAMETER_ARITY_RANGE(a) \
  461. , is_m \
  462. , c \
  463. )
  464. /**/
  465. #endif // BOOST_PARAMETER_HAS_PERFECT_FORWARDING
  466. #endif // include guard