# /* ************************************************************************** # * * # * (C) Copyright Paul Mensonides 2002. # * Distributed under the Boost Software License, Version 1.0. (See # * accompanying file LICENSE_1_0.txt or copy at # * http://www.boost.org/LICENSE_1_0.txt) # * * # ************************************************************************** */ # # /* See http://www.boost.org for most recent version. */ # # ifndef ACTIV_BOOST_PREPROCESSOR_ARRAY_REPLACE_HPP # define ACTIV_BOOST_PREPROCESSOR_ARRAY_REPLACE_HPP # # include # # if ~ACTIV_BOOST_PP_CONFIG_FLAGS() & ACTIV_BOOST_PP_CONFIG_STRICT() # # include # include # include # include # include # include # include # include # include # # /* ACTIV_BOOST_PP_ARRAY_REPLACE */ # # define ACTIV_BOOST_PP_ARRAY_REPLACE(array, i, elem) ACTIV_BOOST_PP_ARRAY_REPLACE_I(ACTIV_BOOST_PP_DEDUCE_D(), array, i, elem) # define ACTIV_BOOST_PP_ARRAY_REPLACE_I(d, array, i, elem) ACTIV_BOOST_PP_ARRAY_REPLACE_D(d, array, i, elem) # # /* ACTIV_BOOST_PP_ARRAY_REPLACE_D */ # # if ~ACTIV_BOOST_PP_CONFIG_FLAGS() & ACTIV_BOOST_PP_CONFIG_EDG() # define ACTIV_BOOST_PP_ARRAY_REPLACE_D(d, array, i, elem) ACTIV_BOOST_PP_TUPLE_ELEM(5, 3, ACTIV_BOOST_PP_WHILE_ ## d(ACTIV_BOOST_PP_ARRAY_REPLACE_P, ACTIV_BOOST_PP_ARRAY_REPLACE_O, (0, i, elem, (0, ()), array))) # else # define ACTIV_BOOST_PP_ARRAY_REPLACE_D(d, array, i, elem) ACTIV_BOOST_PP_ARRAY_REPLACE_D_I(d, array, i, elem) # define ACTIV_BOOST_PP_ARRAY_REPLACE_D_I(d, array, i, elem) ACTIV_BOOST_PP_TUPLE_ELEM(5, 3, ACTIV_BOOST_PP_WHILE_ ## d(ACTIV_BOOST_PP_ARRAY_REPLACE_P, ACTIV_BOOST_PP_ARRAY_REPLACE_O, (0, i, elem, (0, ()), array))) # endif # # define ACTIV_BOOST_PP_ARRAY_REPLACE_P(d, state) ACTIV_BOOST_PP_NOT_EQUAL(ACTIV_BOOST_PP_TUPLE_ELEM(5, 0, state), ACTIV_BOOST_PP_ARRAY_SIZE(ACTIV_BOOST_PP_TUPLE_ELEM(5, 4, state))) # # if ACTIV_BOOST_PP_CONFIG_FLAGS() & ACTIV_BOOST_PP_CONFIG_STRICT() # define ACTIV_BOOST_PP_ARRAY_REPLACE_O(d, state) ACTIV_BOOST_PP_ARRAY_REPLACE_O_I state # else # define ACTIV_BOOST_PP_ARRAY_REPLACE_O(d, state) ACTIV_BOOST_PP_ARRAY_REPLACE_O_I(ACTIV_BOOST_PP_TUPLE_ELEM(5, 0, state), ACTIV_BOOST_PP_TUPLE_ELEM(5, 1, state), ACTIV_BOOST_PP_TUPLE_ELEM(5, 2, state), ACTIV_BOOST_PP_TUPLE_ELEM(5, 3, state), ACTIV_BOOST_PP_TUPLE_ELEM(5, 4, state)) # endif # # define ACTIV_BOOST_PP_ARRAY_REPLACE_O_I(n, i, elem, res, arr) (ACTIV_BOOST_PP_INC(n), i, elem, ACTIV_BOOST_PP_ARRAY_PUSH_BACK(res, ACTIV_BOOST_PP_IIF(ACTIV_BOOST_PP_NOT_EQUAL(n, i), ACTIV_BOOST_PP_ARRAY_ELEM(n, arr), elem)), arr) # # else # # include # include # include # include # include # include # include # if ACTIV_BOOST_PP_LIMIT_TUPLE == 256 # include # endif # include # # /* ACTIV_BOOST_PP_ARRAY_REPLACE */ # # define ACTIV_BOOST_PP_ARRAY_REPLACE(array, i, elem) ACTIV_BOOST_PP_ARRAY_REPLACE_I(ACTIV_BOOST_PP_DEDUCE_D(), array, i, elem) # define ACTIV_BOOST_PP_ARRAY_REPLACE_I(d, array, i, elem) ACTIV_BOOST_PP_ARRAY_REPLACE_D(d, array, i, elem) # # /* ACTIV_BOOST_PP_ARRAY_REPLACE_D */ # # if ~ACTIV_BOOST_PP_CONFIG_FLAGS() & ACTIV_BOOST_PP_CONFIG_EDG() # if ACTIV_BOOST_PP_LIMIT_TUPLE == 256 # define ACTIV_BOOST_PP_ARRAY_REPLACE_D(d, array, i, elem) ACTIV_BOOST_PP_ARRAY_REPLACE_ZERO_D(d, array, i, elem, ACTIV_BOOST_PP_NOT(i)) # else # define ACTIV_BOOST_PP_ARRAY_REPLACE_D(d, array, i, elem) ACTIV_BOOST_PP_TUPLE_ELEM(5, 3, ACTIV_BOOST_PP_WHILE_ ## d(ACTIV_BOOST_PP_ARRAY_REPLACE_P, ACTIV_BOOST_PP_ARRAY_REPLACE_O, (0, i, elem, (0, ()), array))) # endif # else # define ACTIV_BOOST_PP_ARRAY_REPLACE_D(d, array, i, elem) ACTIV_BOOST_PP_ARRAY_REPLACE_D_I(d, array, i, elem) # if ACTIV_BOOST_PP_LIMIT_TUPLE == 256 # define ACTIV_BOOST_PP_ARRAY_REPLACE_D_I(d, array, i, elem) ACTIV_BOOST_PP_ARRAY_REPLACE_ZERO_D(d, array, i, elem, ACTIV_BOOST_PP_NOT(i)) # else # define ACTIV_BOOST_PP_ARRAY_REPLACE_D_I(d, array, i, elem) ACTIV_BOOST_PP_TUPLE_ELEM(5, 3, ACTIV_BOOST_PP_WHILE_ ## d(ACTIV_BOOST_PP_ARRAY_REPLACE_P, ACTIV_BOOST_PP_ARRAY_REPLACE_O, (0, i, elem, (0, ()), array))) # endif # endif # # if ACTIV_BOOST_PP_LIMIT_TUPLE == 256 # define ACTIV_BOOST_PP_ARRAY_REPLACE_ZERO_D(d, array, i, elem, zero) \ ACTIV_BOOST_PP_TUPLE_ELEM(5, 3, ACTIV_BOOST_PP_WHILE_ ## d(ACTIV_BOOST_PP_ARRAY_REPLACE_P, ACTIV_BOOST_PP_ARRAY_REPLACE_O, \ (1, i, elem, ACTIV_BOOST_PP_IIF(zero,(1, (elem)),(1, (ACTIV_BOOST_PP_ARRAY_ELEM(0,array)))), array))) # endif # # define ACTIV_BOOST_PP_ARRAY_REPLACE_P(d, state) ACTIV_BOOST_PP_NOT_EQUAL(ACTIV_BOOST_PP_TUPLE_ELEM(5, 0, state), ACTIV_BOOST_PP_ARRAY_SIZE(ACTIV_BOOST_PP_TUPLE_ELEM(5, 4, state))) # # if ACTIV_BOOST_PP_CONFIG_FLAGS() & ACTIV_BOOST_PP_CONFIG_STRICT() # define ACTIV_BOOST_PP_ARRAY_REPLACE_O(d, state) ACTIV_BOOST_PP_ARRAY_REPLACE_O_I state # else # define ACTIV_BOOST_PP_ARRAY_REPLACE_O(d, state) ACTIV_BOOST_PP_ARRAY_REPLACE_O_I(ACTIV_BOOST_PP_TUPLE_ELEM(5, 0, state), ACTIV_BOOST_PP_TUPLE_ELEM(5, 1, state), ACTIV_BOOST_PP_TUPLE_ELEM(5, 2, state), ACTIV_BOOST_PP_TUPLE_ELEM(5, 3, state), ACTIV_BOOST_PP_TUPLE_ELEM(5, 4, state)) # endif # # define ACTIV_BOOST_PP_ARRAY_REPLACE_O_I(n, i, elem, res, arr) (ACTIV_BOOST_PP_INC(n), i, elem, ACTIV_BOOST_PP_ARRAY_PUSH_BACK(res, ACTIV_BOOST_PP_IIF(ACTIV_BOOST_PP_NOT_EQUAL(n, i), ACTIV_BOOST_PP_ARRAY_ELEM(n, arr), elem)), arr) # # endif # # endif