Maximum for loop

This commit is contained in:
Edward Diener
2020-07-11 05:04:00 -04:00
parent 0fbfe9c981
commit 28a0c21651
7 changed files with 16 additions and 5 deletions

View File

@ -16,14 +16,15 @@
# #
# /* BOOST_PP_DEDUCE_R */ # /* BOOST_PP_DEDUCE_R */
# #
# include <boost/preprocessor/arithmetic/dec.hpp>
# include <boost/preprocessor/detail/auto_rec.hpp> # include <boost/preprocessor/detail/auto_rec.hpp>
# include <boost/preprocessor/repetition/for.hpp> # include <boost/preprocessor/repetition/for.hpp>
# include <boost/preprocessor/config/limits.hpp> # include <boost/preprocessor/config/limits.hpp>
# #
# if BOOST_PP_LIMIT_FOR == 256 # 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 # 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 # else
# error Incorrect value for the BOOST_PP_LIMIT_FOR limit # error Incorrect value for the BOOST_PP_LIMIT_FOR limit
# endif # endif

View File

@ -14,6 +14,7 @@
# ifndef BOOST_PREPROCESSOR_REPETITION_DETAIL_DMC_FOR_256_HPP # ifndef BOOST_PREPROCESSOR_REPETITION_DETAIL_DMC_FOR_256_HPP
# define 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_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_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) # 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_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_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_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_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) # 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)

View File

@ -14,6 +14,7 @@
# ifndef BOOST_PREPROCESSOR_REPETITION_DETAIL_EDG_FOR_256_HPP # ifndef BOOST_PREPROCESSOR_REPETITION_DETAIL_EDG_FOR_256_HPP
# define 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_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_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) # 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_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_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_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_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) # 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)

View File

@ -14,6 +14,7 @@
# ifndef BOOST_PREPROCESSOR_REPETITION_DETAIL_FOR_256_HPP # ifndef BOOST_PREPROCESSOR_REPETITION_DETAIL_FOR_256_HPP
# define 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_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_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) # 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_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_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_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_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) # 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)

View File

@ -14,6 +14,7 @@
# ifndef BOOST_PREPROCESSOR_REPETITION_DETAIL_MSVC_FOR_256_HPP # ifndef BOOST_PREPROCESSOR_REPETITION_DETAIL_MSVC_FOR_256_HPP
# define 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_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_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) # 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)

View File

@ -15,6 +15,7 @@
# ifndef BOOST_PREPROCESSOR_REPETITION_FOR_HPP # ifndef BOOST_PREPROCESSOR_REPETITION_FOR_HPP
# define BOOST_PREPROCESSOR_REPETITION_FOR_HPP # define BOOST_PREPROCESSOR_REPETITION_FOR_HPP
# #
# include <boost/preprocessor/arithmetic/dec.hpp>
# include <boost/preprocessor/cat.hpp> # include <boost/preprocessor/cat.hpp>
# include <boost/preprocessor/debug/error.hpp> # include <boost/preprocessor/debug/error.hpp>
# include <boost/preprocessor/facilities/empty.hpp> # include <boost/preprocessor/facilities/empty.hpp>
@ -29,14 +30,15 @@
# endif # endif
# #
# if BOOST_PP_LIMIT_FOR == 256 # 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 # 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 # else
# error Incorrect value for the BOOST_PP_LIMIT_FOR limit # error Incorrect value for the BOOST_PP_LIMIT_FOR limit
# endif # 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_P(r, s) s
# define BOOST_PP_FOR_SR_O(r, s) 0 # define BOOST_PP_FOR_SR_O(r, s) 0

View File

@ -14,6 +14,7 @@
# ifndef BOOST_PREPROCESSOR_REPETITION_FOR_256_HPP # ifndef BOOST_PREPROCESSOR_REPETITION_FOR_256_HPP
# define 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_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_2(s, p, o, m) 0
# define BOOST_PP_FOR_CHECK_BOOST_PP_FOR_3(s, p, o, m) 0 # define BOOST_PP_FOR_CHECK_BOOST_PP_FOR_3(s, p, o, m) 0