File indexing completed on 2026-09-19 09:10:34
0001 #
0002
0003
0004
0005
0006
0007
0008
0009 0010 ">#
0011 #
0012 0013 ">#
0014 #
0015 0016 ">#
0017 # ifndef BOOST_PREPROCESSOR_ARRAY_INSERT_HPP
0018 # define BOOST_PREPROCESSOR_ARRAY_INSERT_HPP
0019 0020 ">#
0021 # include <boost/preprocessor/config/config.hpp>
0022 0023 ">#
0024 # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_STRICT()
0025 0026 ">#
0027 # include <boost/preprocessor/arithmetic/inc.hpp>
0028 # include <boost/preprocessor/array/elem.hpp>
0029 # include <boost/preprocessor/array/push_back.hpp>
0030 # include <boost/preprocessor/array/size.hpp>
0031 # include <boost/preprocessor/comparison/not_equal.hpp>
0032 # include <boost/preprocessor/control/deduce_d.hpp>
0033 # include <boost/preprocessor/control/iif.hpp>
0034 # include <boost/preprocessor/control/while.hpp>
0035 # include <boost/preprocessor/tuple/elem.hpp>
0036 0037 ">#
0038 #
0039 0040 ">#
0041 # define BOOST_PP_ARRAY_INSERT(array, i, elem) BOOST_PP_ARRAY_INSERT_I(BOOST_PP_DEDUCE_D(), array, i, elem)
0042 # define BOOST_PP_ARRAY_INSERT_I(d, array, i, elem) BOOST_PP_ARRAY_INSERT_D(d, array, i, elem)
0043 0044 ">#
0045 #
0046 0047 ">#
0048 # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG()
0049 # 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)))
0050 # else
0051 # define BOOST_PP_ARRAY_INSERT_D(d, array, i, elem) BOOST_PP_ARRAY_INSERT_D_I(d, array, i, elem)
0052 # 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)))
0053 # endif
0054 0055 ">#
0056 # if BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_STRICT()
0057 # define BOOST_PP_ARRAY_INSERT_P(d, state) BOOST_PP_ARRAY_INSERT_P_I state
0058 # else
0059 # define BOOST_PP_ARRAY_INSERT_P(d, state) BOOST_PP_ARRAY_INSERT_P_I(nil, nil, nil, BOOST_PP_TUPLE_ELEM(5, 3, state), BOOST_PP_TUPLE_ELEM(5, 4, state))
0060 # endif
0061 0062 ">#
0063 # define BOOST_PP_ARRAY_INSERT_P_I(_i, _ii, _iii, res, arr) BOOST_PP_NOT_EQUAL(BOOST_PP_ARRAY_SIZE(res), BOOST_PP_INC(BOOST_PP_ARRAY_SIZE(arr)))
0064 0065 ">#
0066 # if BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_STRICT()
0067 # define BOOST_PP_ARRAY_INSERT_O(d, state) BOOST_PP_ARRAY_INSERT_O_I state
0068 # else
0069 # define BOOST_PP_ARRAY_INSERT_O(d, state) BOOST_PP_ARRAY_INSERT_O_I(BOOST_PP_TUPLE_ELEM(5, 0, state), BOOST_PP_TUPLE_ELEM(5, 1, state), BOOST_PP_TUPLE_ELEM(5, 2, state), BOOST_PP_TUPLE_ELEM(5, 3, state), BOOST_PP_TUPLE_ELEM(5, 4, state))
0070 # endif
0071 0072 ">#
0073 # define BOOST_PP_ARRAY_INSERT_O_I(n, i, elem, res, arr) (BOOST_PP_IIF(BOOST_PP_NOT_EQUAL(BOOST_PP_ARRAY_SIZE(res), i), BOOST_PP_INC(n), n), i, elem, BOOST_PP_ARRAY_PUSH_BACK(res, BOOST_PP_IIF(BOOST_PP_NOT_EQUAL(BOOST_PP_ARRAY_SIZE(res), i), BOOST_PP_ARRAY_ELEM(n, arr), elem)), arr)
0074 0075 ">#
0076 # else
0077 0078 ">#
0079 # include <boost/preprocessor/arithmetic/inc.hpp>
0080 # include <boost/preprocessor/array/elem.hpp>
0081 # include <boost/preprocessor/array/push_back.hpp>
0082 # include <boost/preprocessor/array/size.hpp>
0083 # include <boost/preprocessor/comparison/not_equal.hpp>
0084 # include <boost/preprocessor/config/limits.hpp>
0085 # include <boost/preprocessor/control/deduce_d.hpp>
0086 # include <boost/preprocessor/control/iif.hpp>
0087 # include <boost/preprocessor/control/while.hpp>
0088 # if BOOST_PP_LIMIT_TUPLE == 256
0089 # include <boost/preprocessor/facilities/identity.hpp>
0090 # include <boost/preprocessor/logical/not.hpp>
0091 # endif
0092 # include <boost/preprocessor/tuple/elem.hpp>
0093 0094 ">#
0095 #
0096 0097 ">#
0098 # define BOOST_PP_ARRAY_INSERT(array, i, elem) BOOST_PP_ARRAY_INSERT_I(BOOST_PP_DEDUCE_D(), array, i, elem)
0099 # define BOOST_PP_ARRAY_INSERT_I(d, array, i, elem) BOOST_PP_ARRAY_INSERT_D(d, array, i, elem)
0100 0101 ">#
0102 #
0103 0104 ">#
0105 # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG()
0106 # if BOOST_PP_LIMIT_TUPLE == 256
0107 # define BOOST_PP_ARRAY_INSERT_D(d, array, i, elem) \
0108 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))
0109 # else
0110 # 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)))
0111 # endif
0112 # else
0113 # define BOOST_PP_ARRAY_INSERT_D(d, array, i, elem) BOOST_PP_ARRAY_INSERT_D_I(d, array, i, elem)
0114 # if BOOST_PP_LIMIT_TUPLE == 256
0115 # define BOOST_PP_ARRAY_INSERT_D_I(d, array, i, elem) \
0116 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))
0117 # else
0118 # 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)))
0119 # endif
0120 # endif
0121 0122 ">#
0123 # if BOOST_PP_LIMIT_TUPLE == 256
0124 # define BOOST_PP_ARRAY_INSERT_ZERO_D(d, array, i, elem, zero) \
0125 BOOST_PP_TUPLE_ELEM(5, 3, BOOST_PP_WHILE_ ## d(BOOST_PP_ARRAY_INSERT_P, BOOST_PP_ARRAY_INSERT_O, \
0126 (1, i, elem, BOOST_PP_IIF( zero, ( 2 , ( elem , BOOST_PP_ARRAY_ELEM(0,array) ) ) , ( 1 , ( BOOST_PP_ARRAY_ELEM(0,array) ) ) ), array)))
0127 # endif
0128 0129 ">#
0130 # if BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_STRICT()
0131 # define BOOST_PP_ARRAY_INSERT_P(d, state) BOOST_PP_ARRAY_INSERT_P_I state
0132 # else
0133 # define BOOST_PP_ARRAY_INSERT_P(d, state) BOOST_PP_ARRAY_INSERT_P_I(nil, nil, nil, BOOST_PP_TUPLE_ELEM(5, 3, state), BOOST_PP_TUPLE_ELEM(5, 4, state))
0134 # endif
0135 0136 ">#
0137 # define BOOST_PP_ARRAY_INSERT_P_I(_i, _ii, _iii, res, arr) BOOST_PP_NOT_EQUAL(BOOST_PP_ARRAY_SIZE(res), BOOST_PP_INC(BOOST_PP_ARRAY_SIZE(arr)))
0138 0139 ">#
0140 # if BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_STRICT()
0141 # define BOOST_PP_ARRAY_INSERT_O(d, state) BOOST_PP_ARRAY_INSERT_O_I state
0142 # else
0143 # define BOOST_PP_ARRAY_INSERT_O(d, state) BOOST_PP_ARRAY_INSERT_O_I(BOOST_PP_TUPLE_ELEM(5, 0, state), BOOST_PP_TUPLE_ELEM(5, 1, state), BOOST_PP_TUPLE_ELEM(5, 2, state), BOOST_PP_TUPLE_ELEM(5, 3, state), BOOST_PP_TUPLE_ELEM(5, 4, state))
0144 # endif
0145 0146 ">#
0147 # define BOOST_PP_ARRAY_INSERT_O_I(n, i, elem, res, arr) (BOOST_PP_IIF(BOOST_PP_NOT_EQUAL(BOOST_PP_ARRAY_SIZE(res), i), BOOST_PP_INC(n), n), i, elem, BOOST_PP_ARRAY_PUSH_BACK(res, BOOST_PP_IIF(BOOST_PP_NOT_EQUAL(BOOST_PP_ARRAY_SIZE(res), i), BOOST_PP_ARRAY_ELEM(n, arr), elem)), arr)
0148 0149 ">#
0150 # endif
0151 0152 ">#
0153 # endif