diff --git a/include/boost/preprocessor/repetition/deduce_r.hpp b/include/boost/preprocessor/repetition/deduce_r.hpp index 43aef24..27fff7b 100644 --- a/include/boost/preprocessor/repetition/deduce_r.hpp +++ b/include/boost/preprocessor/repetition/deduce_r.hpp @@ -16,14 +16,15 @@ # # /* BOOST_PP_DEDUCE_R */ # +# include # include # include # include # # if BOOST_PP_LIMIT_FOR == 256 -# define BOOST_PP_DEDUCE_R() BOOST_PP_AUTO_REC(BOOST_PP_FOR_P, 256) +# define BOOST_PP_DEDUCE_R() BOOST_PP_DEC(BOOST_PP_AUTO_REC(BOOST_PP_FOR_P, 256)) # elif BOOST_PP_LIMIT_FOR == 512 -# define BOOST_PP_DEDUCE_R() BOOST_PP_AUTO_REC(BOOST_PP_FOR_P, 512) +# define BOOST_PP_DEDUCE_R() BOOST_PP_DEC(BOOST_PP_AUTO_REC(BOOST_PP_FOR_P, 512)) # else # error Incorrect value for the BOOST_PP_LIMIT_FOR limit # endif diff --git a/include/boost/preprocessor/repetition/detail/dmc/limits/for_256.hpp b/include/boost/preprocessor/repetition/detail/dmc/limits/for_256.hpp index 91a3952..b88daf7 100644 --- a/include/boost/preprocessor/repetition/detail/dmc/limits/for_256.hpp +++ b/include/boost/preprocessor/repetition/detail/dmc/limits/for_256.hpp @@ -14,6 +14,7 @@ # ifndef BOOST_PREPROCESSOR_REPETITION_DETAIL_DMC_FOR_256_HPP # define BOOST_PREPROCESSOR_REPETITION_DETAIL_DMC_FOR_256_HPP # +# define BOOST_PP_FOR_0(s, p, o, m) BOOST_PP_FOR_0_C(BOOST_PP_BOOL(p##(1, s)), s, p, o, m) # define BOOST_PP_FOR_1(s, p, o, m) BOOST_PP_FOR_1_C(BOOST_PP_BOOL(p##(2, s)), s, p, o, m) # define BOOST_PP_FOR_2(s, p, o, m) BOOST_PP_FOR_2_C(BOOST_PP_BOOL(p##(3, s)), s, p, o, m) # define BOOST_PP_FOR_3(s, p, o, m) BOOST_PP_FOR_3_C(BOOST_PP_BOOL(p##(4, s)), s, p, o, m) @@ -271,6 +272,7 @@ # define BOOST_PP_FOR_255(s, p, o, m) BOOST_PP_FOR_255_C(BOOST_PP_BOOL(p##(256, s)), s, p, o, m) # define BOOST_PP_FOR_256(s, p, o, m) BOOST_PP_FOR_256_C(BOOST_PP_BOOL(p##(257, s)), s, p, o, m) # +# define BOOST_PP_FOR_0_C(c, s, p, o, m) BOOST_PP_IIF(c, m, BOOST_PP_TUPLE_EAT_2)(1, s) BOOST_PP_IIF(c, BOOST_PP_FOR_1, BOOST_PP_TUPLE_EAT_4)(BOOST_PP_EXPR_IIF(c, o)(1, s), p, o, m) # define BOOST_PP_FOR_1_C(c, s, p, o, m) BOOST_PP_IIF(c, m, BOOST_PP_TUPLE_EAT_2)(2, s) BOOST_PP_IIF(c, BOOST_PP_FOR_2, BOOST_PP_TUPLE_EAT_4)(BOOST_PP_EXPR_IIF(c, o)(2, s), p, o, m) # define BOOST_PP_FOR_2_C(c, s, p, o, m) BOOST_PP_IIF(c, m, BOOST_PP_TUPLE_EAT_2)(3, s) BOOST_PP_IIF(c, BOOST_PP_FOR_3, BOOST_PP_TUPLE_EAT_4)(BOOST_PP_EXPR_IIF(c, o)(3, s), p, o, m) # define BOOST_PP_FOR_3_C(c, s, p, o, m) BOOST_PP_IIF(c, m, BOOST_PP_TUPLE_EAT_2)(4, s) BOOST_PP_IIF(c, BOOST_PP_FOR_4, BOOST_PP_TUPLE_EAT_4)(BOOST_PP_EXPR_IIF(c, o)(4, s), p, o, m) diff --git a/include/boost/preprocessor/repetition/detail/edg/limits/for_256.hpp b/include/boost/preprocessor/repetition/detail/edg/limits/for_256.hpp index 8101db3..cc72fe9 100644 --- a/include/boost/preprocessor/repetition/detail/edg/limits/for_256.hpp +++ b/include/boost/preprocessor/repetition/detail/edg/limits/for_256.hpp @@ -14,6 +14,7 @@ # ifndef BOOST_PREPROCESSOR_REPETITION_DETAIL_EDG_FOR_256_HPP # define BOOST_PREPROCESSOR_REPETITION_DETAIL_EDG_FOR_256_HPP # +# define BOOST_PP_FOR_0(s, p, o, m) BOOST_PP_FOR_0_I(s, p, o, m) # define BOOST_PP_FOR_1(s, p, o, m) BOOST_PP_FOR_1_I(s, p, o, m) # define BOOST_PP_FOR_2(s, p, o, m) BOOST_PP_FOR_2_I(s, p, o, m) # define BOOST_PP_FOR_3(s, p, o, m) BOOST_PP_FOR_3_I(s, p, o, m) @@ -271,6 +272,7 @@ # define BOOST_PP_FOR_255(s, p, o, m) BOOST_PP_FOR_255_I(s, p, o, m) # define BOOST_PP_FOR_256(s, p, o, m) BOOST_PP_FOR_256_I(s, p, o, m) # +# define BOOST_PP_FOR_0_I(s, p, o, m) BOOST_PP_IF(p(1, s), m, BOOST_PP_TUPLE_EAT_2)(1, s) BOOST_PP_IF(p(1, s), BOOST_PP_FOR_1, BOOST_PP_TUPLE_EAT_4)(o(1, s), p, o, m) # define BOOST_PP_FOR_1_I(s, p, o, m) BOOST_PP_IF(p(2, s), m, BOOST_PP_TUPLE_EAT_2)(2, s) BOOST_PP_IF(p(2, s), BOOST_PP_FOR_2, BOOST_PP_TUPLE_EAT_4)(o(2, s), p, o, m) # define BOOST_PP_FOR_2_I(s, p, o, m) BOOST_PP_IF(p(3, s), m, BOOST_PP_TUPLE_EAT_2)(3, s) BOOST_PP_IF(p(3, s), BOOST_PP_FOR_3, BOOST_PP_TUPLE_EAT_4)(o(3, s), p, o, m) # define BOOST_PP_FOR_3_I(s, p, o, m) BOOST_PP_IF(p(4, s), m, BOOST_PP_TUPLE_EAT_2)(4, s) BOOST_PP_IF(p(4, s), BOOST_PP_FOR_4, BOOST_PP_TUPLE_EAT_4)(o(4, s), p, o, m) diff --git a/include/boost/preprocessor/repetition/detail/limits/for_256.hpp b/include/boost/preprocessor/repetition/detail/limits/for_256.hpp index 54c261b..d3dde96 100644 --- a/include/boost/preprocessor/repetition/detail/limits/for_256.hpp +++ b/include/boost/preprocessor/repetition/detail/limits/for_256.hpp @@ -14,6 +14,7 @@ # ifndef BOOST_PREPROCESSOR_REPETITION_DETAIL_FOR_256_HPP # define BOOST_PREPROCESSOR_REPETITION_DETAIL_FOR_256_HPP # +# define BOOST_PP_FOR_0(s, p, o, m) BOOST_PP_FOR_0_C(BOOST_PP_BOOL(p(1, s)), s, p, o, m) # define BOOST_PP_FOR_1(s, p, o, m) BOOST_PP_FOR_1_C(BOOST_PP_BOOL(p(2, s)), s, p, o, m) # define BOOST_PP_FOR_2(s, p, o, m) BOOST_PP_FOR_2_C(BOOST_PP_BOOL(p(3, s)), s, p, o, m) # define BOOST_PP_FOR_3(s, p, o, m) BOOST_PP_FOR_3_C(BOOST_PP_BOOL(p(4, s)), s, p, o, m) @@ -271,6 +272,7 @@ # define BOOST_PP_FOR_255(s, p, o, m) BOOST_PP_FOR_255_C(BOOST_PP_BOOL(p(256, s)), s, p, o, m) # define BOOST_PP_FOR_256(s, p, o, m) BOOST_PP_FOR_256_C(BOOST_PP_BOOL(p(257, s)), s, p, o, m) # +# define BOOST_PP_FOR_0_C(c, s, p, o, m) BOOST_PP_IIF(c, m, BOOST_PP_TUPLE_EAT_2)(1, s) BOOST_PP_IIF(c, BOOST_PP_FOR_1, BOOST_PP_TUPLE_EAT_4)(BOOST_PP_EXPR_IIF(c, o)(1, s), p, o, m) # define BOOST_PP_FOR_1_C(c, s, p, o, m) BOOST_PP_IIF(c, m, BOOST_PP_TUPLE_EAT_2)(2, s) BOOST_PP_IIF(c, BOOST_PP_FOR_2, BOOST_PP_TUPLE_EAT_4)(BOOST_PP_EXPR_IIF(c, o)(2, s), p, o, m) # define BOOST_PP_FOR_2_C(c, s, p, o, m) BOOST_PP_IIF(c, m, BOOST_PP_TUPLE_EAT_2)(3, s) BOOST_PP_IIF(c, BOOST_PP_FOR_3, BOOST_PP_TUPLE_EAT_4)(BOOST_PP_EXPR_IIF(c, o)(3, s), p, o, m) # define BOOST_PP_FOR_3_C(c, s, p, o, m) BOOST_PP_IIF(c, m, BOOST_PP_TUPLE_EAT_2)(4, s) BOOST_PP_IIF(c, BOOST_PP_FOR_4, BOOST_PP_TUPLE_EAT_4)(BOOST_PP_EXPR_IIF(c, o)(4, s), p, o, m) diff --git a/include/boost/preprocessor/repetition/detail/msvc/limits/for_256.hpp b/include/boost/preprocessor/repetition/detail/msvc/limits/for_256.hpp index b3551eb..2c63524 100644 --- a/include/boost/preprocessor/repetition/detail/msvc/limits/for_256.hpp +++ b/include/boost/preprocessor/repetition/detail/msvc/limits/for_256.hpp @@ -14,6 +14,7 @@ # ifndef BOOST_PREPROCESSOR_REPETITION_DETAIL_MSVC_FOR_256_HPP # define BOOST_PREPROCESSOR_REPETITION_DETAIL_MSVC_FOR_256_HPP # +# define BOOST_PP_FOR_0(s, p, o, m) BOOST_PP_IF(p(1, s), m, BOOST_PP_TUPLE_EAT_2)(1, s) BOOST_PP_IF(p(1, s), BOOST_PP_FOR_1, BOOST_PP_TUPLE_EAT_4)(o(1, s), p, o, m) # define BOOST_PP_FOR_1(s, p, o, m) BOOST_PP_IF(p(2, s), m, BOOST_PP_TUPLE_EAT_2)(2, s) BOOST_PP_IF(p(2, s), BOOST_PP_FOR_2, BOOST_PP_TUPLE_EAT_4)(o(2, s), p, o, m) # define BOOST_PP_FOR_2(s, p, o, m) BOOST_PP_IF(p(3, s), m, BOOST_PP_TUPLE_EAT_2)(3, s) BOOST_PP_IF(p(3, s), BOOST_PP_FOR_3, BOOST_PP_TUPLE_EAT_4)(o(3, s), p, o, m) # define BOOST_PP_FOR_3(s, p, o, m) BOOST_PP_IF(p(4, s), m, BOOST_PP_TUPLE_EAT_2)(4, s) BOOST_PP_IF(p(4, s), BOOST_PP_FOR_4, BOOST_PP_TUPLE_EAT_4)(o(4, s), p, o, m) diff --git a/include/boost/preprocessor/repetition/for.hpp b/include/boost/preprocessor/repetition/for.hpp index 9e10e37..e818387 100644 --- a/include/boost/preprocessor/repetition/for.hpp +++ b/include/boost/preprocessor/repetition/for.hpp @@ -15,6 +15,7 @@ # ifndef BOOST_PREPROCESSOR_REPETITION_FOR_HPP # define BOOST_PREPROCESSOR_REPETITION_FOR_HPP # +# include # include # include # include @@ -29,14 +30,15 @@ # endif # # if BOOST_PP_LIMIT_FOR == 256 -# define BOOST_PP_FOR BOOST_PP_CAT(BOOST_PP_FOR_, BOOST_PP_AUTO_REC(BOOST_PP_FOR_P, 256)) +# define BOOST_PP_FOR BOOST_PP_CAT(BOOST_PP_FOR_, BOOST_PP_DEC(BOOST_PP_AUTO_REC(BOOST_PP_FOR_P, 256))) # elif BOOST_PP_LIMIT_FOR == 512 -# define BOOST_PP_FOR BOOST_PP_CAT(BOOST_PP_FOR_, BOOST_PP_AUTO_REC(BOOST_PP_FOR_P, 512)) +# define BOOST_PP_FOR BOOST_PP_CAT(BOOST_PP_FOR_, BOOST_PP_DEC(BOOST_PP_AUTO_REC(BOOST_PP_FOR_P, 512))) # else # error Incorrect value for the BOOST_PP_LIMIT_FOR limit # endif # -# define BOOST_PP_FOR_P(n) BOOST_PP_CAT(BOOST_PP_FOR_CHECK_, BOOST_PP_FOR_ ## n(1, BOOST_PP_FOR_SR_P, BOOST_PP_FOR_SR_O, BOOST_PP_FOR_SR_M)) +# define BOOST_PP_FOR_P(n) BOOST_PP_FOR_P_DEC(BOOST_PP_DEC(n)) +# define BOOST_PP_FOR_P_DEC(n) BOOST_PP_CAT(BOOST_PP_FOR_CHECK_, BOOST_PP_CAT(BOOST_PP_FOR_ , n)(1, BOOST_PP_FOR_SR_P, BOOST_PP_FOR_SR_O, BOOST_PP_FOR_SR_M)) # # define BOOST_PP_FOR_SR_P(r, s) s # define BOOST_PP_FOR_SR_O(r, s) 0 diff --git a/include/boost/preprocessor/repetition/limits/for_256.hpp b/include/boost/preprocessor/repetition/limits/for_256.hpp index b8559eb..5329772 100644 --- a/include/boost/preprocessor/repetition/limits/for_256.hpp +++ b/include/boost/preprocessor/repetition/limits/for_256.hpp @@ -14,6 +14,7 @@ # ifndef BOOST_PREPROCESSOR_REPETITION_FOR_256_HPP # define BOOST_PREPROCESSOR_REPETITION_FOR_256_HPP # +# define BOOST_PP_FOR_CHECK_BOOST_PP_FOR_0(s, p, o, m) 0 # define BOOST_PP_FOR_CHECK_BOOST_PP_FOR_1(s, p, o, m) 0 # define BOOST_PP_FOR_CHECK_BOOST_PP_FOR_2(s, p, o, m) 0 # define BOOST_PP_FOR_CHECK_BOOST_PP_FOR_3(s, p, o, m) 0