forked from boostorg/preprocessor
When the tuple limit is not 256, use previous implementation
This commit is contained in:
@ -7,6 +7,8 @@
|
|||||||
# * *
|
# * *
|
||||||
# ************************************************************************** */
|
# ************************************************************************** */
|
||||||
#
|
#
|
||||||
|
# /* Revised by Edward Diener (2020) */
|
||||||
|
#
|
||||||
# /* See http://www.boost.org for most recent version. */
|
# /* See http://www.boost.org for most recent version. */
|
||||||
#
|
#
|
||||||
# ifndef BOOST_PREPROCESSOR_ARRAY_INSERT_HPP
|
# ifndef BOOST_PREPROCESSOR_ARRAY_INSERT_HPP
|
||||||
@ -17,11 +19,14 @@
|
|||||||
# include <boost/preprocessor/array/push_back.hpp>
|
# include <boost/preprocessor/array/push_back.hpp>
|
||||||
# include <boost/preprocessor/array/size.hpp>
|
# include <boost/preprocessor/array/size.hpp>
|
||||||
# include <boost/preprocessor/comparison/not_equal.hpp>
|
# include <boost/preprocessor/comparison/not_equal.hpp>
|
||||||
|
# include <boost/preprocessor/config/limits.hpp>
|
||||||
# include <boost/preprocessor/control/deduce_d.hpp>
|
# include <boost/preprocessor/control/deduce_d.hpp>
|
||||||
# include <boost/preprocessor/control/iif.hpp>
|
# include <boost/preprocessor/control/iif.hpp>
|
||||||
# include <boost/preprocessor/control/while.hpp>
|
# include <boost/preprocessor/control/while.hpp>
|
||||||
|
# if BOOST_PP_LIMIT_TUPLE == 256
|
||||||
# include <boost/preprocessor/facilities/identity.hpp>
|
# include <boost/preprocessor/facilities/identity.hpp>
|
||||||
# include <boost/preprocessor/logical/not.hpp>
|
# include <boost/preprocessor/logical/not.hpp>
|
||||||
|
# endif
|
||||||
# include <boost/preprocessor/tuple/elem.hpp>
|
# include <boost/preprocessor/tuple/elem.hpp>
|
||||||
#
|
#
|
||||||
# /* BOOST_PP_ARRAY_INSERT */
|
# /* BOOST_PP_ARRAY_INSERT */
|
||||||
@ -32,17 +37,27 @@
|
|||||||
# /* BOOST_PP_ARRAY_INSERT_D */
|
# /* BOOST_PP_ARRAY_INSERT_D */
|
||||||
#
|
#
|
||||||
# if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG()
|
# if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG()
|
||||||
|
# if BOOST_PP_LIMIT_TUPLE == 256
|
||||||
# define BOOST_PP_ARRAY_INSERT_D(d, array, i, elem) \
|
# define BOOST_PP_ARRAY_INSERT_D(d, array, i, elem) \
|
||||||
BOOST_PP_IIF(BOOST_PP_NOT(BOOST_PP_ARRAY_SIZE(array)),BOOST_PP_IDENTITY_N((1,(elem)),5),BOOST_PP_ARRAY_INSERT_ZERO_D)(d, array, i, elem, BOOST_PP_NOT(i))
|
BOOST_PP_IIF(BOOST_PP_NOT(BOOST_PP_ARRAY_SIZE(array)),BOOST_PP_IDENTITY_N((1,(elem)),5),BOOST_PP_ARRAY_INSERT_ZERO_D)(d, array, i, elem, BOOST_PP_NOT(i))
|
||||||
# else
|
# else
|
||||||
|
# define BOOST_PP_ARRAY_INSERT_D(d, array, i, elem) BOOST_PP_TUPLE_ELEM(5, 3, BOOST_PP_WHILE_ ## d(BOOST_PP_ARRAY_INSERT_P, BOOST_PP_ARRAY_INSERT_O, (0, i, elem, (0, ()), array)))
|
||||||
|
# endif
|
||||||
|
# else
|
||||||
# define BOOST_PP_ARRAY_INSERT_D(d, array, i, elem) BOOST_PP_ARRAY_INSERT_D_I(d, array, i, elem)
|
# define BOOST_PP_ARRAY_INSERT_D(d, array, i, elem) BOOST_PP_ARRAY_INSERT_D_I(d, array, i, elem)
|
||||||
|
# if BOOST_PP_LIMIT_TUPLE == 256
|
||||||
# define BOOST_PP_ARRAY_INSERT_D_I(d, array, i, elem) \
|
# define BOOST_PP_ARRAY_INSERT_D_I(d, array, i, elem) \
|
||||||
BOOST_PP_IIF(BOOST_PP_NOT(BOOST_PP_ARRAY_SIZE(array)),BOOST_PP_IDENTITY_N((1,(elem)),5),BOOST_PP_ARRAY_INSERT_ZERO_D)(d, array, i, elem, BOOST_PP_NOT(i))
|
BOOST_PP_IIF(BOOST_PP_NOT(BOOST_PP_ARRAY_SIZE(array)),BOOST_PP_IDENTITY_N((1,(elem)),5),BOOST_PP_ARRAY_INSERT_ZERO_D)(d, array, i, elem, BOOST_PP_NOT(i))
|
||||||
|
# else
|
||||||
|
# define BOOST_PP_ARRAY_INSERT_D_I(d, array, i, elem) BOOST_PP_TUPLE_ELEM(5, 3, BOOST_PP_WHILE_ ## d(BOOST_PP_ARRAY_INSERT_P, BOOST_PP_ARRAY_INSERT_O, (0, i, elem, (0, ()), array)))
|
||||||
|
# endif
|
||||||
# endif
|
# endif
|
||||||
#
|
#
|
||||||
|
# if BOOST_PP_LIMIT_TUPLE == 256
|
||||||
# define BOOST_PP_ARRAY_INSERT_ZERO_D(d, array, i, elem, zero) \
|
# define BOOST_PP_ARRAY_INSERT_ZERO_D(d, array, i, elem, zero) \
|
||||||
BOOST_PP_TUPLE_ELEM(5, 3, BOOST_PP_WHILE_ ## d(BOOST_PP_ARRAY_INSERT_P, BOOST_PP_ARRAY_INSERT_O, \
|
BOOST_PP_TUPLE_ELEM(5, 3, BOOST_PP_WHILE_ ## d(BOOST_PP_ARRAY_INSERT_P, BOOST_PP_ARRAY_INSERT_O, \
|
||||||
(1, i, elem, BOOST_PP_IIF( zero, ( 2 , ( elem , BOOST_PP_ARRAY_ELEM(0,array) ) ) , ( 1 , ( BOOST_PP_ARRAY_ELEM(0,array) ) ) ), array)))
|
(1, i, elem, BOOST_PP_IIF( zero, ( 2 , ( elem , BOOST_PP_ARRAY_ELEM(0,array) ) ) , ( 1 , ( BOOST_PP_ARRAY_ELEM(0,array) ) ) ), array)))
|
||||||
|
# endif
|
||||||
#
|
#
|
||||||
# if BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_STRICT()
|
# if BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_STRICT()
|
||||||
# define BOOST_PP_ARRAY_INSERT_P(d, state) BOOST_PP_ARRAY_INSERT_P_I state
|
# define BOOST_PP_ARRAY_INSERT_P(d, state) BOOST_PP_ARRAY_INSERT_P_I state
|
||||||
|
@ -22,7 +22,9 @@
|
|||||||
# include <boost/preprocessor/control/deduce_d.hpp>
|
# include <boost/preprocessor/control/deduce_d.hpp>
|
||||||
# include <boost/preprocessor/control/iif.hpp>
|
# include <boost/preprocessor/control/iif.hpp>
|
||||||
# include <boost/preprocessor/control/while.hpp>
|
# include <boost/preprocessor/control/while.hpp>
|
||||||
|
# if BOOST_PP_LIMIT_TUPLE == 256
|
||||||
# include <boost/preprocessor/logical/not.hpp>
|
# include <boost/preprocessor/logical/not.hpp>
|
||||||
|
# endif
|
||||||
# include <boost/preprocessor/tuple/eat.hpp>
|
# include <boost/preprocessor/tuple/eat.hpp>
|
||||||
# include <boost/preprocessor/tuple/elem.hpp>
|
# include <boost/preprocessor/tuple/elem.hpp>
|
||||||
#
|
#
|
||||||
@ -34,15 +36,25 @@
|
|||||||
# /* BOOST_PP_ARRAY_REMOVE_D */
|
# /* BOOST_PP_ARRAY_REMOVE_D */
|
||||||
#
|
#
|
||||||
# if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG()
|
# if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG()
|
||||||
|
# if BOOST_PP_LIMIT_TUPLE == 256
|
||||||
# define BOOST_PP_ARRAY_REMOVE_D(d, array, i) BOOST_PP_ARRAY_REMOVE_ZERO_D(d, array, i, BOOST_PP_NOT(i))
|
# define BOOST_PP_ARRAY_REMOVE_D(d, array, i) BOOST_PP_ARRAY_REMOVE_ZERO_D(d, array, i, BOOST_PP_NOT(i))
|
||||||
# else
|
# else
|
||||||
|
# define BOOST_PP_ARRAY_REMOVE_D(d, array, i) BOOST_PP_TUPLE_ELEM(4, 2, BOOST_PP_WHILE_ ## d(BOOST_PP_ARRAY_REMOVE_P, BOOST_PP_ARRAY_REMOVE_O, (0, i, (0, ()), array)))
|
||||||
|
# endif
|
||||||
|
# else
|
||||||
# define BOOST_PP_ARRAY_REMOVE_D(d, array, i) BOOST_PP_ARRAY_REMOVE_D_I(d, array, i)
|
# define BOOST_PP_ARRAY_REMOVE_D(d, array, i) BOOST_PP_ARRAY_REMOVE_D_I(d, array, i)
|
||||||
|
# if BOOST_PP_LIMIT_TUPLE == 256
|
||||||
# define BOOST_PP_ARRAY_REMOVE_D_I(d, array, i) BOOST_PP_ARRAY_REMOVE_ZERO_D(d, array, i, BOOST_PP_NOT(i))
|
# define BOOST_PP_ARRAY_REMOVE_D_I(d, array, i) BOOST_PP_ARRAY_REMOVE_ZERO_D(d, array, i, BOOST_PP_NOT(i))
|
||||||
|
# else
|
||||||
|
# define BOOST_PP_ARRAY_REMOVE_D_I(d, array, i) BOOST_PP_TUPLE_ELEM(4, 2, BOOST_PP_WHILE_ ## d(BOOST_PP_ARRAY_REMOVE_P, BOOST_PP_ARRAY_REMOVE_O, (0, i, (0, ()), array)))
|
||||||
|
# endif
|
||||||
# endif
|
# endif
|
||||||
#
|
#
|
||||||
|
# if BOOST_PP_LIMIT_TUPLE == 256
|
||||||
# define BOOST_PP_ARRAY_REMOVE_ZERO_D(d, array, i, zero) \
|
# define BOOST_PP_ARRAY_REMOVE_ZERO_D(d, array, i, zero) \
|
||||||
BOOST_PP_TUPLE_ELEM(4, 2, BOOST_PP_WHILE_ ## d(BOOST_PP_ARRAY_REMOVE_P, BOOST_PP_ARRAY_REMOVE_O, \
|
BOOST_PP_TUPLE_ELEM(4, 2, BOOST_PP_WHILE_ ## d(BOOST_PP_ARRAY_REMOVE_P, BOOST_PP_ARRAY_REMOVE_O, \
|
||||||
(1, i, BOOST_PP_IIF(zero,(0, ()),(1, (BOOST_PP_ARRAY_ELEM(0,array)))), array)))
|
(1, i, BOOST_PP_IIF(zero,(0, ()),(1, (BOOST_PP_ARRAY_ELEM(0,array)))), array)))
|
||||||
|
# endif
|
||||||
#
|
#
|
||||||
# define BOOST_PP_ARRAY_REMOVE_P(d, st) BOOST_PP_NOT_EQUAL(BOOST_PP_TUPLE_ELEM(4, 0, st), BOOST_PP_ARRAY_SIZE(BOOST_PP_TUPLE_ELEM(4, 3, st)))
|
# define BOOST_PP_ARRAY_REMOVE_P(d, st) BOOST_PP_NOT_EQUAL(BOOST_PP_TUPLE_ELEM(4, 0, st), BOOST_PP_ARRAY_SIZE(BOOST_PP_TUPLE_ELEM(4, 3, st)))
|
||||||
#
|
#
|
||||||
|
@ -20,6 +20,9 @@
|
|||||||
# include <boost/preprocessor/control/deduce_d.hpp>
|
# include <boost/preprocessor/control/deduce_d.hpp>
|
||||||
# include <boost/preprocessor/control/iif.hpp>
|
# include <boost/preprocessor/control/iif.hpp>
|
||||||
# include <boost/preprocessor/control/while.hpp>
|
# include <boost/preprocessor/control/while.hpp>
|
||||||
|
# if BOOST_PP_LIMIT_TUPLE == 256
|
||||||
|
# include <boost/preprocessor/logical/not.hpp>
|
||||||
|
# endif
|
||||||
# include <boost/preprocessor/tuple/elem.hpp>
|
# include <boost/preprocessor/tuple/elem.hpp>
|
||||||
#
|
#
|
||||||
# /* BOOST_PP_ARRAY_REPLACE */
|
# /* BOOST_PP_ARRAY_REPLACE */
|
||||||
@ -30,15 +33,25 @@
|
|||||||
# /* BOOST_PP_ARRAY_REPLACE_D */
|
# /* BOOST_PP_ARRAY_REPLACE_D */
|
||||||
#
|
#
|
||||||
# if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG()
|
# if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG()
|
||||||
|
# if BOOST_PP_LIMIT_TUPLE == 256
|
||||||
# define BOOST_PP_ARRAY_REPLACE_D(d, array, i, elem) BOOST_PP_ARRAY_REPLACE_ZERO_D(d, array, i, elem, BOOST_PP_NOT(i))
|
# define BOOST_PP_ARRAY_REPLACE_D(d, array, i, elem) BOOST_PP_ARRAY_REPLACE_ZERO_D(d, array, i, elem, BOOST_PP_NOT(i))
|
||||||
# else
|
# else
|
||||||
|
# define BOOST_PP_ARRAY_REPLACE_D(d, array, i, elem) BOOST_PP_TUPLE_ELEM(5, 3, BOOST_PP_WHILE_ ## d(BOOST_PP_ARRAY_REPLACE_P, BOOST_PP_ARRAY_REPLACE_O, (0, i, elem, (0, ()), array)))
|
||||||
|
# endif
|
||||||
|
# else
|
||||||
# define BOOST_PP_ARRAY_REPLACE_D(d, array, i, elem) BOOST_PP_ARRAY_REPLACE_D_I(d, array, i, elem)
|
# define BOOST_PP_ARRAY_REPLACE_D(d, array, i, elem) BOOST_PP_ARRAY_REPLACE_D_I(d, array, i, elem)
|
||||||
|
# if BOOST_PP_LIMIT_TUPLE == 256
|
||||||
# define BOOST_PP_ARRAY_REPLACE_D_I(d, array, i, elem) BOOST_PP_ARRAY_REPLACE_ZERO_D(d, array, i, elem, BOOST_PP_NOT(i))
|
# define BOOST_PP_ARRAY_REPLACE_D_I(d, array, i, elem) BOOST_PP_ARRAY_REPLACE_ZERO_D(d, array, i, elem, BOOST_PP_NOT(i))
|
||||||
|
# else
|
||||||
|
# define BOOST_PP_ARRAY_REPLACE_D_I(d, array, i, elem) BOOST_PP_TUPLE_ELEM(5, 3, BOOST_PP_WHILE_ ## d(BOOST_PP_ARRAY_REPLACE_P, BOOST_PP_ARRAY_REPLACE_O, (0, i, elem, (0, ()), array)))
|
||||||
|
# endif
|
||||||
# endif
|
# endif
|
||||||
#
|
#
|
||||||
|
# if BOOST_PP_LIMIT_TUPLE == 256
|
||||||
# define BOOST_PP_ARRAY_REPLACE_ZERO_D(d, array, i, elem, zero) \
|
# define BOOST_PP_ARRAY_REPLACE_ZERO_D(d, array, i, elem, zero) \
|
||||||
BOOST_PP_TUPLE_ELEM(5, 3, BOOST_PP_WHILE_ ## d(BOOST_PP_ARRAY_REPLACE_P, BOOST_PP_ARRAY_REPLACE_O, \
|
BOOST_PP_TUPLE_ELEM(5, 3, BOOST_PP_WHILE_ ## d(BOOST_PP_ARRAY_REPLACE_P, BOOST_PP_ARRAY_REPLACE_O, \
|
||||||
(1, i, elem, BOOST_PP_IIF(zero,(1, (elem)),(1, (BOOST_PP_ARRAY_ELEM(0,array)))), array)))
|
(1, i, elem, BOOST_PP_IIF(zero,(1, (elem)),(1, (BOOST_PP_ARRAY_ELEM(0,array)))), array)))
|
||||||
|
# endif
|
||||||
#
|
#
|
||||||
# define BOOST_PP_ARRAY_REPLACE_P(d, state) BOOST_PP_NOT_EQUAL(BOOST_PP_TUPLE_ELEM(5, 0, state), BOOST_PP_ARRAY_SIZE(BOOST_PP_TUPLE_ELEM(5, 4, state)))
|
# define BOOST_PP_ARRAY_REPLACE_P(d, state) BOOST_PP_NOT_EQUAL(BOOST_PP_TUPLE_ELEM(5, 0, state), BOOST_PP_ARRAY_SIZE(BOOST_PP_TUPLE_ELEM(5, 4, state)))
|
||||||
#
|
#
|
||||||
|
Reference in New Issue
Block a user