File indexing completed on 2026-05-30 08:34:07
0001 #
0002
0003
0004
0005
0006
0007
0008
0009 0010 ">#
0011 #
0012 0013 ">#
0014 # ifndef BOOST_PREPROCESSOR_ARRAY_REPLACE_HPP
0015 # define BOOST_PREPROCESSOR_ARRAY_REPLACE_HPP
0016 0017 ">#
0018 # include <boost/preprocessor/config/config.hpp>
0019 0020 ">#
0021 # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_STRICT()
0022 0023 ">#
0024 # include <boost/preprocessor/arithmetic/inc.hpp>
0025 # include <boost/preprocessor/array/elem.hpp>
0026 # include <boost/preprocessor/array/push_back.hpp>
0027 # include <boost/preprocessor/comparison/not_equal.hpp>
0028 # include <boost/preprocessor/config/config.hpp>
0029 # include <boost/preprocessor/control/deduce_d.hpp>
0030 # include <boost/preprocessor/control/iif.hpp>
0031 # include <boost/preprocessor/control/while.hpp>
0032 # include <boost/preprocessor/tuple/elem.hpp>
0033 0034 ">#
0035 #
0036 0037 ">#
0038 # define BOOST_PP_ARRAY_REPLACE(array, i, elem) BOOST_PP_ARRAY_REPLACE_I(BOOST_PP_DEDUCE_D(), array, i, elem)
0039 # define BOOST_PP_ARRAY_REPLACE_I(d, array, i, elem) BOOST_PP_ARRAY_REPLACE_D(d, array, i, elem)
0040 0041 ">#
0042 #
0043 0044 ">#
0045 # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG()
0046 # 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)))
0047 # else
0048 # define BOOST_PP_ARRAY_REPLACE_D(d, array, i, elem) BOOST_PP_ARRAY_REPLACE_D_I(d, array, i, elem)
0049 # 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)))
0050 # endif
0051 0052 ">#
0053 # 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)))
0054 0055 ">#
0056 # if BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_STRICT()
0057 # define BOOST_PP_ARRAY_REPLACE_O(d, state) BOOST_PP_ARRAY_REPLACE_O_I state
0058 # else
0059 # define BOOST_PP_ARRAY_REPLACE_O(d, state) BOOST_PP_ARRAY_REPLACE_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))
0060 # endif
0061 0062 ">#
0063 # define BOOST_PP_ARRAY_REPLACE_O_I(n, i, elem, res, arr) (BOOST_PP_INC(n), i, elem, BOOST_PP_ARRAY_PUSH_BACK(res, BOOST_PP_IIF(BOOST_PP_NOT_EQUAL(n, i), BOOST_PP_ARRAY_ELEM(n, arr), elem)), arr)
0064 0065 ">#
0066 # else
0067 0068 ">#
0069 # include <boost/preprocessor/arithmetic/inc.hpp>
0070 # include <boost/preprocessor/array/elem.hpp>
0071 # include <boost/preprocessor/array/push_back.hpp>
0072 # include <boost/preprocessor/comparison/not_equal.hpp>
0073 # include <boost/preprocessor/control/deduce_d.hpp>
0074 # include <boost/preprocessor/control/iif.hpp>
0075 # include <boost/preprocessor/control/while.hpp>
0076 # if BOOST_PP_LIMIT_TUPLE == 256
0077 # include <boost/preprocessor/logical/not.hpp>
0078 # endif
0079 # include <boost/preprocessor/tuple/elem.hpp>
0080 0081 ">#
0082 #
0083 0084 ">#
0085 # define BOOST_PP_ARRAY_REPLACE(array, i, elem) BOOST_PP_ARRAY_REPLACE_I(BOOST_PP_DEDUCE_D(), array, i, elem)
0086 # define BOOST_PP_ARRAY_REPLACE_I(d, array, i, elem) BOOST_PP_ARRAY_REPLACE_D(d, array, i, elem)
0087 0088 ">#
0089 #
0090 0091 ">#
0092 # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG()
0093 # if BOOST_PP_LIMIT_TUPLE == 256
0094 # define BOOST_PP_ARRAY_REPLACE_D(d, array, i, elem) BOOST_PP_ARRAY_REPLACE_ZERO_D(d, array, i, elem, BOOST_PP_NOT(i))
0095 # else
0096 # 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)))
0097 # endif
0098 # else
0099 # define BOOST_PP_ARRAY_REPLACE_D(d, array, i, elem) BOOST_PP_ARRAY_REPLACE_D_I(d, array, i, elem)
0100 # if BOOST_PP_LIMIT_TUPLE == 256
0101 # 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))
0102 # else
0103 # 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)))
0104 # endif
0105 # endif
0106 0107 ">#
0108 # if BOOST_PP_LIMIT_TUPLE == 256
0109 # define BOOST_PP_ARRAY_REPLACE_ZERO_D(d, array, i, elem, zero) \
0110 BOOST_PP_TUPLE_ELEM(5, 3, BOOST_PP_WHILE_ ## d(BOOST_PP_ARRAY_REPLACE_P, BOOST_PP_ARRAY_REPLACE_O, \
0111 (1, i, elem, BOOST_PP_IIF(zero,(1, (elem)),(1, (BOOST_PP_ARRAY_ELEM(0,array)))), array)))
0112 # endif
0113 0114 ">#
0115 # 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)))
0116 0117 ">#
0118 # if BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_STRICT()
0119 # define BOOST_PP_ARRAY_REPLACE_O(d, state) BOOST_PP_ARRAY_REPLACE_O_I state
0120 # else
0121 # define BOOST_PP_ARRAY_REPLACE_O(d, state) BOOST_PP_ARRAY_REPLACE_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))
0122 # endif
0123 0124 ">#
0125 # define BOOST_PP_ARRAY_REPLACE_O_I(n, i, elem, res, arr) (BOOST_PP_INC(n), i, elem, BOOST_PP_ARRAY_PUSH_BACK(res, BOOST_PP_IIF(BOOST_PP_NOT_EQUAL(n, i), BOOST_PP_ARRAY_ELEM(n, arr), elem)), arr)
0126 0127 ">#
0128 # endif
0129 0130 ">#
0131 # endif