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