Brian Silverman | f27e085 | 2018-08-04 23:56:45 -0700 | [diff] [blame^] | 1 | # /* ************************************************************************** |
| 2 | # * * |
| 3 | # * (C) Copyright Paul Mensonides 2002. |
| 4 | # * Distributed under the Boost Software License, Version 1.0. (See |
| 5 | # * accompanying file LICENSE_1_0.txt or copy at |
| 6 | # * http://www.boost.org/LICENSE_1_0.txt) |
| 7 | # * * |
| 8 | # ************************************************************************** */ |
| 9 | # |
| 10 | # /* See http://www.boost.org for most recent version. */ |
| 11 | # |
| 12 | # ifndef BOOST_PREPROCESSOR_SEQ_REPLACE_HPP |
| 13 | # define BOOST_PREPROCESSOR_SEQ_REPLACE_HPP |
| 14 | # |
| 15 | # include <boost/preprocessor/arithmetic/dec.hpp> |
| 16 | # include <boost/preprocessor/arithmetic/inc.hpp> |
| 17 | # include <boost/preprocessor/config/config.hpp> |
| 18 | # include <boost/preprocessor/comparison/equal.hpp> |
| 19 | # include <boost/preprocessor/control/iif.hpp> |
| 20 | # include <boost/preprocessor/seq/first_n.hpp> |
| 21 | # include <boost/preprocessor/seq/rest_n.hpp> |
| 22 | # include <boost/preprocessor/seq/size.hpp> |
| 23 | # |
| 24 | # /* BOOST_PP_SEQ_REPLACE */ |
| 25 | # |
| 26 | # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG() |
| 27 | # define BOOST_PP_SEQ_REPLACE(seq, i, elem) BOOST_PP_SEQ_FIRST_N(i, seq) (elem) BOOST_PP_SEQ_REPLACE_DETAIL_REST(seq, i) |
| 28 | # else |
| 29 | # define BOOST_PP_SEQ_REPLACE(seq, i, elem) BOOST_PP_SEQ_REPLACE_I(seq, i, elem) |
| 30 | # define BOOST_PP_SEQ_REPLACE_I(seq, i, elem) BOOST_PP_SEQ_FIRST_N(i, seq) (elem) BOOST_PP_SEQ_REPLACE_DETAIL_REST(seq, i) |
| 31 | # endif |
| 32 | # |
| 33 | # define BOOST_PP_SEQ_REPLACE_DETAIL_REST_EMPTY(seq, i) |
| 34 | # define BOOST_PP_SEQ_REPLACE_DETAIL_REST_VALID(seq, i) BOOST_PP_SEQ_REST_N(BOOST_PP_INC(i), seq) |
| 35 | # define BOOST_PP_SEQ_REPLACE_DETAIL_REST(seq, i) \ |
| 36 | BOOST_PP_IIF \ |
| 37 | ( \ |
| 38 | BOOST_PP_EQUAL(i,BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(seq))), \ |
| 39 | BOOST_PP_SEQ_REPLACE_DETAIL_REST_EMPTY, \ |
| 40 | BOOST_PP_SEQ_REPLACE_DETAIL_REST_VALID \ |
| 41 | ) \ |
| 42 | (seq, i) \ |
| 43 | /**/ |
| 44 | # |
| 45 | # endif |