parameters.hpp 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600
  1. // Copyright David Abrahams, Daniel Wallin 2003.
  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_PARAMETERS_031014_HPP
  7. #define BOOST_PARAMETERS_031014_HPP
  8. #include <boost/parameter/config.hpp>
  9. #if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
  10. namespace boost { namespace parameter { namespace aux {
  11. // The make_arg_list<> metafunction produces a reversed arg_list,
  12. // so pass the arguments to the arg_list constructor reversed in turn.
  13. template <typename ArgList, typename ...Args>
  14. struct arg_list_factory;
  15. }}} // namespace boost::parameter::aux
  16. #include <boost/parameter/aux_/arg_list.hpp>
  17. #include <utility>
  18. #if defined(BOOST_PARAMETER_CAN_USE_MP11)
  19. #include <boost/mp11/utility.hpp>
  20. #include <type_traits>
  21. #else
  22. #include <boost/mpl/if.hpp>
  23. #include <boost/type_traits/is_same.hpp>
  24. #endif
  25. namespace boost { namespace parameter { namespace aux {
  26. // TODO: Reduce template code bloat. -- Cromwell D. Enage
  27. template <typename ArgList>
  28. struct arg_list_factory<ArgList>
  29. {
  30. template <typename ...ReversedArgs>
  31. static inline BOOST_CONSTEXPR ArgList
  32. reverse(ReversedArgs&&... reversed_args)
  33. {
  34. return ArgList(
  35. #if defined(BOOST_PARAMETER_CAN_USE_MP11)
  36. ::boost::mp11::mp_if<
  37. ::std::is_same<
  38. #else
  39. typename ::boost::mpl::if_<
  40. ::boost::is_same<
  41. #endif
  42. typename ArgList::tagged_arg::value_type
  43. , ::boost::parameter::void_
  44. >
  45. , ::boost::parameter::aux::value_type_is_void
  46. , ::boost::parameter::aux::value_type_is_not_void
  47. #if defined(BOOST_PARAMETER_CAN_USE_MP11)
  48. >()
  49. #else
  50. >::type()
  51. #endif
  52. , ::std::forward<ReversedArgs>(reversed_args)...
  53. );
  54. }
  55. };
  56. template <typename ArgList, typename A0, typename ...Args>
  57. struct arg_list_factory<ArgList,A0,Args...>
  58. {
  59. template <typename ...ReversedArgs>
  60. static inline BOOST_CONSTEXPR ArgList
  61. reverse(A0&& a0, Args&&... args, ReversedArgs&&... reversed_args)
  62. {
  63. return ::boost::parameter::aux
  64. ::arg_list_factory<ArgList,Args...>::reverse(
  65. ::std::forward<Args>(args)...
  66. , ::std::forward<A0>(a0)
  67. , ::std::forward<ReversedArgs>(reversed_args)...
  68. );
  69. }
  70. };
  71. }}} // namespace boost::parameter::aux
  72. #include <boost/parameter/aux_/void.hpp>
  73. #include <boost/parameter/aux_/pack/make_arg_list.hpp>
  74. #include <boost/parameter/aux_/pack/make_parameter_spec_items.hpp>
  75. #include <boost/parameter/aux_/pack/tag_keyword_arg.hpp>
  76. #include <boost/parameter/aux_/pack/tag_template_keyword_arg.hpp>
  77. #if defined(BOOST_PARAMETER_CAN_USE_MP11)
  78. #include <boost/mp11/integral.hpp>
  79. #include <boost/mp11/list.hpp>
  80. #else
  81. #include <boost/mpl/bool.hpp>
  82. #include <boost/mpl/pair.hpp>
  83. #include <boost/mpl/identity.hpp>
  84. #endif
  85. #if !defined(BOOST_PARAMETER_VARIADIC_MPL_SEQUENCE)
  86. #if defined(BOOST_PARAMETER_CAN_USE_MP11)
  87. //#include <boost/mp11/mpl.hpp>
  88. #define BOOST_PARAMETER_VARIADIC_MPL_SEQUENCE ::boost::mp11::mp_list
  89. #else
  90. #include <boost/fusion/container/list/list_fwd.hpp>
  91. // Newer versions of MSVC fail on the evaluate_category and
  92. // preprocessor_eval_category test programs when parameters uses
  93. // boost::fusion::list.
  94. // -- Cromwell D. Enage
  95. #if defined(BOOST_FUSION_HAS_VARIADIC_LIST) && ( \
  96. !defined(BOOST_MSVC) || (BOOST_MSVC < 1800) \
  97. )
  98. #include <boost/fusion/container/list.hpp>
  99. #include <boost/fusion/mpl.hpp>
  100. #define BOOST_PARAMETER_VARIADIC_MPL_SEQUENCE ::boost::fusion::list
  101. #else
  102. #include <boost/fusion/container/deque/deque_fwd.hpp>
  103. #if defined(BOOST_FUSION_HAS_VARIADIC_DEQUE)
  104. #include <boost/fusion/container/deque.hpp>
  105. #include <boost/fusion/mpl.hpp>
  106. #define BOOST_PARAMETER_VARIADIC_MPL_SEQUENCE ::boost::fusion::deque
  107. #else
  108. #include <boost/mpl/vector.hpp>
  109. #define BOOST_PARAMETER_VARIADIC_MPL_SEQUENCE ::boost::mpl::vector
  110. #endif // BOOST_FUSION_HAS_VARIADIC_DEQUE
  111. #endif // BOOST_FUSION_HAS_VARIADIC_LIST
  112. #endif // BOOST_PARAMETER_CAN_USE_MP11
  113. #endif // BOOST_PARAMETER_VARIADIC_MPL_SEQUENCE
  114. namespace boost { namespace parameter {
  115. template <typename ...Spec>
  116. struct parameters
  117. {
  118. typedef BOOST_PARAMETER_VARIADIC_MPL_SEQUENCE<Spec...> parameter_spec;
  119. typedef typename ::boost::parameter::aux
  120. ::make_deduced_list<parameter_spec>::type deduced_list;
  121. // If the elements of NamedList match the criteria of overload
  122. // resolution, returns a type which can be constructed from
  123. // parameters. Otherwise, this is not a valid metafunction
  124. // (no nested ::type).
  125. template <typename ArgumentPackAndError>
  126. struct match_base
  127. #if !defined(BOOST_PARAMETER_CAN_USE_MP11)
  128. : ::boost::mpl::if_<
  129. typename ::boost::parameter::aux::match_parameters_base_cond<
  130. ArgumentPackAndError
  131. , parameter_spec
  132. >::type
  133. , ::boost::mpl::identity<
  134. ::boost::parameter::parameters<Spec...>
  135. >
  136. , ::boost::parameter::void_
  137. >
  138. #endif
  139. {
  140. #if defined(BOOST_PARAMETER_CAN_USE_MP11)
  141. using type = ::boost::mp11::mp_if<
  142. typename ::boost::parameter::aux::match_parameters_base_cond<
  143. ArgumentPackAndError
  144. , parameter_spec
  145. >::type
  146. , ::boost::mp11::mp_identity<
  147. ::boost::parameter::parameters<Spec...>
  148. >
  149. , ::boost::parameter::void_
  150. >;
  151. #endif
  152. };
  153. // Specializations are to be used as an optional argument
  154. // to eliminate overloads via SFINAE.
  155. template <typename ...Args>
  156. struct match
  157. : ::boost::parameter::parameters<Spec...>
  158. ::BOOST_NESTED_TEMPLATE match_base<
  159. typename ::boost::parameter::aux::make_arg_list<
  160. typename ::boost::parameter::aux
  161. ::make_parameter_spec_items<parameter_spec,Args...>::type
  162. , deduced_list
  163. , ::boost::parameter::aux::tag_keyword_arg
  164. // Don't emit errors when doing SFINAE.
  165. #if defined(BOOST_PARAMETER_CAN_USE_MP11)
  166. , ::boost::mp11::mp_false
  167. #else
  168. , ::boost::mpl::false_
  169. #endif
  170. >::type
  171. >::type
  172. {
  173. };
  174. // Metafunction that returns an ArgumentPack.
  175. template <typename ...Args>
  176. struct bind
  177. #if !defined(BOOST_PARAMETER_CAN_USE_MP11)
  178. : ::boost::mpl::first<
  179. typename ::boost::parameter::aux::make_arg_list<
  180. typename ::boost::parameter::aux
  181. ::make_parameter_spec_items<parameter_spec,Args...>::type
  182. , deduced_list
  183. , ::boost::parameter::aux::tag_template_keyword_arg
  184. >::type
  185. >
  186. #endif
  187. {
  188. #if defined(BOOST_PARAMETER_CAN_USE_MP11)
  189. using type = ::boost::mp11::mp_at_c<
  190. typename ::boost::parameter::aux::make_arg_list<
  191. typename ::boost::parameter::aux
  192. ::make_parameter_spec_items<parameter_spec,Args...>::type
  193. , deduced_list
  194. , ::boost::parameter::aux::tag_template_keyword_arg
  195. >::type
  196. , 0
  197. >;
  198. #endif
  199. };
  200. // The function call operator is used to build an arg_list that
  201. // labels the positional parameters and maintains whatever other
  202. // tags may have been specified by the caller.
  203. inline ::boost::parameter::aux::empty_arg_list operator()() const
  204. {
  205. return ::boost::parameter::aux::empty_arg_list();
  206. }
  207. template <typename A0, typename ...Args>
  208. #if defined(BOOST_PARAMETER_CAN_USE_MP11)
  209. inline ::boost::mp11::mp_at_c<
  210. #else
  211. inline typename ::boost::mpl::first<
  212. #endif
  213. typename ::boost::parameter::aux::make_arg_list<
  214. typename ::boost::parameter::aux
  215. ::make_parameter_spec_items<parameter_spec,A0,Args...>::type
  216. , deduced_list
  217. , ::boost::parameter::aux::tag_keyword_arg
  218. >::type
  219. #if defined(BOOST_PARAMETER_CAN_USE_MP11)
  220. , 0
  221. >
  222. #else
  223. >::type
  224. #endif
  225. operator()(A0&& a0, Args&& ...args) const
  226. {
  227. typedef typename ::boost::parameter::aux::make_arg_list<
  228. typename ::boost::parameter::aux
  229. ::make_parameter_spec_items<parameter_spec,A0,Args...>::type
  230. , deduced_list
  231. , ::boost::parameter::aux::tag_keyword_arg
  232. >::type list_error_pair;
  233. #if defined(BOOST_PARAMETER_CAN_USE_MP11)
  234. using result_type = ::boost::mp11::mp_at_c<list_error_pair,0>;
  235. using error = ::boost::mp11::mp_at_c<list_error_pair,1>;
  236. #else
  237. typedef typename ::boost::mpl
  238. ::first<list_error_pair>::type result_type;
  239. typedef typename ::boost::mpl
  240. ::second<list_error_pair>::type error;
  241. #endif
  242. error();
  243. return ::boost::parameter::aux
  244. ::arg_list_factory<result_type,A0,Args...>::reverse(
  245. ::std::forward<A0>(a0)
  246. , ::std::forward<Args>(args)...
  247. );
  248. }
  249. };
  250. }} // namespace boost::parameter
  251. #else // !defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
  252. #include <boost/parameter/aux_/void.hpp>
  253. #include <boost/parameter/aux_/arg_list.hpp>
  254. #include <boost/parameter/aux_/pack/make_arg_list.hpp>
  255. #include <boost/parameter/aux_/pack/make_items.hpp>
  256. #include <boost/parameter/aux_/pack/make_deduced_items.hpp>
  257. #include <boost/parameter/aux_/pack/tag_template_keyword_arg.hpp>
  258. #include <boost/parameter/aux_/preprocessor/binary_seq_for_each.hpp>
  259. #include <boost/preprocessor/arithmetic/inc.hpp>
  260. #include <boost/preprocessor/repetition/enum_shifted.hpp>
  261. #include <boost/preprocessor/repetition/repeat.hpp>
  262. #include <boost/preprocessor/selection/min.hpp>
  263. #if ( \
  264. BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY < \
  265. BOOST_PARAMETER_MAX_ARITY \
  266. )
  267. #include <boost/parameter/aux_/pack/tag_keyword_arg_ref.hpp>
  268. #include <boost/mpl/pair.hpp>
  269. #include <boost/preprocessor/arithmetic/dec.hpp>
  270. #include <boost/preprocessor/arithmetic/sub.hpp>
  271. #include <boost/preprocessor/facilities/intercept.hpp>
  272. #include <boost/preprocessor/iteration/iterate.hpp>
  273. #include <boost/preprocessor/repetition/enum.hpp>
  274. #include <boost/preprocessor/repetition/enum_trailing_params.hpp>
  275. #endif
  276. #if !defined(BOOST_NO_SFINAE) && \
  277. !BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x592))
  278. #include <boost/parameter/aux_/pack/tag_keyword_arg.hpp>
  279. #include <boost/mpl/bool.hpp>
  280. #include <boost/mpl/if.hpp>
  281. #include <boost/mpl/identity.hpp>
  282. #include <boost/type_traits/is_same.hpp>
  283. #endif
  284. #if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x564))
  285. #include <boost/preprocessor/repetition/enum_params.hpp>
  286. #else
  287. #include <boost/preprocessor/repetition/enum_binary_params.hpp>
  288. #endif
  289. #include <boost/parameter/aux_/preprocessor/no_perfect_forwarding_begin.hpp>
  290. namespace boost { namespace parameter {
  291. template <
  292. typename PS0
  293. , BOOST_PP_ENUM_SHIFTED(
  294. BOOST_PARAMETER_MAX_ARITY
  295. , BOOST_PARAMETER_template_args
  296. , PS
  297. )
  298. >
  299. struct parameters
  300. {
  301. typedef typename BOOST_PARAMETER_build_deduced_list(
  302. BOOST_PARAMETER_MAX_ARITY
  303. , ::boost::parameter::aux::make_deduced_items
  304. , PS
  305. )::type deduced_list;
  306. // If the elements of NamedList match the criteria of overload
  307. // resolution, returns a type which can be constructed from
  308. // parameters. Otherwise, this is not a valid metafunction
  309. // (no nested ::type).
  310. #if !defined(BOOST_NO_SFINAE) && \
  311. !BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x592))
  312. // If NamedList satisfies the PS0, PS1, ..., this is a metafunction
  313. // returning parameters. Otherwise it has no nested ::type.
  314. template <typename ArgumentPackAndError>
  315. struct match_base
  316. : ::boost::mpl::if_<
  317. // ::boost::mpl::and_<
  318. // aux::satisfies_requirements_of<NamedList,PS0>
  319. // , ::boost::mpl::and_<
  320. // aux::satisfies_requirements_of<NamedList,PS1>...
  321. // ..., ::boost::mpl::true_
  322. // ...> >
  323. typename BOOST_PP_REPEAT(
  324. BOOST_PARAMETER_MAX_ARITY
  325. , BOOST_PARAMETER_satisfies_begin
  326. , PS
  327. )
  328. ::boost::is_same<
  329. typename ::boost::mpl
  330. ::second<ArgumentPackAndError>::type
  331. , ::boost::parameter::void_
  332. >
  333. BOOST_PP_REPEAT(
  334. BOOST_PARAMETER_MAX_ARITY
  335. , BOOST_PARAMETER_satisfies_end
  336. , ::boost::mpl::false_
  337. )::type
  338. , ::boost::mpl::identity<
  339. ::boost::parameter::parameters<
  340. BOOST_PP_ENUM_PARAMS(BOOST_PARAMETER_MAX_ARITY, PS)
  341. >
  342. >
  343. , ::boost::parameter::void_
  344. >
  345. {
  346. };
  347. #endif // SFINAE enabled, not Borland
  348. // Specializations are to be used as an optional argument
  349. // to eliminate overloads via SFINAE.
  350. template <
  351. #if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x564))
  352. // Borland simply can't handle default arguments in member
  353. // class templates. People wishing to write portable code can
  354. // explicitly specify BOOST_PARAMETER_MAX_ARITY arguments.
  355. BOOST_PP_ENUM_PARAMS(BOOST_PARAMETER_MAX_ARITY, typename A)
  356. #else
  357. BOOST_PP_ENUM_BINARY_PARAMS(
  358. BOOST_PARAMETER_MAX_ARITY
  359. , typename A
  360. , = ::boost::parameter::void_ BOOST_PP_INTERCEPT
  361. )
  362. #endif
  363. >
  364. struct match
  365. #if !defined(BOOST_NO_SFINAE) && \
  366. !BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x592))
  367. : ::boost::parameter::parameters<
  368. BOOST_PP_ENUM_PARAMS(BOOST_PARAMETER_MAX_ARITY, PS)
  369. >::BOOST_NESTED_TEMPLATE match_base<
  370. typename ::boost::parameter::aux::make_arg_list<
  371. typename BOOST_PARAMETER_build_arg_list(
  372. BOOST_PARAMETER_MAX_ARITY
  373. , ::boost::parameter::aux::make_items
  374. , PS
  375. , A
  376. )::type
  377. , deduced_list
  378. , ::boost::parameter::aux::tag_keyword_arg
  379. // Don't emit errors when doing SFINAE.
  380. , ::boost::mpl::false_
  381. >::type
  382. >::type
  383. {
  384. };
  385. #else
  386. {
  387. typedef ::boost::parameter::parameters<
  388. BOOST_PP_ENUM_PARAMS(BOOST_PARAMETER_MAX_ARITY, PS)
  389. > type;
  390. };
  391. #endif // SFINAE enabled, not Borland
  392. // Metafunction that returns an ArgumentPack.
  393. // TODO, bind has to instantiate the error type in the result
  394. // of make_arg_list.
  395. template <
  396. #if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x564))
  397. // Borland simply can't handle default arguments in member
  398. // class templates. People wishing to write portable code can
  399. // explicitly specify BOOST_PARAMETER_MAX_ARITY arguments.
  400. BOOST_PP_ENUM_PARAMS(BOOST_PARAMETER_MAX_ARITY, typename A)
  401. #else
  402. BOOST_PP_ENUM_BINARY_PARAMS(
  403. BOOST_PARAMETER_MAX_ARITY
  404. , typename A
  405. , = ::boost::parameter::void_ BOOST_PP_INTERCEPT
  406. )
  407. #endif
  408. >
  409. struct bind
  410. {
  411. typedef typename ::boost::parameter::aux::make_arg_list<
  412. typename BOOST_PARAMETER_build_arg_list(
  413. BOOST_PARAMETER_MAX_ARITY
  414. , ::boost::parameter::aux::make_items
  415. , PS
  416. , A
  417. )::type
  418. , deduced_list
  419. , ::boost::parameter::aux::tag_template_keyword_arg
  420. >::type result;
  421. typedef typename ::boost::mpl::first<result>::type type;
  422. };
  423. BOOST_PP_REPEAT(
  424. BOOST_PARAMETER_MAX_ARITY
  425. , BOOST_PARAMETER_forward_typedef
  426. , (PS)(parameter_spec)
  427. )
  428. // The function call operator is used to build an arg_list that
  429. // labels the positional parameters and maintains whatever other
  430. // tags may have been specified by the caller.
  431. //
  432. // !!!NOTE!!!
  433. //
  434. // The make_arg_list<> metafunction produces a reversed arg_list,
  435. // so pass the arguments to the arg_list constructor reversed in turn.
  436. inline ::boost::parameter::aux::empty_arg_list operator()() const
  437. {
  438. return ::boost::parameter::aux::empty_arg_list();
  439. }
  440. #if (0 < BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY)
  441. BOOST_PP_REPEAT(
  442. BOOST_PP_MIN(
  443. BOOST_PP_INC(BOOST_PARAMETER_MAX_ARITY)
  444. , BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY
  445. )
  446. , BOOST_PARAMETER_AUX_PP_BINARY_SEQ_FOR_EACH_Z
  447. , (BOOST_PARAMETER_function_call_op_overload_R)(_)
  448. )
  449. #if ( \
  450. BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY < \
  451. BOOST_PARAMETER_MAX_ARITY \
  452. )
  453. #define BOOST_PP_ITERATION_PARAMS_1 \
  454. (3,( \
  455. BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY \
  456. , BOOST_PARAMETER_MAX_ARITY \
  457. , <boost/parameter/aux_/preprocessor/overloads.hpp> \
  458. ))
  459. #include BOOST_PP_ITERATE()
  460. #endif
  461. #else // (0 == BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY)
  462. template <typename A0>
  463. inline typename ::boost::mpl::first<
  464. typename ::boost::parameter::aux::make_arg_list<
  465. ::boost::parameter::aux::item<
  466. PS0,A0
  467. >
  468. , deduced_list
  469. , ::boost::parameter::aux::tag_keyword_arg_ref
  470. >::type
  471. >::type
  472. operator()(A0& a0) const
  473. {
  474. typedef typename ::boost::parameter::aux::make_arg_list<
  475. ::boost::parameter::aux::item<
  476. PS0,A0
  477. >
  478. , deduced_list
  479. , ::boost::parameter::aux::tag_keyword_arg_ref
  480. >::type result;
  481. typedef typename ::boost::mpl::first<result>::type result_type;
  482. typedef typename ::boost::mpl::second<result>::type error;
  483. error();
  484. return result_type(
  485. a0
  486. // , void_(), void_(), void_() ...
  487. BOOST_PP_ENUM_TRAILING_PARAMS(
  488. BOOST_PP_SUB(BOOST_PARAMETER_COMPOSE_MAX_ARITY, 1)
  489. , ::boost::parameter::aux::void_reference() BOOST_PP_INTERCEPT
  490. )
  491. );
  492. }
  493. template <typename A0, typename A1>
  494. inline typename ::boost::mpl::first<
  495. typename ::boost::parameter::aux::make_arg_list<
  496. ::boost::parameter::aux::item<
  497. PS0,A0
  498. , ::boost::parameter::aux::item<
  499. PS1,A1
  500. >
  501. >
  502. , deduced_list
  503. , ::boost::parameter::aux::tag_keyword_arg_ref
  504. >::type
  505. >::type
  506. operator()(A0& a0, A1& a1) const
  507. {
  508. typedef typename ::boost::parameter::aux::make_arg_list<
  509. ::boost::parameter::aux::item<
  510. PS0,A0
  511. , ::boost::parameter::aux::item<
  512. PS1,A1
  513. >
  514. >
  515. , deduced_list
  516. , ::boost::parameter::aux::tag_keyword_arg
  517. >::type result;
  518. typedef typename ::boost::mpl::first<result>::type result_type;
  519. typedef typename ::boost::mpl::second<result>::type error;
  520. error();
  521. return result_type(
  522. a1
  523. , a0
  524. // , void_(), void_() ...
  525. BOOST_PP_ENUM_TRAILING_PARAMS(
  526. BOOST_PP_SUB(BOOST_PARAMETER_COMPOSE_MAX_ARITY, 2)
  527. , ::boost::parameter::aux::void_reference() BOOST_PP_INTERCEPT
  528. )
  529. );
  530. }
  531. #if (2 < BOOST_PARAMETER_MAX_ARITY)
  532. // Higher arities are handled by the preprocessor
  533. #define BOOST_PP_ITERATION_PARAMS_1 \
  534. (3,( \
  535. 3 \
  536. , BOOST_PARAMETER_MAX_ARITY \
  537. , <boost/parameter/aux_/preprocessor/overloads.hpp> \
  538. ))
  539. #include BOOST_PP_ITERATE()
  540. #endif
  541. #endif // exponential overloads
  542. };
  543. }} // namespace boost::parameter
  544. #include <boost/parameter/aux_/preprocessor/no_perfect_forwarding_end.hpp>
  545. #endif // BOOST_PARAMETER_HAS_PERFECT_FORWARDING
  546. #endif // include guard