are_tagged_arguments.hpp 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. // Copyright Cromwell D. Enage 2018.
  2. // Distributed under the Boost Software License, Version 1.0.
  3. // (See accompanying file LICENSE_1_0.txt or copy at
  4. // http://www.boost.org/LICENSE_1_0.txt)
  5. #ifndef BOOST_PARAMETER_ARE_TAGGED_ARGUMENTS_HPP
  6. #define BOOST_PARAMETER_ARE_TAGGED_ARGUMENTS_HPP
  7. #include <boost/parameter/config.hpp>
  8. #if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
  9. namespace boost { namespace parameter {
  10. template <typename TaggedArg0, typename ...TaggedArgs>
  11. struct are_tagged_arguments;
  12. }} // namespace boost::parameter
  13. #include <boost/parameter/aux_/is_tagged_argument.hpp>
  14. namespace boost { namespace parameter {
  15. template <typename TaggedArg0>
  16. struct are_tagged_arguments<TaggedArg0>
  17. : ::boost::parameter::aux::is_tagged_argument<TaggedArg0>
  18. {
  19. };
  20. }} // namespace boost::parameter
  21. #include <boost/mpl/bool.hpp>
  22. #include <boost/mpl/if.hpp>
  23. namespace boost { namespace parameter {
  24. template <typename TaggedArg0, typename ...TaggedArgs>
  25. struct are_tagged_arguments
  26. : ::boost::mpl::if_<
  27. ::boost::parameter::aux::is_tagged_argument<TaggedArg0>
  28. , ::boost::parameter::are_tagged_arguments<TaggedArgs...>
  29. , ::boost::mpl::false_
  30. >::type
  31. {
  32. };
  33. }} // namespace boost::parameter
  34. #else // !defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
  35. #define BOOST_PARAMETER_ARE_TAGGED_ARGUMENTS_END_Z(z, n, false_t) , false_t>
  36. /**/
  37. #include <boost/parameter/aux_/is_tagged_argument.hpp>
  38. #include <boost/mpl/eval_if.hpp>
  39. #include <boost/preprocessor/cat.hpp>
  40. #define BOOST_PARAMETER_ARE_TAGGED_ARGUMENTS_BEGIN_Z(z, n, prefix) \
  41. ::boost::mpl::eval_if< \
  42. ::boost::parameter::aux::is_tagged_argument<BOOST_PP_CAT(prefix, n)>,
  43. /**/
  44. #include <boost/parameter/aux_/void.hpp>
  45. #include <boost/mpl/bool.hpp>
  46. #include <boost/preprocessor/arithmetic/sub.hpp>
  47. #include <boost/preprocessor/facilities/intercept.hpp>
  48. #include <boost/preprocessor/repetition/repeat.hpp>
  49. #include <boost/preprocessor/repetition/enum_params.hpp>
  50. #include <boost/preprocessor/repetition/enum_trailing_params.hpp>
  51. #define BOOST_PARAMETER_ARE_TAGGED_ARGUMENTS_OVERLOADS_Z(z, n, prefix) \
  52. template <BOOST_PP_ENUM_PARAMS_Z(z, n, typename prefix)> \
  53. struct are_tagged_arguments< \
  54. BOOST_PP_ENUM_PARAMS_Z(z, n, prefix) \
  55. BOOST_PP_ENUM_TRAILING_PARAMS_Z( \
  56. z \
  57. , BOOST_PP_SUB(BOOST_PARAMETER_COMPOSE_MAX_ARITY, n) \
  58. , ::boost::parameter::void_ BOOST_PP_INTERCEPT \
  59. ) \
  60. > : BOOST_PP_CAT(BOOST_PP_REPEAT_, z)( \
  61. n \
  62. , BOOST_PARAMETER_ARE_TAGGED_ARGUMENTS_BEGIN_Z \
  63. , prefix \
  64. ) \
  65. ::boost::mpl::true_ \
  66. BOOST_PP_CAT(BOOST_PP_REPEAT_, z)( \
  67. n \
  68. , BOOST_PARAMETER_ARE_TAGGED_ARGUMENTS_END_Z \
  69. , ::boost::mpl::false_ \
  70. )::type \
  71. { \
  72. };
  73. /**/
  74. #include <boost/preprocessor/arithmetic/inc.hpp>
  75. #include <boost/preprocessor/repetition/enum_binary_params.hpp>
  76. namespace boost { namespace parameter {
  77. template <
  78. BOOST_PP_ENUM_BINARY_PARAMS(
  79. BOOST_PP_INC(BOOST_PARAMETER_COMPOSE_MAX_ARITY)
  80. , typename TaggedArg
  81. , = ::boost::parameter::void_ BOOST_PP_INTERCEPT
  82. )
  83. >
  84. struct are_tagged_arguments;
  85. }} // namespace boost::parameter
  86. #include <boost/preprocessor/repetition/repeat_from_to.hpp>
  87. namespace boost { namespace parameter {
  88. BOOST_PP_REPEAT_FROM_TO(
  89. 1
  90. , BOOST_PP_INC(BOOST_PARAMETER_COMPOSE_MAX_ARITY)
  91. , BOOST_PARAMETER_ARE_TAGGED_ARGUMENTS_OVERLOADS_Z
  92. , TaggedArg
  93. )
  94. }} // namespace boost::parameter
  95. #undef BOOST_PARAMETER_ARE_TAGGED_ARGUMENTS_OVERLOADS_Z
  96. #undef BOOST_PARAMETER_ARE_TAGGED_ARGUMENTS_BEGIN_Z
  97. #undef BOOST_PARAMETER_ARE_TAGGED_ARGUMENTS_END_Z
  98. #endif // BOOST_PARAMETER_HAS_PERFECT_FORWARDING
  99. #endif // include guard