arity_range.hpp 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. // Copyright Daniel Wallin 2006.
  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_AUX_PREPROCESSOR_IMPL_ARITY_RANGE_HPP
  6. #define BOOST_PARAMETER_AUX_PREPROCESSOR_IMPL_ARITY_RANGE_HPP
  7. // Helper macros for BOOST_PARAMETER_ARITY_RANGE.
  8. #define BOOST_PARAMETER_ARITY_RANGE_M_optional(state) state
  9. #define BOOST_PARAMETER_ARITY_RANGE_M_deduced_optional(state) state
  10. #include <boost/preprocessor/arithmetic/inc.hpp>
  11. #define BOOST_PARAMETER_ARITY_RANGE_M_required(state) BOOST_PP_INC(state)
  12. #define BOOST_PARAMETER_ARITY_RANGE_M_deduced_required(state) \
  13. BOOST_PP_INC(state)
  14. /**/
  15. #include <boost/parameter/aux_/preprocessor/impl/argument_specs.hpp>
  16. #include <boost/preprocessor/cat.hpp>
  17. #define BOOST_PARAMETER_ARITY_RANGE_M(s, state, x) \
  18. BOOST_PP_CAT( \
  19. BOOST_PARAMETER_ARITY_RANGE_M_ \
  20. , BOOST_PARAMETER_FN_ARG_QUALIFIER(x) \
  21. )(state)
  22. /**/
  23. #include <boost/preprocessor/seq/fold_left.hpp>
  24. #include <boost/preprocessor/seq/size.hpp>
  25. // Calculates [begin, end) arity range.
  26. #define BOOST_PARAMETER_ARITY_RANGE(args) \
  27. ( \
  28. BOOST_PP_SEQ_FOLD_LEFT(BOOST_PARAMETER_ARITY_RANGE_M, 0, args) \
  29. , BOOST_PP_INC(BOOST_PP_SEQ_SIZE(args)) \
  30. )
  31. /**/
  32. #endif // include guard