epoc32/include/stdapis/boost/preprocessor/array/replace.hpp
branchSymbian3
changeset 4 837f303aceeb
parent 3 e1b950c65cb4
     1.1 --- a/epoc32/include/stdapis/boost/preprocessor/array/replace.hpp	Wed Mar 31 12:27:01 2010 +0100
     1.2 +++ b/epoc32/include/stdapis/boost/preprocessor/array/replace.hpp	Wed Mar 31 12:33:34 2010 +0100
     1.3 @@ -9,21 +9,41 @@
     1.4  #
     1.5  # /* See http://www.boost.org for most recent version. */
     1.6  #
     1.7 -# ifndef BOOST_PREPROCESSOR_SEQ_REPLACE_HPP
     1.8 -# define BOOST_PREPROCESSOR_SEQ_REPLACE_HPP
     1.9 +# ifndef BOOST_PREPROCESSOR_ARRAY_REPLACE_HPP
    1.10 +# define BOOST_PREPROCESSOR_ARRAY_REPLACE_HPP
    1.11  #
    1.12  # include <boost/preprocessor/arithmetic/inc.hpp>
    1.13 +# include <boost/preprocessor/array/elem.hpp>
    1.14 +# include <boost/preprocessor/array/push_back.hpp>
    1.15 +# include <boost/preprocessor/comparison/not_equal.hpp>
    1.16  # include <boost/preprocessor/config/config.hpp>
    1.17 -# include <boost/preprocessor/seq/first_n.hpp>
    1.18 -# include <boost/preprocessor/seq/rest_n.hpp>
    1.19 +# include <boost/preprocessor/control/deduce_d.hpp>
    1.20 +# include <boost/preprocessor/control/iif.hpp>
    1.21 +# include <boost/preprocessor/control/while.hpp>
    1.22 +# include <boost/preprocessor/tuple/elem.hpp>
    1.23  #
    1.24 -# /* BOOST_PP_SEQ_REPLACE */
    1.25 +# /* BOOST_PP_ARRAY_REPLACE */
    1.26 +#
    1.27 +# define BOOST_PP_ARRAY_REPLACE(array, i, elem) BOOST_PP_ARRAY_REPLACE_I(BOOST_PP_DEDUCE_D(), array, i, elem)
    1.28 +# define BOOST_PP_ARRAY_REPLACE_I(d, array, i, elem) BOOST_PP_ARRAY_REPLACE_D(d, array, i, elem)
    1.29 +#
    1.30 +# /* BOOST_PP_ARRAY_REPLACE_D */
    1.31  #
    1.32  # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG()
    1.33 -#    define BOOST_PP_SEQ_REPLACE(seq, i, elem) BOOST_PP_SEQ_FIRST_N(i, seq) (elem) BOOST_PP_SEQ_REST_N(BOOST_PP_INC(i), seq)
    1.34 +#    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)))
    1.35  # else
    1.36 -#    define BOOST_PP_SEQ_REPLACE(seq, i, elem) BOOST_PP_SEQ_REPLACE_I(seq, i, elem)
    1.37 -#    define BOOST_PP_SEQ_REPLACE_I(seq, i, elem) BOOST_PP_SEQ_FIRST_N(i, seq) (elem) BOOST_PP_SEQ_REST_N(BOOST_PP_INC(i), seq)
    1.38 +#    define BOOST_PP_ARRAY_REPLACE_D(d, array, i, elem) BOOST_PP_ARRAY_REPLACE_D_I(d, array, i, elem)
    1.39 +#    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)))
    1.40  # endif
    1.41  #
    1.42 +# 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)))
    1.43 +#
    1.44 +# if BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_STRICT()
    1.45 +#    define BOOST_PP_ARRAY_REPLACE_O(d, state) BOOST_PP_ARRAY_REPLACE_O_I state
    1.46 +# else
    1.47 +#    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))
    1.48  # endif
    1.49 +#
    1.50 +# 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)
    1.51 +#
    1.52 +# endif