diff options
author | DongHun Kwak <dh0128.kwak@samsung.com> | 2016-10-06 10:30:07 +0900 |
---|---|---|
committer | DongHun Kwak <dh0128.kwak@samsung.com> | 2016-10-06 10:32:57 +0900 |
commit | 71d216b90256936a9638f325af9bc69d720e75de (patch) | |
tree | 9c5f682d341c7c88ad0c8e3d4b262e00b6fb691a /boost/preprocessor | |
parent | 733b5d5ae2c5d625211e2985ac25728ac3f54883 (diff) | |
download | boost-71d216b90256936a9638f325af9bc69d720e75de.tar.gz boost-71d216b90256936a9638f325af9bc69d720e75de.tar.bz2 boost-71d216b90256936a9638f325af9bc69d720e75de.zip |
Imported Upstream version 1.59.0
Change-Id: I2dde00f4eca71df3eea9d251dcaecde18a6c90a5
Signed-off-by: DongHun Kwak <dh0128.kwak@samsung.com>
Diffstat (limited to 'boost/preprocessor')
-rw-r--r-- | boost/preprocessor/arithmetic/dec.hpp | 1 | ||||
-rw-r--r-- | boost/preprocessor/config/config.hpp | 7 | ||||
-rw-r--r-- | boost/preprocessor/library.hpp | 1 | ||||
-rw-r--r-- | boost/preprocessor/repetition/for.hpp | 20 | ||||
-rw-r--r-- | boost/preprocessor/seq/detail/is_empty.hpp | 49 | ||||
-rw-r--r-- | boost/preprocessor/seq/for_each.hpp | 67 | ||||
-rw-r--r-- | boost/preprocessor/seq/for_each_i.hpp | 68 | ||||
-rw-r--r-- | boost/preprocessor/seq/replace.hpp | 20 | ||||
-rw-r--r-- | boost/preprocessor/seq/rest_n.hpp | 20 | ||||
-rw-r--r-- | boost/preprocessor/seq/size.hpp | 1 |
10 files changed, 227 insertions, 27 deletions
diff --git a/boost/preprocessor/arithmetic/dec.hpp b/boost/preprocessor/arithmetic/dec.hpp index 0503359677..23dd0a35a1 100644 --- a/boost/preprocessor/arithmetic/dec.hpp +++ b/boost/preprocessor/arithmetic/dec.hpp @@ -284,5 +284,6 @@ # define BOOST_PP_DEC_254 253 # define BOOST_PP_DEC_255 254 # define BOOST_PP_DEC_256 255 +# define BOOST_PP_DEC_257 256 # # endif diff --git a/boost/preprocessor/config/config.hpp b/boost/preprocessor/config/config.hpp index fa5ca5bc79..835b283b7e 100644 --- a/boost/preprocessor/config/config.hpp +++ b/boost/preprocessor/config/config.hpp @@ -70,16 +70,18 @@ # # /* BOOST_PP_VARIADICS */ # +# define BOOST_PP_VARIADICS_MSVC 0 # if !defined BOOST_PP_VARIADICS # /* variadic support explicitly disabled for all untested compilers */ -# if defined __GCCXML__ || defined __CUDACC__ || defined __PATHSCALE__ || defined __DMC__ || defined __CODEGEARC__ || defined __BORLANDC__ || defined __MWERKS__ || defined __SUNPRO_CC || defined __HP_aCC && !defined __EDG__ || defined __MRC__ || defined __SC__ || defined __IBMCPP__ || defined __PGI +# if defined __GCCXML__ || defined __CUDACC__ || defined __PATHSCALE__ || defined __DMC__ || defined __CODEGEARC__ || defined __BORLANDC__ || defined __MWERKS__ || ( defined __SUNPRO_CC && __SUNPRO_CC < 0x5130 ) || defined __HP_aCC && !defined __EDG__ || defined __MRC__ || defined __SC__ || defined __IBMCPP__ || defined __PGI # define BOOST_PP_VARIADICS 0 # /* VC++ (C/C++) */ # elif defined _MSC_VER && _MSC_VER >= 1400 && (!defined __EDG__ || defined(__INTELLISENSE__)) && !defined __clang__ # define BOOST_PP_VARIADICS 1 +# undef BOOST_PP_VARIADICS_MSVC # define BOOST_PP_VARIADICS_MSVC 1 # /* Wave (C/C++), GCC (C++) */ -# elif defined __WAVE__ && __WAVE_HAS_VARIADICS__ || defined __GNUC__ && __GXX_EXPERIMENTAL_CXX0X__ +# elif defined __WAVE__ && __WAVE_HAS_VARIADICS__ || defined __GNUC__ && defined __GXX_EXPERIMENTAL_CXX0X__ && __GXX_EXPERIMENTAL_CXX0X__ # define BOOST_PP_VARIADICS 1 # /* EDG-based (C/C++), GCC (C), and unknown (C/C++) */ # elif !defined __cplusplus && __STDC_VERSION__ >= 199901L || __cplusplus >= 201103L @@ -91,6 +93,7 @@ # undef BOOST_PP_VARIADICS # define BOOST_PP_VARIADICS 1 # if defined _MSC_VER && _MSC_VER >= 1400 && (defined(__INTELLISENSE__) || !(defined __EDG__ || defined __GCCXML__ || defined __CUDACC__ || defined __PATHSCALE__ || defined __clang__ || defined __DMC__ || defined __CODEGEARC__ || defined __BORLANDC__ || defined __MWERKS__ || defined __SUNPRO_CC || defined __HP_aCC || defined __MRC__ || defined __SC__ || defined __IBMCPP__ || defined __PGI)) +# undef BOOST_PP_VARIADICS_MSVC # define BOOST_PP_VARIADICS_MSVC 1 # endif # else diff --git a/boost/preprocessor/library.hpp b/boost/preprocessor/library.hpp index aa5b777849..3fb03d8837 100644 --- a/boost/preprocessor/library.hpp +++ b/boost/preprocessor/library.hpp @@ -32,5 +32,6 @@ # include <boost/preprocessor/stringize.hpp> # include <boost/preprocessor/tuple.hpp> # include <boost/preprocessor/variadic.hpp> +# include <boost/preprocessor/wstringize.hpp> # # endif diff --git a/boost/preprocessor/repetition/for.hpp b/boost/preprocessor/repetition/for.hpp index 5a63753d9c..c38946bb55 100644 --- a/boost/preprocessor/repetition/for.hpp +++ b/boost/preprocessor/repetition/for.hpp @@ -16,6 +16,8 @@ # # include <boost/preprocessor/cat.hpp> # include <boost/preprocessor/debug/error.hpp> +# include <boost/preprocessor/facilities/empty.hpp> +# include <boost/preprocessor/logical/bool.hpp> # include <boost/preprocessor/detail/auto_rec.hpp> # # /* BOOST_PP_FOR */ @@ -42,7 +44,23 @@ # include <boost/preprocessor/repetition/detail/for.hpp> # endif # -# define BOOST_PP_FOR_257(s, p, o, m) BOOST_PP_ERROR(0x0002) +# if BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_DMC() +# define BOOST_PP_FOR_257_PR(s, p) BOOST_PP_BOOL(p##(257, s)) +# else +# define BOOST_PP_FOR_257_PR(s, p) BOOST_PP_BOOL(p(257, s)) +# endif + +# define BOOST_PP_FOR_257_ERROR() BOOST_PP_ERROR(0x0002) +# define BOOST_PP_FOR_257(s, p, o, m) \ + BOOST_PP_IIF \ + ( \ + BOOST_PP_FOR_257_PR(s,p), \ + BOOST_PP_FOR_257_ERROR, \ + BOOST_PP_EMPTY \ + ) \ + () \ +/**/ +// # define BOOST_PP_FOR_257(s, p, o, m) BOOST_PP_ERROR(0x0002) # # define BOOST_PP_FOR_CHECK_BOOST_PP_NIL 1 # diff --git a/boost/preprocessor/seq/detail/is_empty.hpp b/boost/preprocessor/seq/detail/is_empty.hpp new file mode 100644 index 0000000000..1a80a2f611 --- /dev/null +++ b/boost/preprocessor/seq/detail/is_empty.hpp @@ -0,0 +1,49 @@ +# /* ************************************************************************** +# * * +# * (C) Copyright Edward Diener 2015. +# * 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 BOOST_PREPROCESSOR_SEQ_DETAIL_IS_EMPTY_HPP +# define BOOST_PREPROCESSOR_SEQ_DETAIL_IS_EMPTY_HPP +# +# include <boost/preprocessor/config/config.hpp> +# include <boost/preprocessor/arithmetic/dec.hpp> +# include <boost/preprocessor/logical/bool.hpp> +# include <boost/preprocessor/logical/compl.hpp> +# include <boost/preprocessor/seq/size.hpp> +# +/* An empty seq is one that is just BOOST_PP_SEQ_NIL */ +# +# define BOOST_PP_SEQ_DETAIL_IS_EMPTY(seq) \ + BOOST_PP_COMPL \ + ( \ + BOOST_PP_SEQ_DETAIL_IS_NOT_EMPTY(seq) \ + ) \ +/**/ +# +# define BOOST_PP_SEQ_DETAIL_IS_EMPTY_SIZE(size) \ + BOOST_PP_COMPL \ + ( \ + BOOST_PP_SEQ_DETAIL_IS_NOT_EMPTY_SIZE(size) \ + ) \ +/**/ +# +# define BOOST_PP_SEQ_DETAIL_IS_NOT_EMPTY(seq) \ + BOOST_PP_SEQ_DETAIL_IS_NOT_EMPTY_SIZE(BOOST_PP_SEQ_DETAIL_EMPTY_SIZE(seq)) \ +/**/ +# +# define BOOST_PP_SEQ_DETAIL_IS_NOT_EMPTY_SIZE(size) \ + BOOST_PP_BOOL(size) \ +/**/ +# +# define BOOST_PP_SEQ_DETAIL_EMPTY_SIZE(seq) \ + BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(seq (nil))) \ +/**/ +# +# endif diff --git a/boost/preprocessor/seq/for_each.hpp b/boost/preprocessor/seq/for_each.hpp index e997a9a852..3f9c0d781b 100644 --- a/boost/preprocessor/seq/for_each.hpp +++ b/boost/preprocessor/seq/for_each.hpp @@ -14,47 +14,94 @@ # # include <boost/preprocessor/arithmetic/dec.hpp> # include <boost/preprocessor/config/config.hpp> +# include <boost/preprocessor/control/if.hpp> +# include <boost/preprocessor/control/iif.hpp> # include <boost/preprocessor/repetition/for.hpp> # include <boost/preprocessor/seq/seq.hpp> # include <boost/preprocessor/seq/size.hpp> +# include <boost/preprocessor/seq/detail/is_empty.hpp> # include <boost/preprocessor/tuple/elem.hpp> # include <boost/preprocessor/tuple/rem.hpp> # # /* BOOST_PP_SEQ_FOR_EACH */ # # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG() -# define BOOST_PP_SEQ_FOR_EACH(macro, data, seq) BOOST_PP_FOR((macro, data, seq (nil)), BOOST_PP_SEQ_FOR_EACH_P, BOOST_PP_SEQ_FOR_EACH_O, BOOST_PP_SEQ_FOR_EACH_M) +# define BOOST_PP_SEQ_FOR_EACH(macro, data, seq) BOOST_PP_SEQ_FOR_EACH_DETAIL_CHECK(macro, data, seq) # else # define BOOST_PP_SEQ_FOR_EACH(macro, data, seq) BOOST_PP_SEQ_FOR_EACH_D(macro, data, seq) -# define BOOST_PP_SEQ_FOR_EACH_D(macro, data, seq) BOOST_PP_FOR((macro, data, seq (nil)), BOOST_PP_SEQ_FOR_EACH_P, BOOST_PP_SEQ_FOR_EACH_O, BOOST_PP_SEQ_FOR_EACH_M) +# define BOOST_PP_SEQ_FOR_EACH_D(macro, data, seq) BOOST_PP_SEQ_FOR_EACH_DETAIL_CHECK(macro, data, seq) # endif # -# define BOOST_PP_SEQ_FOR_EACH_P(r, x) BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(BOOST_PP_TUPLE_ELEM(3, 2, x))) +# define BOOST_PP_SEQ_FOR_EACH_DETAIL_CHECK_EXEC(macro, data, seq) BOOST_PP_FOR((macro, data, seq, BOOST_PP_SEQ_SIZE(seq)), BOOST_PP_SEQ_FOR_EACH_P, BOOST_PP_SEQ_FOR_EACH_O, BOOST_PP_SEQ_FOR_EACH_M) +# define BOOST_PP_SEQ_FOR_EACH_DETAIL_CHECK_EMPTY(macro, data, seq) +# +# define BOOST_PP_SEQ_FOR_EACH_DETAIL_CHECK(macro, data, seq) \ + BOOST_PP_IIF \ + ( \ + BOOST_PP_SEQ_DETAIL_IS_NOT_EMPTY(seq), \ + BOOST_PP_SEQ_FOR_EACH_DETAIL_CHECK_EXEC, \ + BOOST_PP_SEQ_FOR_EACH_DETAIL_CHECK_EMPTY \ + ) \ + (macro, data, seq) \ +/**/ +# +# define BOOST_PP_SEQ_FOR_EACH_P(r, x) BOOST_PP_TUPLE_ELEM(4, 3, x) # # if BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_STRICT() # define BOOST_PP_SEQ_FOR_EACH_O(r, x) BOOST_PP_SEQ_FOR_EACH_O_I x # else -# define BOOST_PP_SEQ_FOR_EACH_O(r, x) BOOST_PP_SEQ_FOR_EACH_O_I(BOOST_PP_TUPLE_ELEM(3, 0, x), BOOST_PP_TUPLE_ELEM(3, 1, x), BOOST_PP_TUPLE_ELEM(3, 2, x)) +# define BOOST_PP_SEQ_FOR_EACH_O(r, x) BOOST_PP_SEQ_FOR_EACH_O_I(BOOST_PP_TUPLE_ELEM(4, 0, x), BOOST_PP_TUPLE_ELEM(4, 1, x), BOOST_PP_TUPLE_ELEM(4, 2, x), BOOST_PP_TUPLE_ELEM(4, 3, x)) # endif # -# define BOOST_PP_SEQ_FOR_EACH_O_I(macro, data, seq) (macro, data, BOOST_PP_SEQ_TAIL(seq)) +# define BOOST_PP_SEQ_FOR_EACH_O_I(macro, data, seq, sz) \ + BOOST_PP_SEQ_FOR_EACH_O_I_DEC(macro, data, seq, BOOST_PP_DEC(sz)) \ +/**/ +# define BOOST_PP_SEQ_FOR_EACH_O_I_DEC(macro, data, seq, sz) \ + ( \ + macro, \ + data, \ + BOOST_PP_IF \ + ( \ + sz, \ + BOOST_PP_SEQ_FOR_EACH_O_I_TAIL, \ + BOOST_PP_SEQ_FOR_EACH_O_I_NIL \ + ) \ + (seq), \ + sz \ + ) \ +/**/ +# define BOOST_PP_SEQ_FOR_EACH_O_I_TAIL(seq) BOOST_PP_SEQ_TAIL(seq) +# define BOOST_PP_SEQ_FOR_EACH_O_I_NIL(seq) BOOST_PP_NIL # # if BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_STRICT() -# define BOOST_PP_SEQ_FOR_EACH_M(r, x) BOOST_PP_SEQ_FOR_EACH_M_IM(r, BOOST_PP_TUPLE_REM_3 x) +# define BOOST_PP_SEQ_FOR_EACH_M(r, x) BOOST_PP_SEQ_FOR_EACH_M_IM(r, BOOST_PP_TUPLE_REM_4 x) # define BOOST_PP_SEQ_FOR_EACH_M_IM(r, im) BOOST_PP_SEQ_FOR_EACH_M_I(r, im) # else -# define BOOST_PP_SEQ_FOR_EACH_M(r, x) BOOST_PP_SEQ_FOR_EACH_M_I(r, BOOST_PP_TUPLE_ELEM(3, 0, x), BOOST_PP_TUPLE_ELEM(3, 1, x), BOOST_PP_TUPLE_ELEM(3, 2, x)) +# define BOOST_PP_SEQ_FOR_EACH_M(r, x) BOOST_PP_SEQ_FOR_EACH_M_I(r, BOOST_PP_TUPLE_ELEM(4, 0, x), BOOST_PP_TUPLE_ELEM(4, 1, x), BOOST_PP_TUPLE_ELEM(4, 2, x), BOOST_PP_TUPLE_ELEM(4, 3, x)) # endif # -# define BOOST_PP_SEQ_FOR_EACH_M_I(r, macro, data, seq) macro(r, data, BOOST_PP_SEQ_HEAD(seq)) +# define BOOST_PP_SEQ_FOR_EACH_M_I(r, macro, data, seq, sz) macro(r, data, BOOST_PP_SEQ_HEAD(seq)) # # /* BOOST_PP_SEQ_FOR_EACH_R */ # # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG() -# define BOOST_PP_SEQ_FOR_EACH_R(r, macro, data, seq) BOOST_PP_FOR_ ## r((macro, data, seq (nil)), BOOST_PP_SEQ_FOR_EACH_P, BOOST_PP_SEQ_FOR_EACH_O, BOOST_PP_SEQ_FOR_EACH_M) +# define BOOST_PP_SEQ_FOR_EACH_R(r, macro, data, seq) BOOST_PP_SEQ_FOR_EACH_DETAIL_CHECK_R(r, macro, data, seq) # else # define BOOST_PP_SEQ_FOR_EACH_R(r, macro, data, seq) BOOST_PP_SEQ_FOR_EACH_R_I(r, macro, data, seq) -# define BOOST_PP_SEQ_FOR_EACH_R_I(r, macro, data, seq) BOOST_PP_FOR_ ## r((macro, data, seq (nil)), BOOST_PP_SEQ_FOR_EACH_P, BOOST_PP_SEQ_FOR_EACH_O, BOOST_PP_SEQ_FOR_EACH_M) +# define BOOST_PP_SEQ_FOR_EACH_R_I(r, macro, data, seq) BOOST_PP_SEQ_FOR_EACH_DETAIL_CHECK_R(r, macro, data, seq) # endif # +# define BOOST_PP_SEQ_FOR_EACH_DETAIL_CHECK_EXEC_R(r, macro, data, seq) BOOST_PP_FOR_ ## r((macro, data, seq, BOOST_PP_SEQ_SIZE(seq)), BOOST_PP_SEQ_FOR_EACH_P, BOOST_PP_SEQ_FOR_EACH_O, BOOST_PP_SEQ_FOR_EACH_M) +# define BOOST_PP_SEQ_FOR_EACH_DETAIL_CHECK_EMPTY_R(r, macro, data, seq) +# +# define BOOST_PP_SEQ_FOR_EACH_DETAIL_CHECK_R(r, macro, data, seq) \ + BOOST_PP_IIF \ + ( \ + BOOST_PP_SEQ_DETAIL_IS_NOT_EMPTY(seq), \ + BOOST_PP_SEQ_FOR_EACH_DETAIL_CHECK_EXEC_R, \ + BOOST_PP_SEQ_FOR_EACH_DETAIL_CHECK_EMPTY_R \ + ) \ + (r, macro, data, seq) \ +/**/ +# # endif diff --git a/boost/preprocessor/seq/for_each_i.hpp b/boost/preprocessor/seq/for_each_i.hpp index c8edf5af44..81028d77de 100644 --- a/boost/preprocessor/seq/for_each_i.hpp +++ b/boost/preprocessor/seq/for_each_i.hpp @@ -15,47 +15,95 @@ # include <boost/preprocessor/arithmetic/dec.hpp> # include <boost/preprocessor/arithmetic/inc.hpp> # include <boost/preprocessor/config/config.hpp> +# include <boost/preprocessor/control/if.hpp> +# include <boost/preprocessor/control/iif.hpp> # include <boost/preprocessor/repetition/for.hpp> # include <boost/preprocessor/seq/seq.hpp> # include <boost/preprocessor/seq/size.hpp> +# include <boost/preprocessor/seq/detail/is_empty.hpp> # include <boost/preprocessor/tuple/elem.hpp> # include <boost/preprocessor/tuple/rem.hpp> # # /* BOOST_PP_SEQ_FOR_EACH_I */ # # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG() -# define BOOST_PP_SEQ_FOR_EACH_I(macro, data, seq) BOOST_PP_FOR((macro, data, seq (nil), 0), BOOST_PP_SEQ_FOR_EACH_I_P, BOOST_PP_SEQ_FOR_EACH_I_O, BOOST_PP_SEQ_FOR_EACH_I_M) +# define BOOST_PP_SEQ_FOR_EACH_I(macro, data, seq) BOOST_PP_SEQ_FOR_EACH_I_DETAIL_CHECK(macro, data, seq) # else # define BOOST_PP_SEQ_FOR_EACH_I(macro, data, seq) BOOST_PP_SEQ_FOR_EACH_I_I(macro, data, seq) -# define BOOST_PP_SEQ_FOR_EACH_I_I(macro, data, seq) BOOST_PP_FOR((macro, data, seq (nil), 0), BOOST_PP_SEQ_FOR_EACH_I_P, BOOST_PP_SEQ_FOR_EACH_I_O, BOOST_PP_SEQ_FOR_EACH_I_M) +# define BOOST_PP_SEQ_FOR_EACH_I_I(macro, data, seq) BOOST_PP_SEQ_FOR_EACH_I_DETAIL_CHECK(macro, data, seq) # endif # -# define BOOST_PP_SEQ_FOR_EACH_I_P(r, x) BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(BOOST_PP_TUPLE_ELEM(4, 2, x))) +# define BOOST_PP_SEQ_FOR_EACH_I_DETAIL_CHECK_EXEC(macro, data, seq) BOOST_PP_FOR((macro, data, seq, 0, BOOST_PP_SEQ_SIZE(seq)), BOOST_PP_SEQ_FOR_EACH_I_P, BOOST_PP_SEQ_FOR_EACH_I_O, BOOST_PP_SEQ_FOR_EACH_I_M) +# define BOOST_PP_SEQ_FOR_EACH_I_DETAIL_CHECK_EMPTY(macro, data, seq) +# +# define BOOST_PP_SEQ_FOR_EACH_I_DETAIL_CHECK(macro, data, seq) \ + BOOST_PP_IIF \ + ( \ + BOOST_PP_SEQ_DETAIL_IS_NOT_EMPTY(seq), \ + BOOST_PP_SEQ_FOR_EACH_I_DETAIL_CHECK_EXEC, \ + BOOST_PP_SEQ_FOR_EACH_I_DETAIL_CHECK_EMPTY \ + ) \ + (macro, data, seq) \ +/**/ +# +# define BOOST_PP_SEQ_FOR_EACH_I_P(r, x) BOOST_PP_TUPLE_ELEM(5, 4, x) # # if BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_STRICT() # define BOOST_PP_SEQ_FOR_EACH_I_O(r, x) BOOST_PP_SEQ_FOR_EACH_I_O_I x # else -# define BOOST_PP_SEQ_FOR_EACH_I_O(r, x) BOOST_PP_SEQ_FOR_EACH_I_O_I(BOOST_PP_TUPLE_ELEM(4, 0, x), BOOST_PP_TUPLE_ELEM(4, 1, x), BOOST_PP_TUPLE_ELEM(4, 2, x), BOOST_PP_TUPLE_ELEM(4, 3, x)) +# define BOOST_PP_SEQ_FOR_EACH_I_O(r, x) BOOST_PP_SEQ_FOR_EACH_I_O_I(BOOST_PP_TUPLE_ELEM(5, 0, x), BOOST_PP_TUPLE_ELEM(5, 1, x), BOOST_PP_TUPLE_ELEM(5, 2, x), BOOST_PP_TUPLE_ELEM(5, 3, x), BOOST_PP_TUPLE_ELEM(5, 4, x)) # endif # -# define BOOST_PP_SEQ_FOR_EACH_I_O_I(macro, data, seq, i) (macro, data, BOOST_PP_SEQ_TAIL(seq), BOOST_PP_INC(i)) +# define BOOST_PP_SEQ_FOR_EACH_I_O_I(macro, data, seq, i, sz) \ + BOOST_PP_SEQ_FOR_EACH_I_O_I_DEC(macro, data, seq, i, BOOST_PP_DEC(sz)) \ +/**/ +# define BOOST_PP_SEQ_FOR_EACH_I_O_I_DEC(macro, data, seq, i, sz) \ + ( \ + macro, \ + data, \ + BOOST_PP_IF \ + ( \ + sz, \ + BOOST_PP_SEQ_FOR_EACH_I_O_I_TAIL, \ + BOOST_PP_SEQ_FOR_EACH_I_O_I_NIL \ + ) \ + (seq), \ + BOOST_PP_INC(i), \ + sz \ + ) \ +/**/ +# define BOOST_PP_SEQ_FOR_EACH_I_O_I_TAIL(seq) BOOST_PP_SEQ_TAIL(seq) +# define BOOST_PP_SEQ_FOR_EACH_I_O_I_NIL(seq) BOOST_PP_NIL # # if BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_STRICT() -# define BOOST_PP_SEQ_FOR_EACH_I_M(r, x) BOOST_PP_SEQ_FOR_EACH_I_M_IM(r, BOOST_PP_TUPLE_REM_4 x) +# define BOOST_PP_SEQ_FOR_EACH_I_M(r, x) BOOST_PP_SEQ_FOR_EACH_I_M_IM(r, BOOST_PP_TUPLE_REM_5 x) # define BOOST_PP_SEQ_FOR_EACH_I_M_IM(r, im) BOOST_PP_SEQ_FOR_EACH_I_M_I(r, im) # else -# define BOOST_PP_SEQ_FOR_EACH_I_M(r, x) BOOST_PP_SEQ_FOR_EACH_I_M_I(r, BOOST_PP_TUPLE_ELEM(4, 0, x), BOOST_PP_TUPLE_ELEM(4, 1, x), BOOST_PP_TUPLE_ELEM(4, 2, x), BOOST_PP_TUPLE_ELEM(4, 3, x)) +# define BOOST_PP_SEQ_FOR_EACH_I_M(r, x) BOOST_PP_SEQ_FOR_EACH_I_M_I(r, BOOST_PP_TUPLE_ELEM(5, 0, x), BOOST_PP_TUPLE_ELEM(5, 1, x), BOOST_PP_TUPLE_ELEM(5, 2, x), BOOST_PP_TUPLE_ELEM(5, 3, x), BOOST_PP_TUPLE_ELEM(5, 4, x)) # endif # -# define BOOST_PP_SEQ_FOR_EACH_I_M_I(r, macro, data, seq, i) macro(r, data, i, BOOST_PP_SEQ_HEAD(seq)) +# define BOOST_PP_SEQ_FOR_EACH_I_M_I(r, macro, data, seq, i, sz) macro(r, data, i, BOOST_PP_SEQ_HEAD(seq)) # # /* BOOST_PP_SEQ_FOR_EACH_I_R */ # # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG() -# define BOOST_PP_SEQ_FOR_EACH_I_R(r, macro, data, seq) BOOST_PP_FOR_ ## r((macro, data, seq (nil), 0), BOOST_PP_SEQ_FOR_EACH_I_P, BOOST_PP_SEQ_FOR_EACH_I_O, BOOST_PP_SEQ_FOR_EACH_I_M) +# define BOOST_PP_SEQ_FOR_EACH_I_R(r, macro, data, seq) BOOST_PP_SEQ_FOR_EACH_I_R_DETAIL_CHECK(r, macro, data, seq) # else # define BOOST_PP_SEQ_FOR_EACH_I_R(r, macro, data, seq) BOOST_PP_SEQ_FOR_EACH_I_R_I(r, macro, data, seq) -# define BOOST_PP_SEQ_FOR_EACH_I_R_I(r, macro, data, seq) BOOST_PP_FOR_ ## r((macro, data, seq (nil), 0), BOOST_PP_SEQ_FOR_EACH_I_P, BOOST_PP_SEQ_FOR_EACH_I_O, BOOST_PP_SEQ_FOR_EACH_I_M) +# define BOOST_PP_SEQ_FOR_EACH_I_R_I(r, macro, data, seq) BOOST_PP_SEQ_FOR_EACH_I_R_DETAIL_CHECK(r, macro, data, seq) # endif # +# define BOOST_PP_SEQ_FOR_EACH_I_R_DETAIL_CHECK_EXEC(r, macro, data, seq) BOOST_PP_FOR_ ## r((macro, data, seq, 0, BOOST_PP_SEQ_SIZE(seq)), BOOST_PP_SEQ_FOR_EACH_I_P, BOOST_PP_SEQ_FOR_EACH_I_O, BOOST_PP_SEQ_FOR_EACH_I_M) +# define BOOST_PP_SEQ_FOR_EACH_I_R_DETAIL_CHECK_EMPTY(r, macro, data, seq) +# +# define BOOST_PP_SEQ_FOR_EACH_I_R_DETAIL_CHECK(r, macro, data, seq) \ + BOOST_PP_IIF \ + ( \ + BOOST_PP_SEQ_DETAIL_IS_NOT_EMPTY(seq), \ + BOOST_PP_SEQ_FOR_EACH_I_R_DETAIL_CHECK_EXEC, \ + BOOST_PP_SEQ_FOR_EACH_I_R_DETAIL_CHECK_EMPTY \ + ) \ + (r, macro, data, seq) \ +/**/ +# # endif diff --git a/boost/preprocessor/seq/replace.hpp b/boost/preprocessor/seq/replace.hpp index d6107a7626..0cf6b77554 100644 --- a/boost/preprocessor/seq/replace.hpp +++ b/boost/preprocessor/seq/replace.hpp @@ -12,18 +12,34 @@ # ifndef BOOST_PREPROCESSOR_SEQ_REPLACE_HPP # define BOOST_PREPROCESSOR_SEQ_REPLACE_HPP # +# include <boost/preprocessor/arithmetic/dec.hpp> # include <boost/preprocessor/arithmetic/inc.hpp> # include <boost/preprocessor/config/config.hpp> +# include <boost/preprocessor/comparison/equal.hpp> +# include <boost/preprocessor/control/iif.hpp> # include <boost/preprocessor/seq/first_n.hpp> # include <boost/preprocessor/seq/rest_n.hpp> +# include <boost/preprocessor/seq/size.hpp> # # /* BOOST_PP_SEQ_REPLACE */ # # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG() -# 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) +# define BOOST_PP_SEQ_REPLACE(seq, i, elem) BOOST_PP_SEQ_FIRST_N(i, seq) (elem) BOOST_PP_SEQ_REPLACE_DETAIL_REST(seq, i) # else # define BOOST_PP_SEQ_REPLACE(seq, i, elem) BOOST_PP_SEQ_REPLACE_I(seq, i, elem) -# 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) +# 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) # endif # +# define BOOST_PP_SEQ_REPLACE_DETAIL_REST_EMPTY(seq, i) +# define BOOST_PP_SEQ_REPLACE_DETAIL_REST_VALID(seq, i) BOOST_PP_SEQ_REST_N(BOOST_PP_INC(i), seq) +# define BOOST_PP_SEQ_REPLACE_DETAIL_REST(seq, i) \ + BOOST_PP_IIF \ + ( \ + BOOST_PP_EQUAL(i,BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(seq))), \ + BOOST_PP_SEQ_REPLACE_DETAIL_REST_EMPTY, \ + BOOST_PP_SEQ_REPLACE_DETAIL_REST_VALID \ + ) \ + (seq, i) \ +/**/ +# # endif diff --git a/boost/preprocessor/seq/rest_n.hpp b/boost/preprocessor/seq/rest_n.hpp index 64233760de..4aefba4fa1 100644 --- a/boost/preprocessor/seq/rest_n.hpp +++ b/boost/preprocessor/seq/rest_n.hpp @@ -13,18 +13,34 @@ # define BOOST_PREPROCESSOR_SEQ_REST_N_HPP # # include <boost/preprocessor/arithmetic/inc.hpp> +# include <boost/preprocessor/comparison/not_equal.hpp> # include <boost/preprocessor/config/config.hpp> +# include <boost/preprocessor/control/expr_iif.hpp> # include <boost/preprocessor/facilities/identity.hpp> +# include <boost/preprocessor/logical/bitand.hpp> +# include <boost/preprocessor/seq/detail/is_empty.hpp> # include <boost/preprocessor/seq/detail/split.hpp> # include <boost/preprocessor/tuple/elem.hpp> # # /* BOOST_PP_SEQ_REST_N */ # # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG() -# define BOOST_PP_SEQ_REST_N(n, seq) BOOST_PP_TUPLE_ELEM(2, 1, BOOST_PP_SEQ_SPLIT(BOOST_PP_INC(n), BOOST_PP_IDENTITY( (nil) seq )))() +# define BOOST_PP_SEQ_REST_N(n, seq) BOOST_PP_SEQ_REST_N_DETAIL_EXEC(n, seq, BOOST_PP_SEQ_DETAIL_EMPTY_SIZE(seq)) # else # define BOOST_PP_SEQ_REST_N(n, seq) BOOST_PP_SEQ_REST_N_I(n, seq) -# define BOOST_PP_SEQ_REST_N_I(n, seq) BOOST_PP_TUPLE_ELEM(2, 1, BOOST_PP_SEQ_SPLIT(BOOST_PP_INC(n), BOOST_PP_IDENTITY( (nil) seq )))() +# define BOOST_PP_SEQ_REST_N_I(n, seq) BOOST_PP_SEQ_REST_N_DETAIL_EXEC(n, seq, BOOST_PP_SEQ_DETAIL_EMPTY_SIZE(seq)) # endif # +# define BOOST_PP_SEQ_REST_N_DETAIL_EXEC(n, seq, size) \ + BOOST_PP_EXPR_IIF \ + ( \ + BOOST_PP_BITAND \ + ( \ + BOOST_PP_SEQ_DETAIL_IS_NOT_EMPTY_SIZE(size), \ + BOOST_PP_NOT_EQUAL(n,size) \ + ), \ + BOOST_PP_TUPLE_ELEM(2, 1, BOOST_PP_SEQ_SPLIT(BOOST_PP_INC(n), BOOST_PP_IDENTITY( (nil) seq )))() \ + ) \ +/**/ +# # endif diff --git a/boost/preprocessor/seq/size.hpp b/boost/preprocessor/seq/size.hpp index 385c00a192..b5c8d9d051 100644 --- a/boost/preprocessor/seq/size.hpp +++ b/boost/preprocessor/seq/size.hpp @@ -543,5 +543,6 @@ # define BOOST_PP_SEQ_SIZE_BOOST_PP_SEQ_SIZE_254 254 # define BOOST_PP_SEQ_SIZE_BOOST_PP_SEQ_SIZE_255 255 # define BOOST_PP_SEQ_SIZE_BOOST_PP_SEQ_SIZE_256 256 +# define BOOST_PP_SEQ_SIZE_BOOST_PP_SEQ_SIZE_257 257 # # endif |