argument_pack.hpp 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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_PP_IMPL_ARGUMENT_PACK_HPP
  7. #define BOOST_PARAMETER_AUX_PP_IMPL_ARGUMENT_PACK_HPP
  8. #include <boost/parameter/aux_/pack/tag_keyword_arg.hpp>
  9. #include <boost/parameter/aux_/pack/make_arg_list.hpp>
  10. #include <boost/parameter/config.hpp>
  11. #if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
  12. #include <boost/parameter/aux_/pack/make_parameter_spec_items.hpp>
  13. #if defined(BOOST_PARAMETER_CAN_USE_MP11)
  14. #include <boost/mp11/integral.hpp>
  15. #include <boost/mp11/list.hpp>
  16. #else
  17. #include <boost/mpl/bool.hpp>
  18. #include <boost/mpl/pair.hpp>
  19. #endif
  20. namespace boost { namespace parameter { namespace aux {
  21. template <typename Parameters, typename ...Args>
  22. struct argument_pack
  23. {
  24. typedef typename ::boost::parameter::aux::make_arg_list<
  25. typename ::boost::parameter::aux::make_parameter_spec_items<
  26. typename Parameters::parameter_spec
  27. , Args...
  28. >::type
  29. , typename Parameters::deduced_list
  30. , ::boost::parameter::aux::tag_keyword_arg
  31. #if defined(BOOST_PARAMETER_CAN_USE_MP11)
  32. , ::boost::mp11::mp_false
  33. #else
  34. , ::boost::mpl::false_
  35. #endif
  36. >::type result;
  37. #if defined(BOOST_PARAMETER_CAN_USE_MP11)
  38. using type = ::boost::mp11::mp_at_c<result,0>;
  39. #else
  40. typedef typename ::boost::mpl::first<result>::type type;
  41. #endif
  42. };
  43. }}} // namespace boost::parameter::aux
  44. #else // !defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
  45. #include <boost/parameter/aux_/void.hpp>
  46. #include <boost/parameter/aux_/pack/make_items.hpp>
  47. #include <boost/parameter/aux_/preprocessor/no_perfect_forwarding_begin.hpp>
  48. #include <boost/preprocessor/facilities/intercept.hpp>
  49. #include <boost/preprocessor/repetition/enum_trailing_binary_params.hpp>
  50. #include <boost/mpl/bool.hpp>
  51. #include <boost/mpl/pair.hpp>
  52. namespace boost { namespace parameter { namespace aux {
  53. template <
  54. typename Parameters
  55. BOOST_PP_ENUM_TRAILING_BINARY_PARAMS(
  56. BOOST_PARAMETER_MAX_ARITY
  57. , typename A
  58. , = ::boost::parameter::void_ BOOST_PP_INTERCEPT
  59. )
  60. >
  61. struct argument_pack
  62. {
  63. typedef typename ::boost::parameter::aux::make_arg_list<
  64. typename BOOST_PARAMETER_build_arg_list(
  65. BOOST_PARAMETER_MAX_ARITY
  66. , ::boost::parameter::aux::make_items
  67. , typename Parameters::parameter_spec
  68. , A
  69. )::type
  70. , typename Parameters::deduced_list
  71. , ::boost::parameter::aux::tag_keyword_arg
  72. , ::boost::mpl::false_
  73. >::type result;
  74. typedef typename ::boost::mpl::first<result>::type type;
  75. };
  76. }}} // namespace boost::parameter::aux
  77. #include <boost/parameter/aux_/preprocessor/no_perfect_forwarding_end.hpp>
  78. #endif // BOOST_PARAMETER_HAS_PERFECT_FORWARDING
  79. #endif // include guard