From 0a23b4d6a6ce54bebc2f5b210aadcc473f59161d Mon Sep 17 00:00:00 2001 From: Edward Diener Date: Sun, 27 Apr 2014 12:00:13 -0400 Subject: [PATCH 01/58] Fixes for empty tuple processing --- .../preprocessor/array/detail/get_data.hpp | 52 +++++++++++++++++++ .../boost/preprocessor/array/push_back.hpp | 4 +- .../boost/preprocessor/array/push_front.hpp | 4 +- include/boost/preprocessor/list/to_array.hpp | 6 ++- include/boost/preprocessor/tuple/elem.hpp | 27 +++++++++- 5 files changed, 87 insertions(+), 6 deletions(-) create mode 100644 include/boost/preprocessor/array/detail/get_data.hpp diff --git a/include/boost/preprocessor/array/detail/get_data.hpp b/include/boost/preprocessor/array/detail/get_data.hpp new file mode 100644 index 0000000..d72547a --- /dev/null +++ b/include/boost/preprocessor/array/detail/get_data.hpp @@ -0,0 +1,52 @@ +# /* ************************************************************************** +# * * +# * (C) Copyright Edward Diener 2014. * +# * 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_ARRAY_DETAIL_GET_DATA_HPP +# define BOOST_PREPROCESSOR_ARRAY_DETAIL_GET_DATA_HPP +# +# include +# include +# +# if BOOST_PP_VARIADICS && BOOST_PP_VARIADICS_MSVC && _MSC_VER != 1400 +# include +# include +# include +# include +# +# /* BOOST_PP_ARRAY_DETAIL_GET_DATA */ +# +# define BOOST_PP_ARRAY_DETAIL_GET_DATA_REM(...) BOOST_PP_CAT(__VA_ARGS__,) +# define BOOST_PP_ARRAY_DETAIL_GET_DATA_TUPLE_REM(size) BOOST_PP_ARRAY_DETAIL_GET_DATA_REM +# define BOOST_PP_ARRAY_DETAIL_GET_DATA_SINGLE(size, data) BOOST_PP_ARRAY_DETAIL_GET_DATA_TUPLE_REM(size) data +# define BOOST_PP_ARRAY_DETAIL_GET_DATA_ANY(size, data) BOOST_PP_TUPLE_REM(size) data +# define BOOST_PP_ARRAY_DETAIL_GET_DATA_CHECK_ZERO(size, data) \ + BOOST_PP_IF \ + ( \ + size, \ + BOOST_PP_ARRAY_DETAIL_GET_DATA_ANY, \ + BOOST_PP_ARRAY_DETAIL_GET_DATA_SINGLE \ + ) \ + (size,data) \ +/**/ +# define BOOST_PP_ARRAY_DETAIL_GET_DATA(size, data) \ + BOOST_PP_IIF \ + ( \ + BOOST_PP_IS_1(size), \ + BOOST_PP_ARRAY_DETAIL_GET_DATA_SINGLE, \ + BOOST_PP_ARRAY_DETAIL_GET_DATA_CHECK_ZERO \ + ) \ + (size,data) \ +/**/ +# else +# define BOOST_PP_ARRAY_DETAIL_GET_DATA(size, data) BOOST_PP_TUPLE_REM(size) data +# endif /* BOOST_PP_VARIADICS && BOOST_PP_VARIADICS_MSVC && _MSC_VER != 1400 */ +# +# endif /* BOOST_PREPROCESSOR_ARRAY_DETAIL_GET_DATA_HPP */ diff --git a/include/boost/preprocessor/array/push_back.hpp b/include/boost/preprocessor/array/push_back.hpp index 6d98d8e..5dce9e0 100644 --- a/include/boost/preprocessor/array/push_back.hpp +++ b/include/boost/preprocessor/array/push_back.hpp @@ -1,6 +1,7 @@ # /* ************************************************************************** # * * # * (C) Copyright Paul Mensonides 2002. +# * (C) Copyright Edward Diener 2014. # * 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) @@ -18,6 +19,7 @@ # include # include # include +# include # # /* BOOST_PP_ARRAY_PUSH_BACK */ # @@ -28,6 +30,6 @@ # define BOOST_PP_ARRAY_PUSH_BACK_D(array, elem) BOOST_PP_ARRAY_PUSH_BACK_I(BOOST_PP_ARRAY_SIZE(array), BOOST_PP_ARRAY_DATA(array), elem) # endif # -# define BOOST_PP_ARRAY_PUSH_BACK_I(size, data, elem) (BOOST_PP_INC(size), (BOOST_PP_TUPLE_REM(size) data BOOST_PP_COMMA_IF(size) elem)) +# define BOOST_PP_ARRAY_PUSH_BACK_I(size, data, elem) (BOOST_PP_INC(size), (BOOST_PP_ARRAY_DETAIL_GET_DATA(size,data) BOOST_PP_COMMA_IF(size) elem)) # # endif diff --git a/include/boost/preprocessor/array/push_front.hpp b/include/boost/preprocessor/array/push_front.hpp index 59344c3..a6c6dc7 100644 --- a/include/boost/preprocessor/array/push_front.hpp +++ b/include/boost/preprocessor/array/push_front.hpp @@ -1,6 +1,7 @@ # /* ************************************************************************** # * * # * (C) Copyright Paul Mensonides 2002. +# * (C) Copyright Edward Diener 2014. # * 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) @@ -18,6 +19,7 @@ # include # include # include +# include # # /* BOOST_PP_ARRAY_PUSH_FRONT */ # @@ -28,6 +30,6 @@ # define BOOST_PP_ARRAY_PUSH_FRONT_D(array, elem) BOOST_PP_ARRAY_PUSH_FRONT_I(BOOST_PP_ARRAY_SIZE(array), BOOST_PP_ARRAY_DATA(array), elem) # endif # -# define BOOST_PP_ARRAY_PUSH_FRONT_I(size, data, elem) (BOOST_PP_INC(size), (elem BOOST_PP_COMMA_IF(size) BOOST_PP_TUPLE_REM(size) data)) +# define BOOST_PP_ARRAY_PUSH_FRONT_I(size, data, elem) (BOOST_PP_INC(size), (elem BOOST_PP_COMMA_IF(size) BOOST_PP_ARRAY_DETAIL_GET_DATA(size,data))) # # endif diff --git a/include/boost/preprocessor/list/to_array.hpp b/include/boost/preprocessor/list/to_array.hpp index 83f8a63..5a0433d 100644 --- a/include/boost/preprocessor/list/to_array.hpp +++ b/include/boost/preprocessor/list/to_array.hpp @@ -1,6 +1,7 @@ # /* ************************************************************************** # * * -# * (C) Copyright Edward Diener 2011. +# * (C) Copyright Paul Mensonides 2011. +# * (C) Copyright Edward Diener 2011,2014. # * 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) @@ -19,6 +20,7 @@ # include # include # include +# include # # /* BOOST_PP_LIST_TO_ARRAY */ # @@ -114,7 +116,7 @@ # endif # define BOOST_PP_LIST_TO_ARRAY_P(d, state) BOOST_PP_LIST_IS_CONS(BOOST_PP_TUPLE_ELEM(3, 0, state)) # define BOOST_PP_LIST_TO_ARRAY_O(d, state) BOOST_PP_LIST_TO_ARRAY_O_I state -# define BOOST_PP_LIST_TO_ARRAY_O_I(list, size, tuple) (BOOST_PP_LIST_REST(list), BOOST_PP_INC(size), (BOOST_PP_TUPLE_REM(size) tuple, BOOST_PP_LIST_FIRST(list))) +# define BOOST_PP_LIST_TO_ARRAY_O_I(list, size, tuple) (BOOST_PP_LIST_REST(list), BOOST_PP_INC(size), (BOOST_PP_ARRAY_DETAIL_GET_DATA(size,tuple), BOOST_PP_LIST_FIRST(list))) # # /* BOOST_PP_LIST_TO_ARRAY_D */ # diff --git a/include/boost/preprocessor/tuple/elem.hpp b/include/boost/preprocessor/tuple/elem.hpp index 3eba1c5..762a171 100644 --- a/include/boost/preprocessor/tuple/elem.hpp +++ b/include/boost/preprocessor/tuple/elem.hpp @@ -8,7 +8,7 @@ # */ # # /* Revised by Paul Mensonides (2002-2011) */ -# /* Revised by Edward Diener (2011) */ +# /* Revised by Edward Diener (2011,2014) */ # # /* See http://www.boost.org for most recent version. */ # @@ -21,15 +21,38 @@ # include # include # +# if BOOST_PP_VARIADICS && BOOST_PP_VARIADICS_MSVC +# include +# include +# include +# endif +# # if BOOST_PP_VARIADICS # if BOOST_PP_VARIADICS_MSVC # define BOOST_PP_TUPLE_ELEM(...) BOOST_PP_TUPLE_ELEM_I(BOOST_PP_OVERLOAD(BOOST_PP_TUPLE_ELEM_O_, __VA_ARGS__), (__VA_ARGS__)) # define BOOST_PP_TUPLE_ELEM_I(m, args) BOOST_PP_TUPLE_ELEM_II(m, args) # define BOOST_PP_TUPLE_ELEM_II(m, args) BOOST_PP_CAT(m ## args,) +/* + Use BOOST_PP_TUPLE_ELEM_O_2_CAT if it is a single element tuple ( which might be empty ) + else use BOOST_PP_REM. This fixes a VC++ problem with an empty tuple and BOOST_PP_TUPLE_ELEM + functionality. +*/ +# define BOOST_PP_TUPLE_ELEM_O_2_CAT(...) BOOST_PP_CAT(__VA_ARGS__,) +# define BOOST_PP_TUPLE_ELEM_O_2_SINGLE(n, tuple) BOOST_PP_VARIADIC_ELEM(n, BOOST_PP_TUPLE_ELEM_O_2_CAT tuple) +# define BOOST_PP_TUPLE_ELEM_O_2_ANY(n, tuple) BOOST_PP_VARIADIC_ELEM(n, BOOST_PP_REM tuple) +# define BOOST_PP_TUPLE_ELEM_O_2(n, tuple) \ + BOOST_PP_IIF \ + ( \ + BOOST_PP_EQUAL(BOOST_PP_TUPLE_SIZE(tuple),1), \ + BOOST_PP_TUPLE_ELEM_O_2_SINGLE, \ + BOOST_PP_TUPLE_ELEM_O_2_ANY \ + ) \ + (n, tuple) \ + /**/ # else # define BOOST_PP_TUPLE_ELEM(...) BOOST_PP_OVERLOAD(BOOST_PP_TUPLE_ELEM_O_, __VA_ARGS__)(__VA_ARGS__) +# define BOOST_PP_TUPLE_ELEM_O_2(n, tuple) BOOST_PP_VARIADIC_ELEM(n, BOOST_PP_REM tuple) # endif -# define BOOST_PP_TUPLE_ELEM_O_2(n, tuple) BOOST_PP_VARIADIC_ELEM(n, BOOST_PP_REM tuple) # define BOOST_PP_TUPLE_ELEM_O_3(size, n, tuple) BOOST_PP_TUPLE_ELEM_O_2(n, tuple) # else # if BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MSVC() From d2bfda8308cb568372fb41b49b5393b6b9b904ea Mon Sep 17 00:00:00 2001 From: Edward Diener Date: Mon, 28 Apr 2014 19:24:42 -0400 Subject: [PATCH 02/58] Added variadic is_empty and is_begin_parens along with tests. --- .../facilities/detail/is_empty.hpp | 55 ++++++++++++++++++ .../preprocessor/facilities/is_empty.hpp | 13 ++++- .../facilities/is_empty_variadic.hpp | 56 +++++++++++++++++++ include/boost/preprocessor/punctuation.hpp | 1 + .../punctuation/detail/is_begin_parens.hpp | 48 ++++++++++++++++ .../punctuation/is_begin_parens.hpp | 51 +++++++++++++++++ test/Jamfile.v2 | 16 ++++++ test/isempty.c | 12 ++++ test/isempty.cpp | 12 ++++ test/isempty.cxx | 42 ++++++++++++++ test/punctuation.c | 14 +++++ test/punctuation.cpp | 14 +++++ test/punctuation.cxx | 42 ++++++++++++++ 13 files changed, 375 insertions(+), 1 deletion(-) create mode 100644 include/boost/preprocessor/facilities/detail/is_empty.hpp create mode 100644 include/boost/preprocessor/facilities/is_empty_variadic.hpp create mode 100644 include/boost/preprocessor/punctuation/detail/is_begin_parens.hpp create mode 100644 include/boost/preprocessor/punctuation/is_begin_parens.hpp create mode 100644 test/isempty.c create mode 100644 test/isempty.cpp create mode 100644 test/isempty.cxx create mode 100644 test/punctuation.c create mode 100644 test/punctuation.cpp create mode 100644 test/punctuation.cxx diff --git a/include/boost/preprocessor/facilities/detail/is_empty.hpp b/include/boost/preprocessor/facilities/detail/is_empty.hpp new file mode 100644 index 0000000..e044970 --- /dev/null +++ b/include/boost/preprocessor/facilities/detail/is_empty.hpp @@ -0,0 +1,55 @@ +# /* ************************************************************************** +# * * +# * (C) Copyright Edward Diener 2014. +# * 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_DETAIL_IS_EMPTY_HPP +#define BOOST_PREPROCESSOR_DETAIL_IS_EMPTY_HPP + +#include + +#if BOOST_PP_VARIADICS_MSVC + +# pragma warning(once:4002) + +#define BOOST_PP_DETAIL_IS_EMPTY_IIF_0(t, b) b +#define BOOST_PP_DETAIL_IS_EMPTY_IIF_1(t, b) t + +#else + +#define BOOST_PP_DETAIL_IS_EMPTY_IIF_0(t, ...) __VA_ARGS__ +#define BOOST_PP_DETAIL_IS_EMPTY_IIF_1(t, ...) t + +#endif + +#if BOOST_PP_VARIADICS_MSVC && _MSC_VER <= 1400 + +#define BOOST_PP_DETAIL_IS_EMPTY_PROCESS(param) \ + BOOST_PP_IS_BEGIN_PARENS \ + ( \ + BOOST_PP_DETAIL_IS_EMPTY_NON_FUNCTION_C param () \ + ) \ +/**/ + +#else + +#define BOOST_PP_DETAIL_IS_EMPTY_PROCESS(...) \ + BOOST_PP_IS_BEGIN_PARENS \ + ( \ + BOOST_PP_DETAIL_IS_EMPTY_NON_FUNCTION_C __VA_ARGS__ () \ + ) \ +/**/ + +#endif + +#define BOOST_PP_DETAIL_IS_EMPTY_PRIMITIVE_CAT(a, b) a ## b +#define BOOST_PP_DETAIL_IS_EMPTY_IIF(bit) BOOST_PP_DETAIL_IS_EMPTY_PRIMITIVE_CAT(BOOST_PP_DETAIL_IS_EMPTY_IIF_,bit) +#define BOOST_PP_DETAIL_IS_EMPTY_NON_FUNCTION_C(...) () + +#endif /* BOOST_PREPROCESSOR_DETAIL_IS_EMPTY_HPP */ diff --git a/include/boost/preprocessor/facilities/is_empty.hpp b/include/boost/preprocessor/facilities/is_empty.hpp index 638265c..b1094d8 100644 --- a/include/boost/preprocessor/facilities/is_empty.hpp +++ b/include/boost/preprocessor/facilities/is_empty.hpp @@ -1,6 +1,7 @@ # /* ************************************************************************** # * * # * (C) Copyright Paul Mensonides 2003. +# * (C) Copyright Edward Diener 2014. # * 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) @@ -13,6 +14,14 @@ # define BOOST_PREPROCESSOR_FACILITIES_IS_EMPTY_HPP # # include +# +# if BOOST_PP_VARIADICS +# +# include +# +# else +# +# include # include # include # include @@ -40,4 +49,6 @@ # define BOOST_PP_IS_EMPTY_DEF_BOOST_PP_IS_EMPTY_HELPER 0, BOOST_PP_NIL # endif # -# endif +# endif /* BOOST_PP_VARIADICS */ +# +# endif /* BOOST_PREPROCESSOR_FACILITIES_IS_EMPTY_HPP */ diff --git a/include/boost/preprocessor/facilities/is_empty_variadic.hpp b/include/boost/preprocessor/facilities/is_empty_variadic.hpp new file mode 100644 index 0000000..27b4ec0 --- /dev/null +++ b/include/boost/preprocessor/facilities/is_empty_variadic.hpp @@ -0,0 +1,56 @@ +# /* ************************************************************************** +# * * +# * (C) Copyright Edward Diener 2014. +# * 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_FACILITIES_IS_EMPTY_VARIADIC_HPP +# define BOOST_PREPROCESSOR_FACILITIES_IS_EMPTY_VARIADIC_HPP +# +# include +# +# if BOOST_PP_VARIADICS +# +# include +# include +# +#define BOOST_PP_IS_EMPTY_GEN_ZERO(...) 0 +#if BOOST_PP_VARIADICS_MSVC && _MSC_VER <= 1400 +# +#define BOOST_PP_IS_EMPTY(param) \ + BOOST_PP_DETAIL_IS_EMPTY_IIF \ + ( \ + BOOST_PP_IS_BEGIN_PARENS \ + ( \ + param \ + ) \ + ) \ + ( \ + BOOST_PP_IS_EMPTY_GEN_ZERO, \ + BOOST_PP_DETAIL_IS_EMPTY_PROCESS \ + ) \ + (param) \ +/**/ +# else +#define BOOST_PP_IS_EMPTY(...) \ + BOOST_PP_DETAIL_IS_EMPTY_IIF \ + ( \ + BOOST_PP_IS_BEGIN_PARENS \ + ( \ + __VA_ARGS__ \ + ) \ + ) \ + ( \ + BOOST_PP_IS_EMPTY_GEN_ZERO, \ + BOOST_PP_DETAIL_IS_EMPTY_PROCESS \ + ) \ + (__VA_ARGS__) \ +/**/ +# endif /* BOOST_PP_VARIADICS_MSVC && _MSC_VER <= 1400 */ +# endif /* BOOST_PP_VARIADICS */ +# endif /* BOOST_PREPROCESSOR_FACILITIES_IS_EMPTY_VARIADIC_HPP */ diff --git a/include/boost/preprocessor/punctuation.hpp b/include/boost/preprocessor/punctuation.hpp index 72da73e..a96bbff 100644 --- a/include/boost/preprocessor/punctuation.hpp +++ b/include/boost/preprocessor/punctuation.hpp @@ -14,6 +14,7 @@ # # include # include +# include # include # include # diff --git a/include/boost/preprocessor/punctuation/detail/is_begin_parens.hpp b/include/boost/preprocessor/punctuation/detail/is_begin_parens.hpp new file mode 100644 index 0000000..c94ccf3 --- /dev/null +++ b/include/boost/preprocessor/punctuation/detail/is_begin_parens.hpp @@ -0,0 +1,48 @@ +# /* ************************************************************************** +# * * +# * (C) Copyright Edward Diener 2014. +# * 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_DETAIL_IS_BEGIN_PARENS_HPP +#define BOOST_PREPROCESSOR_DETAIL_IS_BEGIN_PARENS_HPP + +#if BOOST_PP_VARIADICS_MSVC + +#include + +#define BOOST_PP_DETAIL_VD_IBP_CAT(a, b) BOOST_PP_DETAIL_VD_IBP_CAT_I(a, b) +#define BOOST_PP_DETAIL_VD_IBP_CAT_I(a, b) BOOST_PP_DETAIL_VD_IBP_CAT_II(a ## b) +#define BOOST_PP_DETAIL_VD_IBP_CAT_II(res) res + +#define BOOST_PP_DETAIL_IBP_SPLIT(i, ...) \ + BOOST_PP_DETAIL_VD_IBP_CAT(BOOST_PP_DETAIL_IBP_PRIMITIVE_CAT(BOOST_PP_DETAIL_IBP_SPLIT_,i)(__VA_ARGS__),BOOST_PP_EMPTY()) \ +/**/ + +#define BOOST_PP_DETAIL_IBP_IS_VARIADIC_C(...) 1 1 + +#else + +#define BOOST_PP_DETAIL_IBP_SPLIT(i, ...) \ + BOOST_PP_DETAIL_IBP_PRIMITIVE_CAT(BOOST_PP_DETAIL_IBP_SPLIT_,i)(__VA_ARGS__) \ +/**/ + +#define BOOST_PP_DETAIL_IBP_IS_VARIADIC_C(...) 1 + +#endif /* BOOST_PP_VARIADICS_MSVC */ + +#define BOOST_PP_DETAIL_IBP_SPLIT_0(a, ...) a +#define BOOST_PP_DETAIL_IBP_SPLIT_1(a, ...) __VA_ARGS__ + +#define BOOST_PP_DETAIL_IBP_CAT(a, ...) BOOST_PP_DETAIL_IBP_PRIMITIVE_CAT(a,__VA_ARGS__) +#define BOOST_PP_DETAIL_IBP_PRIMITIVE_CAT(a, ...) a ## __VA_ARGS__ + +#define BOOST_PP_DETAIL_IBP_IS_VARIADIC_R_1 1, +#define BOOST_PP_DETAIL_IBP_IS_VARIADIC_R_BOOST_PP_DETAIL_IBP_IS_VARIADIC_C 0, + +#endif /* BOOST_PREPROCESSOR_DETAIL_IS_BEGIN_PARENS_HPP */ diff --git a/include/boost/preprocessor/punctuation/is_begin_parens.hpp b/include/boost/preprocessor/punctuation/is_begin_parens.hpp new file mode 100644 index 0000000..20b32bc --- /dev/null +++ b/include/boost/preprocessor/punctuation/is_begin_parens.hpp @@ -0,0 +1,51 @@ +# /* ************************************************************************** +# * * +# * (C) Copyright Edward Diener 2014. +# * 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_IS_BEGIN_PARENS_HPP +# define BOOST_PREPROCESSOR_IS_BEGIN_PARENS_HPP + +# include + +#if BOOST_PP_VARIADICS + +#include + +#if BOOST_PP_VARIADICS_MSVC && _MSC_VER <= 1400 + +#define BOOST_PP_IS_BEGIN_PARENS(param) \ + BOOST_PP_DETAIL_IBP_SPLIT \ + ( \ + 0, \ + BOOST_PP_DETAIL_IBP_CAT \ + ( \ + BOOST_PP_DETAIL_IBP_IS_VARIADIC_R_, \ + BOOST_PP_DETAIL_IBP_IS_VARIADIC_C param \ + ) \ + ) \ +/**/ + +#else + +#define BOOST_PP_IS_BEGIN_PARENS(...) \ + BOOST_PP_DETAIL_IBP_SPLIT \ + ( \ + 0, \ + BOOST_PP_DETAIL_IBP_CAT \ + ( \ + BOOST_PP_DETAIL_IBP_IS_VARIADIC_R_, \ + BOOST_PP_DETAIL_IBP_IS_VARIADIC_C __VA_ARGS__ \ + ) \ + ) \ +/**/ + +#endif /* BOOST_PP_VARIADICS_MSVC && _MSC_VER <= 1400 */ +#endif /* BOOST_PP_VARIADICS */ +#endif /* BOOST_PREPROCESSOR_IS_BEGIN_PARENS_HPP */ diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index 92d1716..527fc22 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -25,9 +25,11 @@ test-suite preprocessor [ compile control.cpp ] [ compile debug.cpp ] [ compile facilities.cpp ] + [ compile isempty.cpp ] [ compile iteration.cpp ] [ compile list.cpp ] [ compile logical.cpp ] + [ compile punctuation.cpp ] [ compile repetition.cpp ] [ compile selection.cpp ] [ compile seq.cpp ] @@ -44,6 +46,7 @@ test-suite preprocessor_nvm [ compile control.cpp : BOOST_PP_VARIADICS=0 : control_nvm ] [ compile debug.cpp : BOOST_PP_VARIADICS=0 : debug_nvm ] [ compile facilities.cpp : BOOST_PP_VARIADICS=0 : facilities_nvm ] + [ compile isempty.cpp : BOOST_PP_VARIADICS=0 : isempty_nvm ] [ compile iteration.cpp : BOOST_PP_VARIADICS=0 : iteration_nvm ] [ compile list.cpp : BOOST_PP_VARIADICS=0 : list_nvm ] [ compile logical.cpp : BOOST_PP_VARIADICS=0 : logical_nvm ] @@ -80,6 +83,10 @@ test-suite preprocessor_c : gcc:-std=c99 : facilities_c ] + [ compile isempty.c + : gcc:-std=c99 + : isempty_c + ] [ compile list.c : gcc:-std=c99 : list_c @@ -88,6 +95,10 @@ test-suite preprocessor_c : gcc:-std=c99 : logical_c ] + [ compile punctuation.c + : gcc:-std=c99 + : punctuation_c + ] [ compile selection.c : gcc:-std=c99 : selection_c @@ -142,6 +153,11 @@ test-suite preprocessor_c_nvm gcc:-std=c99 : facilities_c_nvm ] + [ compile isempty.c + : BOOST_PP_VARIADICS=0 + gcc:-std=c99 + : isempty_c_nvm + ] [ compile list.c : BOOST_PP_VARIADICS=0 gcc:-std=c99 diff --git a/test/isempty.c b/test/isempty.c new file mode 100644 index 0000000..bd4c2c6 --- /dev/null +++ b/test/isempty.c @@ -0,0 +1,12 @@ +# /* ************************************************************************** +# * * +# * (C) Copyright Edward Diener 2014. +# * 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. */ +# +# include diff --git a/test/isempty.cpp b/test/isempty.cpp new file mode 100644 index 0000000..a038bf4 --- /dev/null +++ b/test/isempty.cpp @@ -0,0 +1,12 @@ +# /* ************************************************************************** +# * * +# * (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. */ +# +# include diff --git a/test/isempty.cxx b/test/isempty.cxx new file mode 100644 index 0000000..f2d7bc2 --- /dev/null +++ b/test/isempty.cxx @@ -0,0 +1,42 @@ +# /* ************************************************************************** +# * * +# * (C) Copyright Edward Diener 2014. +# * 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. */ +# +# include +# include +# include +# include +# include + +#if BOOST_PP_VARIADICS + +#define DATA +#define OBJECT OBJECT2 +#define OBJECT2 +#define FUNC(x) FUNC2(x) +#define FUNC2(x) +#define FUNC_GEN3() anything +#define FUNC_GEN4(x) anything + +#if defined(BOOST_PP_VARIADICS_MSVC) + +#else + +#endif + +BEGIN BOOST_PP_IS_EMPTY(BOOST_PP_EMPTY()) == 1 END +BEGIN BOOST_PP_IS_EMPTY(DATA BOOST_PP_EMPTY()) == 1 END +BEGIN BOOST_PP_IS_EMPTY(x BOOST_PP_EMPTY()) == 0 END +BEGIN BOOST_PP_IS_EMPTY(OBJECT BOOST_PP_EMPTY()) == 1 END +BEGIN BOOST_PP_IS_EMPTY(FUNC(z) BOOST_PP_EMPTY()) == 1 END +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN3) == 0 END +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN4) == 0 END + +#endif diff --git a/test/punctuation.c b/test/punctuation.c new file mode 100644 index 0000000..8fc5dfc --- /dev/null +++ b/test/punctuation.c @@ -0,0 +1,14 @@ +# /* ************************************************************************** +# * * +# * (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) +# * * +# ************************************************************************** */ +# +# /* Revised by Edward Diener (2011) */ +# +# /* See http://www.boost.org for most recent version. */ +# +# include diff --git a/test/punctuation.cpp b/test/punctuation.cpp new file mode 100644 index 0000000..8fc5dfc --- /dev/null +++ b/test/punctuation.cpp @@ -0,0 +1,14 @@ +# /* ************************************************************************** +# * * +# * (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) +# * * +# ************************************************************************** */ +# +# /* Revised by Edward Diener (2011) */ +# +# /* See http://www.boost.org for most recent version. */ +# +# include diff --git a/test/punctuation.cxx b/test/punctuation.cxx new file mode 100644 index 0000000..3eb364b --- /dev/null +++ b/test/punctuation.cxx @@ -0,0 +1,42 @@ +# /* ************************************************************************** +# * * +# * (C) Copyright Edward Diener 2014. +# * 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. */ +# +# if BOOST_PP_VARIADICS +# include +# include + +# define A_TUPLE (*,#,zz) +# define A_TUPLE2 (*,#,(zz,44,(e7))) +# define A_TUPLE_PLUS (mmf,34,^^,!) 456 +# define PLUS_ATUPLE yyt (j,ii%) +# define JDATA ggh +# define NOT_TUPLE y6() +# define NOT_TUPLE2 &(kkkgg,(e)) +# define A_SEQ (r)($)(#) +# define AN_ARRAY (4,(5,7,f,x)) +# define A_LIST (e,(g,(&,BOOST_PP_NIL))) + +// is_begin_parens + +BEGIN BOOST_PP_IS_BEGIN_PARENS() == 0 END +BEGIN BOOST_PP_IS_BEGIN_PARENS(A_TUPLE) == 1 END +BEGIN BOOST_PP_IS_BEGIN_PARENS(A_TUPLE2) == 1 END +BEGIN BOOST_PP_IS_BEGIN_PARENS(A_TUPLE_PLUS) == 1 END +BEGIN BOOST_PP_IS_BEGIN_PARENS(PLUS_ATUPLE) == 0 END +BEGIN BOOST_PP_IS_BEGIN_PARENS(JDATA) == 0 END +BEGIN BOOST_PP_IS_BEGIN_PARENS(NOT_TUPLE) == 0 END +BEGIN BOOST_PP_IS_BEGIN_PARENS(NOT_TUPLE2) == 0 END +BEGIN BOOST_PP_IS_BEGIN_PARENS(A_SEQ) == 1 END +BEGIN BOOST_PP_IS_BEGIN_PARENS(AN_ARRAY) == 1 END +BEGIN BOOST_PP_IS_BEGIN_PARENS(A_LIST) == 1 END +BEGIN BOOST_PP_IS_BEGIN_PARENS((y)2(x)) == 1 END + +#endif From 6fe93a542dfa74df9c11375518aea0a682adef4b Mon Sep 17 00:00:00 2001 From: Edward Diener Date: Mon, 28 Apr 2014 22:12:08 -0400 Subject: [PATCH 03/58] Added variadic version of BOOST_PP_EMPTY and added new is_empty tests. --- .../boost/preprocessor/facilities/empty.hpp | 7 ++++ .../facilities/is_empty_variadic.hpp | 6 +-- test/isempty.cxx | 40 ++++++++++++++++--- 3 files changed, 45 insertions(+), 8 deletions(-) diff --git a/include/boost/preprocessor/facilities/empty.hpp b/include/boost/preprocessor/facilities/empty.hpp index 46db190..99e1daa 100644 --- a/include/boost/preprocessor/facilities/empty.hpp +++ b/include/boost/preprocessor/facilities/empty.hpp @@ -8,14 +8,21 @@ # */ # # /* Revised by Paul Mensonides (2002) */ +# /* Revised by Edward Diener (2014) */ # # /* See http://www.boost.org for most recent version. */ # # ifndef BOOST_PREPROCESSOR_FACILITIES_EMPTY_HPP # define BOOST_PREPROCESSOR_FACILITIES_EMPTY_HPP # +# include +# # /* BOOST_PP_EMPTY */ # +# if BOOST_PP_VARIADICS +# define BOOST_PP_EMPTY(...) +# else # define BOOST_PP_EMPTY() +# endif # # endif diff --git a/include/boost/preprocessor/facilities/is_empty_variadic.hpp b/include/boost/preprocessor/facilities/is_empty_variadic.hpp index 27b4ec0..c2700fe 100644 --- a/include/boost/preprocessor/facilities/is_empty_variadic.hpp +++ b/include/boost/preprocessor/facilities/is_empty_variadic.hpp @@ -16,10 +16,10 @@ # # if BOOST_PP_VARIADICS # +# include # include # include # -#define BOOST_PP_IS_EMPTY_GEN_ZERO(...) 0 #if BOOST_PP_VARIADICS_MSVC && _MSC_VER <= 1400 # #define BOOST_PP_IS_EMPTY(param) \ @@ -31,7 +31,7 @@ ) \ ) \ ( \ - BOOST_PP_IS_EMPTY_GEN_ZERO, \ + 0 BOOST_PP_EMPTY, \ BOOST_PP_DETAIL_IS_EMPTY_PROCESS \ ) \ (param) \ @@ -46,7 +46,7 @@ ) \ ) \ ( \ - BOOST_PP_IS_EMPTY_GEN_ZERO, \ + 0 BOOST_PP_EMPTY, \ BOOST_PP_DETAIL_IS_EMPTY_PROCESS \ ) \ (__VA_ARGS__) \ diff --git a/test/isempty.cxx b/test/isempty.cxx index f2d7bc2..94be43a 100644 --- a/test/isempty.cxx +++ b/test/isempty.cxx @@ -22,13 +22,43 @@ #define OBJECT2 #define FUNC(x) FUNC2(x) #define FUNC2(x) -#define FUNC_GEN3() anything -#define FUNC_GEN4(x) anything - +#define FUNC_GEN() () +#define FUNC_GEN2(x) () +#define FUNC_GEN3() (&) +#define FUNC_GEN4(x) (y) +#define FUNC_GEN5() (y,z) +#define FUNC_GEN6() anything +#define FUNC_GEN7(x) anything + #if defined(BOOST_PP_VARIADICS_MSVC) +#define FUNC_GEN8(x,y) (1,2,3) +#define FUNC_GEN9(x,y,z) anything + +/* These next five produce the wrong result in VC++ */ + +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN) == 1 END +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN2) == 1 END +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN3) == 1 END +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN4) == 1 END +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN5) == 1 END + +/* This next should produce a compiler error but does not, and produces the incorrect result */ + +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN8) == 1 END + +/* This next should produce a compiler error but does not */ + +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN9) == 0 END + #else +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN) == 0 END +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN2) == 0 END +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN3) == 0 END +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN4) == 0 END +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN5) == 0 END + #endif BEGIN BOOST_PP_IS_EMPTY(BOOST_PP_EMPTY()) == 1 END @@ -36,7 +66,7 @@ BEGIN BOOST_PP_IS_EMPTY(DATA BOOST_PP_EMPTY()) == 1 END BEGIN BOOST_PP_IS_EMPTY(x BOOST_PP_EMPTY()) == 0 END BEGIN BOOST_PP_IS_EMPTY(OBJECT BOOST_PP_EMPTY()) == 1 END BEGIN BOOST_PP_IS_EMPTY(FUNC(z) BOOST_PP_EMPTY()) == 1 END -BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN3) == 0 END -BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN4) == 0 END +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN6) == 0 END +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN7) == 0 END #endif From c66ea5871fd44274f681f02323c4d46bdf394c7c Mon Sep 17 00:00:00 2001 From: Edward Diener Date: Wed, 30 Apr 2014 16:06:49 -0400 Subject: [PATCH 04/58] Addition of is_empty tests and changes to rem processing as a workaround to VC++ problem. --- .../preprocessor/array/detail/get_data.hpp | 4 +- .../preprocessor/facilities/is_empty.hpp | 5 +- .../seq/detail/binary_transform.hpp | 14 ++- .../tuple/detail/is_single_return.hpp | 28 ++++++ include/boost/preprocessor/tuple/elem.hpp | 19 +--- include/boost/preprocessor/tuple/rem.hpp | 14 ++- .../variadic/detail/is_single_return.hpp | 28 ++++++ test/Jamfile.v2 | 92 ++++++++++++------ test/isempty.cpp | 2 +- test/isempty.cxx | 97 ++++++++++++++++--- test/isempty_failure.c | 12 +++ test/isempty_failure.cpp | 12 +++ test/isempty_failure.cxx | 25 +++++ test/isempty_failure2.c | 12 +++ test/isempty_failure2.cpp | 12 +++ test/isempty_failure2.cxx | 25 +++++ test/isempty_variadic_standard_failure.c | 12 +++ test/isempty_variadic_standard_failure.cpp | 12 +++ test/isempty_variadic_standard_failure.cxx | 25 +++++ test/isempty_variadic_standard_failure2.c | 12 +++ test/isempty_variadic_standard_failure2.cpp | 12 +++ test/isempty_variadic_standard_failure2.cxx | 25 +++++ test/tuple.cxx | 5 +- test/tuple_elem_bug_test.cxx | 38 ++++++++ 24 files changed, 476 insertions(+), 66 deletions(-) create mode 100644 include/boost/preprocessor/tuple/detail/is_single_return.hpp create mode 100644 include/boost/preprocessor/variadic/detail/is_single_return.hpp create mode 100644 test/isempty_failure.c create mode 100644 test/isempty_failure.cpp create mode 100644 test/isempty_failure.cxx create mode 100644 test/isempty_failure2.c create mode 100644 test/isempty_failure2.cpp create mode 100644 test/isempty_failure2.cxx create mode 100644 test/isempty_variadic_standard_failure.c create mode 100644 test/isempty_variadic_standard_failure.cpp create mode 100644 test/isempty_variadic_standard_failure.cxx create mode 100644 test/isempty_variadic_standard_failure2.c create mode 100644 test/isempty_variadic_standard_failure2.cpp create mode 100644 test/isempty_variadic_standard_failure2.cxx create mode 100644 test/tuple_elem_bug_test.cxx diff --git a/include/boost/preprocessor/array/detail/get_data.hpp b/include/boost/preprocessor/array/detail/get_data.hpp index d72547a..d978109 100644 --- a/include/boost/preprocessor/array/detail/get_data.hpp +++ b/include/boost/preprocessor/array/detail/get_data.hpp @@ -23,9 +23,7 @@ # # /* BOOST_PP_ARRAY_DETAIL_GET_DATA */ # -# define BOOST_PP_ARRAY_DETAIL_GET_DATA_REM(...) BOOST_PP_CAT(__VA_ARGS__,) -# define BOOST_PP_ARRAY_DETAIL_GET_DATA_TUPLE_REM(size) BOOST_PP_ARRAY_DETAIL_GET_DATA_REM -# define BOOST_PP_ARRAY_DETAIL_GET_DATA_SINGLE(size, data) BOOST_PP_ARRAY_DETAIL_GET_DATA_TUPLE_REM(size) data +# define BOOST_PP_ARRAY_DETAIL_GET_DATA_SINGLE(size, data) BOOST_PP_TUPLE_REM_CAT(size) data # define BOOST_PP_ARRAY_DETAIL_GET_DATA_ANY(size, data) BOOST_PP_TUPLE_REM(size) data # define BOOST_PP_ARRAY_DETAIL_GET_DATA_CHECK_ZERO(size, data) \ BOOST_PP_IF \ diff --git a/include/boost/preprocessor/facilities/is_empty.hpp b/include/boost/preprocessor/facilities/is_empty.hpp index b1094d8..e7f821f 100644 --- a/include/boost/preprocessor/facilities/is_empty.hpp +++ b/include/boost/preprocessor/facilities/is_empty.hpp @@ -22,10 +22,13 @@ # else # # include -# include +# if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MSVC() && ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MWCC() # include # include +# else +# include # include +# endif # # /* BOOST_PP_IS_EMPTY */ # diff --git a/include/boost/preprocessor/seq/detail/binary_transform.hpp b/include/boost/preprocessor/seq/detail/binary_transform.hpp index 373e8a5..1c381a7 100644 --- a/include/boost/preprocessor/seq/detail/binary_transform.hpp +++ b/include/boost/preprocessor/seq/detail/binary_transform.hpp @@ -16,6 +16,9 @@ # include # include # include +# if BOOST_PP_VARIADICS && BOOST_PP_VARIADICS_MSVC +# include +# endif # # /* BOOST_PP_SEQ_BINARY_TRANSFORM */ # @@ -28,8 +31,15 @@ # define BOOST_PP_SEQ_BINARY_TRANSFORM(seq) BOOST_PP_CAT(BOOST_PP_SEQ_BINARY_TRANSFORM_A seq, 0) # endif # if BOOST_PP_VARIADICS -# define BOOST_PP_SEQ_BINARY_TRANSFORM_A(...) (BOOST_PP_REM, __VA_ARGS__)() BOOST_PP_SEQ_BINARY_TRANSFORM_B -# define BOOST_PP_SEQ_BINARY_TRANSFORM_B(...) (BOOST_PP_REM, __VA_ARGS__)() BOOST_PP_SEQ_BINARY_TRANSFORM_A +# if BOOST_PP_VARIADICS_MSVC +# define BOOST_PP_SEQ_BINARY_TRANSFORM_GET_REM(...) \ + BOOST_PP_VARIADIC_IS_SINGLE_RETURN(BOOST_PP_REM_CAT,BOOST_PP_REM,__VA_ARGS__) \ + /**/ +# else +# define BOOST_PP_SEQ_BINARY_TRANSFORM_GET_REM(...) BOOST_PP_REM +# endif +# define BOOST_PP_SEQ_BINARY_TRANSFORM_A(...) (BOOST_PP_SEQ_BINARY_TRANSFORM_GET_REM(__VA_ARGS__), __VA_ARGS__)() BOOST_PP_SEQ_BINARY_TRANSFORM_B +# define BOOST_PP_SEQ_BINARY_TRANSFORM_B(...) (BOOST_PP_SEQ_BINARY_TRANSFORM_GET_REM(__VA_ARGS__), __VA_ARGS__)() BOOST_PP_SEQ_BINARY_TRANSFORM_A # else # define BOOST_PP_SEQ_BINARY_TRANSFORM_A(e) (BOOST_PP_REM, e)() BOOST_PP_SEQ_BINARY_TRANSFORM_B # define BOOST_PP_SEQ_BINARY_TRANSFORM_B(e) (BOOST_PP_REM, e)() BOOST_PP_SEQ_BINARY_TRANSFORM_A diff --git a/include/boost/preprocessor/tuple/detail/is_single_return.hpp b/include/boost/preprocessor/tuple/detail/is_single_return.hpp new file mode 100644 index 0000000..9ffa3cc --- /dev/null +++ b/include/boost/preprocessor/tuple/detail/is_single_return.hpp @@ -0,0 +1,28 @@ +# /* ************************************************************************** +# * * +# * (C) Copyright Edward Diener 2014. * +# * 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_TUPLE_DETAIL_IS_SINGLE_RETURN_HPP +# define BOOST_PREPROCESSOR_TUPLE_DETAIL_IS_SINGLE_RETURN_HPP +# +# include +# include +# include +# include +# +# /* BOOST_PP_TUPLE_IS_SINGLE_RETURN */ +# +# if BOOST_PP_VARIADICS && BOOST_PP_VARIADICS_MSVC +# define BOOST_PP_TUPLE_IS_SINGLE_RETURN(sr,nsr,tuple) \ + BOOST_PP_IIF(BOOST_PP_IS_1(BOOST_PP_TUPLE_SIZE(tuple)),sr,nsr) \ + /**/ +# endif /* BOOST_PP_VARIADICS && BOOST_PP_VARIADICS_MSVC */ +# +# endif /* BOOST_PREPROCESSOR_TUPLE_DETAIL_IS_SINGLE_RETURN_HPP */ diff --git a/include/boost/preprocessor/tuple/elem.hpp b/include/boost/preprocessor/tuple/elem.hpp index 762a171..ee8f0bd 100644 --- a/include/boost/preprocessor/tuple/elem.hpp +++ b/include/boost/preprocessor/tuple/elem.hpp @@ -22,9 +22,7 @@ # include # # if BOOST_PP_VARIADICS && BOOST_PP_VARIADICS_MSVC -# include -# include -# include +# include # endif # # if BOOST_PP_VARIADICS @@ -33,21 +31,12 @@ # define BOOST_PP_TUPLE_ELEM_I(m, args) BOOST_PP_TUPLE_ELEM_II(m, args) # define BOOST_PP_TUPLE_ELEM_II(m, args) BOOST_PP_CAT(m ## args,) /* - Use BOOST_PP_TUPLE_ELEM_O_2_CAT if it is a single element tuple ( which might be empty ) + Use BOOST_PP_REM_CAT if it is a single element tuple ( which might be empty ) else use BOOST_PP_REM. This fixes a VC++ problem with an empty tuple and BOOST_PP_TUPLE_ELEM - functionality. + functionality. See tuple_elem_bug_test.cxx. */ -# define BOOST_PP_TUPLE_ELEM_O_2_CAT(...) BOOST_PP_CAT(__VA_ARGS__,) -# define BOOST_PP_TUPLE_ELEM_O_2_SINGLE(n, tuple) BOOST_PP_VARIADIC_ELEM(n, BOOST_PP_TUPLE_ELEM_O_2_CAT tuple) -# define BOOST_PP_TUPLE_ELEM_O_2_ANY(n, tuple) BOOST_PP_VARIADIC_ELEM(n, BOOST_PP_REM tuple) # define BOOST_PP_TUPLE_ELEM_O_2(n, tuple) \ - BOOST_PP_IIF \ - ( \ - BOOST_PP_EQUAL(BOOST_PP_TUPLE_SIZE(tuple),1), \ - BOOST_PP_TUPLE_ELEM_O_2_SINGLE, \ - BOOST_PP_TUPLE_ELEM_O_2_ANY \ - ) \ - (n, tuple) \ + BOOST_PP_VARIADIC_ELEM(n, BOOST_PP_TUPLE_IS_SINGLE_RETURN(BOOST_PP_REM_CAT,BOOST_PP_REM,tuple) tuple) \ /**/ # else # define BOOST_PP_TUPLE_ELEM(...) BOOST_PP_OVERLOAD(BOOST_PP_TUPLE_ELEM_O_, __VA_ARGS__)(__VA_ARGS__) diff --git a/include/boost/preprocessor/tuple/rem.hpp b/include/boost/preprocessor/tuple/rem.hpp index 270c31a..136d282 100644 --- a/include/boost/preprocessor/tuple/rem.hpp +++ b/include/boost/preprocessor/tuple/rem.hpp @@ -16,10 +16,17 @@ # include # include # include +# if BOOST_PP_VARIADICS && BOOST_PP_VARIADICS_MSVC +# include +# endif # # /* BOOST_PP_REM */ # # if BOOST_PP_VARIADICS +# if BOOST_PP_VARIADICS_MSVC + /* To be used internally when __VA_ARGS__ is a single element */ +# define BOOST_PP_REM_CAT(...) BOOST_PP_CAT(__VA_ARGS__,) +# endif # define BOOST_PP_REM(...) __VA_ARGS__ # else # define BOOST_PP_REM(x) x @@ -31,6 +38,10 @@ VC++8.0 cannot handle the variadic version of BOOST_PP_TUPLE_REM(size) */ # if BOOST_PP_VARIADICS && !(BOOST_PP_VARIADICS_MSVC && _MSC_VER == 1400) +# if BOOST_PP_VARIADICS_MSVC + /* To be used internally when the size is 1 */ +# define BOOST_PP_TUPLE_REM_CAT(size) BOOST_PP_REM_CAT +# endif # define BOOST_PP_TUPLE_REM(size) BOOST_PP_REM # else # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MWCC() @@ -114,10 +125,11 @@ # define BOOST_PP_TUPLE_REM_CTOR(...) BOOST_PP_TUPLE_REM_CTOR_I(BOOST_PP_OVERLOAD(BOOST_PP_TUPLE_REM_CTOR_O_, __VA_ARGS__), (__VA_ARGS__)) # define BOOST_PP_TUPLE_REM_CTOR_I(m, args) BOOST_PP_TUPLE_REM_CTOR_II(m, args) # define BOOST_PP_TUPLE_REM_CTOR_II(m, args) BOOST_PP_CAT(m ## args,) +# define BOOST_PP_TUPLE_REM_CTOR_O_1(tuple) BOOST_PP_TUPLE_IS_SINGLE_RETURN(BOOST_PP_REM_CAT,BOOST_PP_REM,tuple) tuple # else # define BOOST_PP_TUPLE_REM_CTOR(...) BOOST_PP_OVERLOAD(BOOST_PP_TUPLE_REM_CTOR_O_, __VA_ARGS__)(__VA_ARGS__) +# define BOOST_PP_TUPLE_REM_CTOR_O_1(tuple) BOOST_PP_REM tuple # endif -# define BOOST_PP_TUPLE_REM_CTOR_O_1(tuple) BOOST_PP_REM tuple # define BOOST_PP_TUPLE_REM_CTOR_O_2(size, tuple) BOOST_PP_TUPLE_REM_CTOR_O_1(tuple) # else # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG() diff --git a/include/boost/preprocessor/variadic/detail/is_single_return.hpp b/include/boost/preprocessor/variadic/detail/is_single_return.hpp new file mode 100644 index 0000000..491e06b --- /dev/null +++ b/include/boost/preprocessor/variadic/detail/is_single_return.hpp @@ -0,0 +1,28 @@ +# /* ************************************************************************** +# * * +# * (C) Copyright Edward Diener 2014. * +# * 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_VARIADIC_DETAIL_IS_SINGLE_RETURN_HPP +# define BOOST_PREPROCESSOR_VARIADIC_DETAIL_IS_SINGLE_RETURN_HPP +# +# include +# include +# include +# include +# +# /* BOOST_PP_VARIADIC_IS_SINGLE_RETURN */ +# +# if BOOST_PP_VARIADICS && BOOST_PP_VARIADICS_MSVC +# define BOOST_PP_VARIADIC_IS_SINGLE_RETURN(sr,nsr,...) \ + BOOST_PP_IIF(BOOST_PP_IS_1(BOOST_PP_VARIADIC_SIZE(__VA_ARGS__)),sr,nsr) \ + /**/ +# endif /* BOOST_PP_VARIADICS && BOOST_PP_VARIADICS_MSVC */ +# +# endif /* BOOST_PREPROCESSOR_VARIADIC_DETAIL_IS_SINGLE_RETURN_HPP */ diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index 527fc22..ac61214 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -19,23 +19,22 @@ project preprocessor_tests : requirements on test-suite preprocessor : - [ compile arithmetic.cpp ] - [ compile array.cpp ] - [ compile comparison.cpp ] - [ compile control.cpp ] - [ compile debug.cpp ] - [ compile facilities.cpp ] - [ compile isempty.cpp ] - [ compile iteration.cpp ] - [ compile list.cpp ] - [ compile logical.cpp ] - [ compile punctuation.cpp ] - [ compile repetition.cpp ] - [ compile selection.cpp ] - [ compile seq.cpp ] - [ compile slot.cpp ] - [ compile tuple.cpp ] - [ compile variadic.cpp ] + [ compile arithmetic.cpp : gcc:-std=c++0x ] + [ compile array.cpp : gcc:-std=c++0x ] + [ compile comparison.cpp : gcc:-std=c++0x ] + [ compile control.cpp : gcc:-std=c++0x ] + [ compile debug.cpp : gcc:-std=c++0x ] + [ compile facilities.cpp : gcc:-std=c++0x ] + [ compile iteration.cpp : gcc:-std=c++0x ] + [ compile list.cpp : gcc:-std=c++0x ] + [ compile logical.cpp : gcc:-std=c++0x ] + [ compile punctuation.cpp : gcc:-std=c++0x ] + [ compile repetition.cpp : gcc:-std=c++0x ] + [ compile selection.cpp : gcc:-std=c++0x ] + [ compile seq.cpp : gcc:-std=c++0x ] + [ compile slot.cpp : gcc:-std=c++0x ] + [ compile tuple.cpp : gcc:-std=c++0x ] + [ compile variadic.cpp : gcc:-std=c++0x ] ; test-suite preprocessor_nvm @@ -46,7 +45,6 @@ test-suite preprocessor_nvm [ compile control.cpp : BOOST_PP_VARIADICS=0 : control_nvm ] [ compile debug.cpp : BOOST_PP_VARIADICS=0 : debug_nvm ] [ compile facilities.cpp : BOOST_PP_VARIADICS=0 : facilities_nvm ] - [ compile isempty.cpp : BOOST_PP_VARIADICS=0 : isempty_nvm ] [ compile iteration.cpp : BOOST_PP_VARIADICS=0 : iteration_nvm ] [ compile list.cpp : BOOST_PP_VARIADICS=0 : list_nvm ] [ compile logical.cpp : BOOST_PP_VARIADICS=0 : logical_nvm ] @@ -83,10 +81,6 @@ test-suite preprocessor_c : gcc:-std=c99 : facilities_c ] - [ compile isempty.c - : gcc:-std=c99 - : isempty_c - ] [ compile list.c : gcc:-std=c99 : list_c @@ -153,11 +147,6 @@ test-suite preprocessor_c_nvm gcc:-std=c99 : facilities_c_nvm ] - [ compile isempty.c - : BOOST_PP_VARIADICS=0 - gcc:-std=c99 - : isempty_c_nvm - ] [ compile list.c : BOOST_PP_VARIADICS=0 gcc:-std=c99 @@ -189,3 +178,52 @@ test-suite preprocessor_c_nvm : tuple_c_nvm ] ; + +# test-suite preprocessor_isempty +# : +# [ compile isempty.cpp : gcc:-std=c++0x ] +# [ compile-fail isempty_variadic_standard_failure.cpp : gcc:-std=c++0x ] +# [ compile-fail isempty_variadic_standard_failure2.cpp : gcc:-std=c++0x ] +# ; + +test-suite preprocessor_isempty_nvm + : + [ compile isempty.cpp : BOOST_PP_VARIADICS=0 : isempty_nvm ] + [ compile-fail isempty_failure.cpp : BOOST_PP_VARIADICS=0 : isempty_failure_nvm ] + [ compile-fail isempty_failure2.cpp : BOOST_PP_VARIADICS=0 : isempty_failure2_nvm ] + ; + +# test-suite preprocessor_isempty_c +# : +# [ compile isempty.c +# : gcc:-std=c99 +# : isempty_c +# ] +# [ compile-fail isempty_variadic_standard_failure.c +# : gcc:-std=c99 +# : isempty_variadic_standard_failure_c +# ] +# [ compile-fail isempty_variadic_standard_failure2.c +# : gcc:-std=c99 +# : isempty_variadic_standard_failure2_c +# ] +# ; + +test-suite preprocessor_isempty_c_nvm + : + [ compile isempty.c + : BOOST_PP_VARIADICS=0 + gcc:-std=c99 + : isempty_c_nvm + ] + [ compile-fail isempty_failure.c + : BOOST_PP_VARIADICS=0 + gcc:-std=c99 + : isempty_failure_c_nvm + ] + [ compile-fail isempty_failure2.c + : BOOST_PP_VARIADICS=0 + gcc:-std=c99 + : isempty_failure2_c_nvm + ] + ; diff --git a/test/isempty.cpp b/test/isempty.cpp index a038bf4..bd4c2c6 100644 --- a/test/isempty.cpp +++ b/test/isempty.cpp @@ -1,6 +1,6 @@ # /* ************************************************************************** # * * -# * (C) Copyright Paul Mensonides 2002. +# * (C) Copyright Edward Diener 2014. # * 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) diff --git a/test/isempty.cxx b/test/isempty.cxx index 94be43a..cf2660f 100644 --- a/test/isempty.cxx +++ b/test/isempty.cxx @@ -11,12 +11,8 @@ # # include # include -# include -# include # include -#if BOOST_PP_VARIADICS - #define DATA #define OBJECT OBJECT2 #define OBJECT2 @@ -29,38 +25,53 @@ #define FUNC_GEN5() (y,z) #define FUNC_GEN6() anything #define FUNC_GEN7(x) anything - -#if defined(BOOST_PP_VARIADICS_MSVC) - #define FUNC_GEN8(x,y) (1,2,3) #define FUNC_GEN9(x,y,z) anything - -/* These next five produce the wrong result in VC++ */ +#define FUNC_GEN10(x) (y) data +#define NAME &name +#define ATUPLE (atuple) +#define ATUPLE_PLUS (atuple) data + +#if BOOST_PP_VARIADICS + +#if defined(BOOST_PP_VARIADICS_MSVC) /* Testing the VC++ variadic version */ + +/* INCORRECT */ BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN) == 1 END BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN2) == 1 END BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN3) == 1 END BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN4) == 1 END BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN5) == 1 END - -/* This next should produce a compiler error but does not, and produces the incorrect result */ - BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN8) == 1 END +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN10) == 1 END -/* This next should produce a compiler error but does not */ +/* CORRECT */ BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN9) == 0 END -#else +#else /* Testing the non-VC++ variadic version */ + +/* CORRECT */ BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN) == 0 END BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN2) == 0 END BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN3) == 0 END BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN4) == 0 END BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN5) == 0 END +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN10) == 0 END + +/* COMPILER ERROR */ + +// BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN8) == 0 END +// BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN9) == 0 END #endif +/* Testing the variadic version */ + +/* CORRECT */ + BEGIN BOOST_PP_IS_EMPTY(BOOST_PP_EMPTY()) == 1 END BEGIN BOOST_PP_IS_EMPTY(DATA BOOST_PP_EMPTY()) == 1 END BEGIN BOOST_PP_IS_EMPTY(x BOOST_PP_EMPTY()) == 0 END @@ -68,5 +79,61 @@ BEGIN BOOST_PP_IS_EMPTY(OBJECT BOOST_PP_EMPTY()) == 1 END BEGIN BOOST_PP_IS_EMPTY(FUNC(z) BOOST_PP_EMPTY()) == 1 END BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN6) == 0 END BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN7) == 0 END - +BEGIN BOOST_PP_IS_EMPTY(NAME) == 0 END +BEGIN BOOST_PP_IS_EMPTY(ATUPLE) == 0 END +BEGIN BOOST_PP_IS_EMPTY(ATUPLE_PLUS) == 0 END + +#else + +#if BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MSVC() /* Testing the VC++ non-variadic version */ + +/* INCORRECT */ + +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN) == 1 END +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN2) == 1 END +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN3) == 1 END +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN4) == 1 END +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN5) == 1 END +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN8) == 1 END +BEGIN BOOST_PP_IS_EMPTY(ATUPLE) == 1 END +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN10) == 1 END +BEGIN BOOST_PP_IS_EMPTY(ATUPLE_PLUS) == 1 END + +/* CORRECT */ + +BEGIN BOOST_PP_IS_EMPTY(NAME) == 0 END + +#else /* Testing the non-VC++ non-variadic version */ + +/* CORRECT */ + +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN) == 0 END +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN2) == 0 END +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN3) == 0 END +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN4) == 0 END +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN5) == 0 END +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN8) == 0 END +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN10) == 0 END + +/* COMPILER ERROR */ + +// BEGIN BOOST_PP_IS_EMPTY(ATUPLE) == 0 END +// BEGIN BOOST_PP_IS_EMPTY(ATUPLE_PLUS) == 1 END +// BEGIN BOOST_PP_IS_EMPTY(NAME) == 0 END + +#endif + +/* Testing the non-variadic version */ + +/* CORRECT */ + +BEGIN BOOST_PP_IS_EMPTY(BOOST_PP_EMPTY()) == 1 END +BEGIN BOOST_PP_IS_EMPTY(DATA BOOST_PP_EMPTY()) == 1 END +BEGIN BOOST_PP_IS_EMPTY(x BOOST_PP_EMPTY()) == 0 END +BEGIN BOOST_PP_IS_EMPTY(OBJECT BOOST_PP_EMPTY()) == 1 END +BEGIN BOOST_PP_IS_EMPTY(FUNC(z) BOOST_PP_EMPTY()) == 1 END +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN6) == 0 END +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN7) == 0 END +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN9) == 0 END + #endif diff --git a/test/isempty_failure.c b/test/isempty_failure.c new file mode 100644 index 0000000..db891ba --- /dev/null +++ b/test/isempty_failure.c @@ -0,0 +1,12 @@ +# /* ************************************************************************** +# * * +# * (C) Copyright Edward Diener 2014. +# * 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. */ +# +# include diff --git a/test/isempty_failure.cpp b/test/isempty_failure.cpp new file mode 100644 index 0000000..db891ba --- /dev/null +++ b/test/isempty_failure.cpp @@ -0,0 +1,12 @@ +# /* ************************************************************************** +# * * +# * (C) Copyright Edward Diener 2014. +# * 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. */ +# +# include diff --git a/test/isempty_failure.cxx b/test/isempty_failure.cxx new file mode 100644 index 0000000..f6a4179 --- /dev/null +++ b/test/isempty_failure.cxx @@ -0,0 +1,25 @@ +# /* ************************************************************************** +# * * +# * (C) Copyright Edward Diener 2014. +# * 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. */ +# +# include +# include + +#if !BOOST_PP_VARIADICS && (~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MSVC()) && (~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MWCC()) + +#define NAME &name + +BEGIN BOOST_PP_IS_EMPTY(NAME) == 0 END + +#else + +BEGIN 1 == 0 END + +#endif diff --git a/test/isempty_failure2.c b/test/isempty_failure2.c new file mode 100644 index 0000000..cb5aa2e --- /dev/null +++ b/test/isempty_failure2.c @@ -0,0 +1,12 @@ +# /* ************************************************************************** +# * * +# * (C) Copyright Edward Diener 2014. +# * 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. */ +# +# include diff --git a/test/isempty_failure2.cpp b/test/isempty_failure2.cpp new file mode 100644 index 0000000..cb5aa2e --- /dev/null +++ b/test/isempty_failure2.cpp @@ -0,0 +1,12 @@ +# /* ************************************************************************** +# * * +# * (C) Copyright Edward Diener 2014. +# * 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. */ +# +# include diff --git a/test/isempty_failure2.cxx b/test/isempty_failure2.cxx new file mode 100644 index 0000000..397774b --- /dev/null +++ b/test/isempty_failure2.cxx @@ -0,0 +1,25 @@ +# /* ************************************************************************** +# * * +# * (C) Copyright Edward Diener 2014. +# * 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. */ +# +# include +# include + +#if !BOOST_PP_VARIADICS && (~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MSVC()) && (~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MWCC()) + +#define ATUPLE_PLUS (atuple) data + +BEGIN BOOST_PP_IS_EMPTY(ATUPLE_PLUS) == 0 END + +#else + +BEGIN 1 == 0 END + +#endif diff --git a/test/isempty_variadic_standard_failure.c b/test/isempty_variadic_standard_failure.c new file mode 100644 index 0000000..36f6ff7 --- /dev/null +++ b/test/isempty_variadic_standard_failure.c @@ -0,0 +1,12 @@ +# /* ************************************************************************** +# * * +# * (C) Copyright Edward Diener 2014. +# * 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. */ +# +# include diff --git a/test/isempty_variadic_standard_failure.cpp b/test/isempty_variadic_standard_failure.cpp new file mode 100644 index 0000000..36f6ff7 --- /dev/null +++ b/test/isempty_variadic_standard_failure.cpp @@ -0,0 +1,12 @@ +# /* ************************************************************************** +# * * +# * (C) Copyright Edward Diener 2014. +# * 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. */ +# +# include diff --git a/test/isempty_variadic_standard_failure.cxx b/test/isempty_variadic_standard_failure.cxx new file mode 100644 index 0000000..d4403bf --- /dev/null +++ b/test/isempty_variadic_standard_failure.cxx @@ -0,0 +1,25 @@ +# /* ************************************************************************** +# * * +# * (C) Copyright Edward Diener 2014. +# * 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. */ +# +# include +# include + +#if BOOST_PP_VARIADICS && !defined(BOOST_PP_VARIADICS_MSVC) + +#define FUNC_GEN8(x,y) (1,2,3) + +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN8) == 0 END + +#else + +BEGIN 1 == 0 END + +#endif diff --git a/test/isempty_variadic_standard_failure2.c b/test/isempty_variadic_standard_failure2.c new file mode 100644 index 0000000..a2aa690 --- /dev/null +++ b/test/isempty_variadic_standard_failure2.c @@ -0,0 +1,12 @@ +# /* ************************************************************************** +# * * +# * (C) Copyright Edward Diener 2014. +# * 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. */ +# +# include diff --git a/test/isempty_variadic_standard_failure2.cpp b/test/isempty_variadic_standard_failure2.cpp new file mode 100644 index 0000000..a2aa690 --- /dev/null +++ b/test/isempty_variadic_standard_failure2.cpp @@ -0,0 +1,12 @@ +# /* ************************************************************************** +# * * +# * (C) Copyright Edward Diener 2014. +# * 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. */ +# +# include diff --git a/test/isempty_variadic_standard_failure2.cxx b/test/isempty_variadic_standard_failure2.cxx new file mode 100644 index 0000000..38a6600 --- /dev/null +++ b/test/isempty_variadic_standard_failure2.cxx @@ -0,0 +1,25 @@ +# /* ************************************************************************** +# * * +# * (C) Copyright Edward Diener 2014. +# * 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. */ +# +# include +# include + +#if BOOST_PP_VARIADICS && !defined(BOOST_PP_VARIADICS_MSVC) + +#define FUNC_GEN9(x,y,z) anything + +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN9) == 0 END + +#else + +BEGIN 1 == 0 END + +#endif diff --git a/test/tuple.cxx b/test/tuple.cxx index d5d941a..c315509 100644 --- a/test/tuple.cxx +++ b/test/tuple.cxx @@ -7,10 +7,12 @@ # * * # ************************************************************************** */ # -# /* Revised by Edward Diener (2011) */ +# /* Revised by Edward Diener (2011,2014) */ # # /* See http://www.boost.org for most recent version. */ # +# include +# include # include # include # include @@ -20,6 +22,7 @@ # include # endif # include +# include # define TUPLE (0, 1, 2, 3, 4, 5) # define TUPLE_LARGE (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32) diff --git a/test/tuple_elem_bug_test.cxx b/test/tuple_elem_bug_test.cxx new file mode 100644 index 0000000..56e36a6 --- /dev/null +++ b/test/tuple_elem_bug_test.cxx @@ -0,0 +1,38 @@ +# /* ************************************************************************** +# * * +# * (C) Copyright Edward Diener 2014. +# * 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. */ +# +# include +# include +# include +# include + +#define TN_GEN_ONE(p) (1) +#define TN_GEN_ZERO(p) (0) +#define TN_TEST_ONE_MORE(parameter,ens) \ + BOOST_PP_IF \ + ( \ + BOOST_PP_CAT(BOOST_PP_TUPLE_ELEM(1,0,ens),0), \ + TN_GEN_ONE, \ + TN_GEN_ZERO \ + ) \ + (parameter) \ +/**/ +#define TN_TEST_ONE(parameter,ens) \ + BOOST_PP_TUPLE_ELEM \ + ( \ + 1, \ + 0, \ + TN_TEST_ONE_MORE(parameter,ens) \ + ) \ +/**/ + +BEGIN TN_TEST_ONE(A,(1)) == 1 END +BEGIN TN_TEST_ONE(A,()) == 0 END From fe2a9cbfcc680f310f1c45f86b3445efbfbd169a Mon Sep 17 00:00:00 2001 From: Edward Diener Date: Wed, 30 Apr 2014 16:15:57 -0400 Subject: [PATCH 05/58] Added variadic is_empty tests. --- test/Jamfile.v2 | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index ac61214..533e400 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -179,12 +179,12 @@ test-suite preprocessor_c_nvm ] ; -# test-suite preprocessor_isempty -# : -# [ compile isempty.cpp : gcc:-std=c++0x ] -# [ compile-fail isempty_variadic_standard_failure.cpp : gcc:-std=c++0x ] -# [ compile-fail isempty_variadic_standard_failure2.cpp : gcc:-std=c++0x ] -# ; +test-suite preprocessor_isempty + : + [ compile isempty.cpp : gcc:-std=c++0x ] + [ compile-fail isempty_variadic_standard_failure.cpp : gcc:-std=c++0x ] + [ compile-fail isempty_variadic_standard_failure2.cpp : gcc:-std=c++0x ] + ; test-suite preprocessor_isempty_nvm : @@ -193,21 +193,21 @@ test-suite preprocessor_isempty_nvm [ compile-fail isempty_failure2.cpp : BOOST_PP_VARIADICS=0 : isempty_failure2_nvm ] ; -# test-suite preprocessor_isempty_c -# : -# [ compile isempty.c -# : gcc:-std=c99 -# : isempty_c -# ] -# [ compile-fail isempty_variadic_standard_failure.c -# : gcc:-std=c99 -# : isempty_variadic_standard_failure_c -# ] -# [ compile-fail isempty_variadic_standard_failure2.c -# : gcc:-std=c99 -# : isempty_variadic_standard_failure2_c -# ] -# ; +test-suite preprocessor_isempty_c + : + [ compile isempty.c + : gcc:-std=c99 + : isempty_c + ] + [ compile-fail isempty_variadic_standard_failure.c + : gcc:-std=c99 + : isempty_variadic_standard_failure_c + ] + [ compile-fail isempty_variadic_standard_failure2.c + : gcc:-std=c99 + : isempty_variadic_standard_failure2_c + ] + ; test-suite preprocessor_isempty_c_nvm : From 4614c621307e96c1fd8408846f26ebc0d7f23775 Mon Sep 17 00:00:00 2001 From: Edward Diener Date: Thu, 1 May 2014 01:20:12 -0400 Subject: [PATCH 06/58] Updated tests for strict compilers or VC++ --- test/isempty.cxx | 6 ++++++ test/isempty_failure.cxx | 2 +- test/isempty_failure2.cxx | 2 +- test/isempty_variadic_standard_failure.cxx | 2 +- test/isempty_variadic_standard_failure2.cxx | 2 +- 5 files changed, 10 insertions(+), 4 deletions(-) diff --git a/test/isempty.cxx b/test/isempty.cxx index cf2660f..bcf5b48 100644 --- a/test/isempty.cxx +++ b/test/isempty.cxx @@ -9,6 +9,10 @@ # # /* See http://www.boost.org for most recent version. */ # +# include +# +#if (BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_STRICT()) || (BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MSVC()) + # include # include # include @@ -137,3 +141,5 @@ BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN7) == 0 END BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN9) == 0 END #endif + +#endif diff --git a/test/isempty_failure.cxx b/test/isempty_failure.cxx index f6a4179..72fbac3 100644 --- a/test/isempty_failure.cxx +++ b/test/isempty_failure.cxx @@ -12,7 +12,7 @@ # include # include -#if !BOOST_PP_VARIADICS && (~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MSVC()) && (~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MWCC()) +#if !BOOST_PP_VARIADICS && (BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_STRICT()) && (~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MSVC()) && (~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MWCC()) #define NAME &name diff --git a/test/isempty_failure2.cxx b/test/isempty_failure2.cxx index 397774b..eded627 100644 --- a/test/isempty_failure2.cxx +++ b/test/isempty_failure2.cxx @@ -12,7 +12,7 @@ # include # include -#if !BOOST_PP_VARIADICS && (~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MSVC()) && (~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MWCC()) +#if !BOOST_PP_VARIADICS && (BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_STRICT()) && (~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MSVC()) && (~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MWCC()) #define ATUPLE_PLUS (atuple) data diff --git a/test/isempty_variadic_standard_failure.cxx b/test/isempty_variadic_standard_failure.cxx index d4403bf..bfbbc9d 100644 --- a/test/isempty_variadic_standard_failure.cxx +++ b/test/isempty_variadic_standard_failure.cxx @@ -12,7 +12,7 @@ # include # include -#if BOOST_PP_VARIADICS && !defined(BOOST_PP_VARIADICS_MSVC) +#if BOOST_PP_VARIADICS && (BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_STRICT()) && !defined(BOOST_PP_VARIADICS_MSVC) #define FUNC_GEN8(x,y) (1,2,3) diff --git a/test/isempty_variadic_standard_failure2.cxx b/test/isempty_variadic_standard_failure2.cxx index 38a6600..d730626 100644 --- a/test/isempty_variadic_standard_failure2.cxx +++ b/test/isempty_variadic_standard_failure2.cxx @@ -12,7 +12,7 @@ # include # include -#if BOOST_PP_VARIADICS && !defined(BOOST_PP_VARIADICS_MSVC) +#if BOOST_PP_VARIADICS && (BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_STRICT()) && !defined(BOOST_PP_VARIADICS_MSVC) #define FUNC_GEN9(x,y,z) anything From 5c22605c3df5880c2d4f83e34165d0c5fa9b2e4c Mon Sep 17 00:00:00 2001 From: Edward Diener Date: Thu, 1 May 2014 23:21:05 -0400 Subject: [PATCH 07/58] Removed tests which involve undefined behavior. --- test/Jamfile.v2 | 12 ------------ test/isempty.cxx | 2 +- test/isempty_failure.c | 12 ------------ test/isempty_failure.cpp | 12 ------------ test/isempty_failure.cxx | 25 ------------------------- test/isempty_failure2.c | 12 ------------ test/isempty_failure2.cpp | 12 ------------ test/isempty_failure2.cxx | 25 ------------------------- 8 files changed, 1 insertion(+), 111 deletions(-) delete mode 100644 test/isempty_failure.c delete mode 100644 test/isempty_failure.cpp delete mode 100644 test/isempty_failure.cxx delete mode 100644 test/isempty_failure2.c delete mode 100644 test/isempty_failure2.cpp delete mode 100644 test/isempty_failure2.cxx diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index 533e400..5e91c86 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -189,8 +189,6 @@ test-suite preprocessor_isempty test-suite preprocessor_isempty_nvm : [ compile isempty.cpp : BOOST_PP_VARIADICS=0 : isempty_nvm ] - [ compile-fail isempty_failure.cpp : BOOST_PP_VARIADICS=0 : isempty_failure_nvm ] - [ compile-fail isempty_failure2.cpp : BOOST_PP_VARIADICS=0 : isempty_failure2_nvm ] ; test-suite preprocessor_isempty_c @@ -216,14 +214,4 @@ test-suite preprocessor_isempty_c_nvm gcc:-std=c99 : isempty_c_nvm ] - [ compile-fail isempty_failure.c - : BOOST_PP_VARIADICS=0 - gcc:-std=c99 - : isempty_failure_c_nvm - ] - [ compile-fail isempty_failure2.c - : BOOST_PP_VARIADICS=0 - gcc:-std=c99 - : isempty_failure2_c_nvm - ] ; diff --git a/test/isempty.cxx b/test/isempty.cxx index bcf5b48..d0c3776 100644 --- a/test/isempty.cxx +++ b/test/isempty.cxx @@ -119,7 +119,7 @@ BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN5) == 0 END BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN8) == 0 END BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN10) == 0 END -/* COMPILER ERROR */ +/* UNDEFINED BEHAVIOR */ // BEGIN BOOST_PP_IS_EMPTY(ATUPLE) == 0 END // BEGIN BOOST_PP_IS_EMPTY(ATUPLE_PLUS) == 1 END diff --git a/test/isempty_failure.c b/test/isempty_failure.c deleted file mode 100644 index db891ba..0000000 --- a/test/isempty_failure.c +++ /dev/null @@ -1,12 +0,0 @@ -# /* ************************************************************************** -# * * -# * (C) Copyright Edward Diener 2014. -# * 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. */ -# -# include diff --git a/test/isempty_failure.cpp b/test/isempty_failure.cpp deleted file mode 100644 index db891ba..0000000 --- a/test/isempty_failure.cpp +++ /dev/null @@ -1,12 +0,0 @@ -# /* ************************************************************************** -# * * -# * (C) Copyright Edward Diener 2014. -# * 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. */ -# -# include diff --git a/test/isempty_failure.cxx b/test/isempty_failure.cxx deleted file mode 100644 index 72fbac3..0000000 --- a/test/isempty_failure.cxx +++ /dev/null @@ -1,25 +0,0 @@ -# /* ************************************************************************** -# * * -# * (C) Copyright Edward Diener 2014. -# * 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. */ -# -# include -# include - -#if !BOOST_PP_VARIADICS && (BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_STRICT()) && (~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MSVC()) && (~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MWCC()) - -#define NAME &name - -BEGIN BOOST_PP_IS_EMPTY(NAME) == 0 END - -#else - -BEGIN 1 == 0 END - -#endif diff --git a/test/isempty_failure2.c b/test/isempty_failure2.c deleted file mode 100644 index cb5aa2e..0000000 --- a/test/isempty_failure2.c +++ /dev/null @@ -1,12 +0,0 @@ -# /* ************************************************************************** -# * * -# * (C) Copyright Edward Diener 2014. -# * 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. */ -# -# include diff --git a/test/isempty_failure2.cpp b/test/isempty_failure2.cpp deleted file mode 100644 index cb5aa2e..0000000 --- a/test/isempty_failure2.cpp +++ /dev/null @@ -1,12 +0,0 @@ -# /* ************************************************************************** -# * * -# * (C) Copyright Edward Diener 2014. -# * 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. */ -# -# include diff --git a/test/isempty_failure2.cxx b/test/isempty_failure2.cxx deleted file mode 100644 index eded627..0000000 --- a/test/isempty_failure2.cxx +++ /dev/null @@ -1,25 +0,0 @@ -# /* ************************************************************************** -# * * -# * (C) Copyright Edward Diener 2014. -# * 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. */ -# -# include -# include - -#if !BOOST_PP_VARIADICS && (BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_STRICT()) && (~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MSVC()) && (~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MWCC()) - -#define ATUPLE_PLUS (atuple) data - -BEGIN BOOST_PP_IS_EMPTY(ATUPLE_PLUS) == 0 END - -#else - -BEGIN 1 == 0 END - -#endif From 7da9dbb7a9582c8a6df9636f3c6063ae781a5bf4 Mon Sep 17 00:00:00 2001 From: Edward Diener Date: Fri, 2 May 2014 02:59:10 -0400 Subject: [PATCH 08/58] Corrected calculation _msc_ver number. --- include/boost/preprocessor/array/detail/get_data.hpp | 4 ++-- include/boost/preprocessor/tuple/rem.hpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/boost/preprocessor/array/detail/get_data.hpp b/include/boost/preprocessor/array/detail/get_data.hpp index d978109..fafa498 100644 --- a/include/boost/preprocessor/array/detail/get_data.hpp +++ b/include/boost/preprocessor/array/detail/get_data.hpp @@ -15,7 +15,7 @@ # include # include # -# if BOOST_PP_VARIADICS && BOOST_PP_VARIADICS_MSVC && _MSC_VER != 1400 +# if BOOST_PP_VARIADICS && BOOST_PP_VARIADICS_MSVC && _MSC_VER > 1400 # include # include # include @@ -45,6 +45,6 @@ /**/ # else # define BOOST_PP_ARRAY_DETAIL_GET_DATA(size, data) BOOST_PP_TUPLE_REM(size) data -# endif /* BOOST_PP_VARIADICS && BOOST_PP_VARIADICS_MSVC && _MSC_VER != 1400 */ +# endif /* BOOST_PP_VARIADICS && BOOST_PP_VARIADICS_MSVC && _MSC_VER > 1400 */ # # endif /* BOOST_PREPROCESSOR_ARRAY_DETAIL_GET_DATA_HPP */ diff --git a/include/boost/preprocessor/tuple/rem.hpp b/include/boost/preprocessor/tuple/rem.hpp index 136d282..78e47fe 100644 --- a/include/boost/preprocessor/tuple/rem.hpp +++ b/include/boost/preprocessor/tuple/rem.hpp @@ -37,7 +37,7 @@ /* VC++8.0 cannot handle the variadic version of BOOST_PP_TUPLE_REM(size) */ -# if BOOST_PP_VARIADICS && !(BOOST_PP_VARIADICS_MSVC && _MSC_VER == 1400) +# if BOOST_PP_VARIADICS && !(BOOST_PP_VARIADICS_MSVC && _MSC_VER <= 1400) # if BOOST_PP_VARIADICS_MSVC /* To be used internally when the size is 1 */ # define BOOST_PP_TUPLE_REM_CAT(size) BOOST_PP_REM_CAT From dec4cfd27394f3b5103c30a2bb6ba8ea65fd5716 Mon Sep 17 00:00:00 2001 From: Edward Diener Date: Fri, 2 May 2014 20:17:08 -0400 Subject: [PATCH 09/58] Further tests of changes involving empty data. --- test/array.cxx | 5 +++++ test/list.cxx | 2 ++ test/seq.cxx | 3 +++ test/tuple.cxx | 13 ++++++++++++- 4 files changed, 22 insertions(+), 1 deletion(-) diff --git a/test/array.cxx b/test/array.cxx index ae3a275..a764077 100644 --- a/test/array.cxx +++ b/test/array.cxx @@ -21,6 +21,7 @@ # include # endif +# define ARRAY_EMPTY (0, ()) # define ARRAY (3, (0, 1, 2)) # define ARRAY_LARGE (33, (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32)) # define ARRAY_VERY_LARGE (64, (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63)) @@ -124,15 +125,19 @@ BEGIN BOOST_PP_ARRAY_ELEM(55, BOOST_PP_ARRAY_POP_FRONT(ARRAY_VERY_LARGE)) == 56 BEGIN BOOST_PP_ARRAY_SIZE(BOOST_PP_ARRAY_PUSH_BACK(ARRAY, 3)) == 4 END BEGIN BOOST_PP_ARRAY_SIZE(BOOST_PP_ARRAY_PUSH_BACK(ARRAY_LARGE, 33)) == 34 END +BEGIN BOOST_PP_ARRAY_SIZE(BOOST_PP_ARRAY_PUSH_BACK(ARRAY_EMPTY, 10)) == 1 END BEGIN BOOST_PP_ARRAY_ELEM(0, BOOST_PP_ARRAY_PUSH_BACK(ARRAY, 3)) == 0 END BEGIN BOOST_PP_ARRAY_ELEM(33, BOOST_PP_ARRAY_PUSH_BACK(ARRAY_LARGE, 33)) == 33 END +BEGIN BOOST_PP_ARRAY_ELEM(0, BOOST_PP_ARRAY_PUSH_BACK(ARRAY_EMPTY, 136)) == 136 END // push_front BEGIN BOOST_PP_ARRAY_SIZE(BOOST_PP_ARRAY_PUSH_FRONT(ARRAY, 555)) == 4 END BEGIN BOOST_PP_ARRAY_SIZE(BOOST_PP_ARRAY_PUSH_FRONT(ARRAY_LARGE, 666)) == 34 END +BEGIN BOOST_PP_ARRAY_SIZE(BOOST_PP_ARRAY_PUSH_FRONT(ARRAY_EMPTY, 10)) == 1 END BEGIN BOOST_PP_ARRAY_ELEM(0, BOOST_PP_ARRAY_PUSH_FRONT(ARRAY, 555)) == 555 END BEGIN BOOST_PP_ARRAY_ELEM(33, BOOST_PP_ARRAY_PUSH_FRONT(ARRAY_LARGE, 33)) == 32 END +BEGIN BOOST_PP_ARRAY_ELEM(0, BOOST_PP_ARRAY_PUSH_FRONT(ARRAY_EMPTY, 136)) == 136 END // remove diff --git a/test/list.cxx b/test/list.cxx index db6c432..2f16086 100644 --- a/test/list.cxx +++ b/test/list.cxx @@ -19,6 +19,7 @@ # include # include # include +# include # include # include # include @@ -77,4 +78,5 @@ BEGIN BOOST_PP_LIST_FOR_EACH_PRODUCT(F2, 2, ( (1, (0, BOOST_PP_NIL)), (2, (3, BO BEGIN BOOST_PP_LIST_CAT(BOOST_PP_LIST_FOLD_LEFT(BOOST_PP_LIST_APPEND_D, BOOST_PP_NIL, LL)) == 0x0a1b2c3d END BEGIN BOOST_PP_ARRAY_ELEM(2, BOOST_PP_LIST_TO_ARRAY(LIST)) == 5 END +BEGIN BOOST_PP_ARRAY_SIZE(BOOST_PP_LIST_TO_ARRAY(LISTNIL)) == 0 END BEGIN BOOST_PP_SEQ_ELEM(3, BOOST_PP_LIST_TO_SEQ(LIST)) == 2 END diff --git a/test/seq.cxx b/test/seq.cxx index c64085d..b73ea99 100644 --- a/test/seq.cxx +++ b/test/seq.cxx @@ -16,6 +16,7 @@ # include # include # include +# include # include # include # include @@ -23,6 +24,7 @@ # include # include +# define SEQ_NONE () # define SEQ (4)(1)(5)(2) # define SEQVAR (4,5,8,3,61)(1,0)(5,22,43)(2)(17,45,33) @@ -98,6 +100,7 @@ BEGIN BOOST_PP_SEQ_CAT(BOOST_PP_SEQ_TAIL(BOOST_PP_SEQ_FOLD_LEFT(SEQ_APPEND, (~), BEGIN BOOST_PP_SEQ_SIZE(BOOST_PP_SEQ_TAIL(BOOST_PP_SEQ_FOLD_LEFT(SEQ_APPEND, (~), LL))) == 9 END BEGIN BOOST_PP_LIST_AT(BOOST_PP_SEQ_TO_LIST(SEQ), 2) == 5 END +BEGIN BOOST_PP_IS_EMPTY(BOOST_PP_LIST_AT(BOOST_PP_SEQ_TO_LIST(SEQ_NONE),0)) == 1 END #if BOOST_PP_VARIADICS diff --git a/test/tuple.cxx b/test/tuple.cxx index c315509..9187ff5 100644 --- a/test/tuple.cxx +++ b/test/tuple.cxx @@ -17,6 +17,7 @@ # include # include # include +# include # if BOOST_PP_VARIADICS # include # include @@ -25,6 +26,7 @@ # include # define TUPLE (0, 1, 2, 3, 4, 5) +# define TUPLE_NONE () # define TUPLE_LARGE (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32) # define TUPLE_VERY_LARGE (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63) # define T2 (+3, /2, +6) @@ -47,6 +49,7 @@ // elem +BEGIN BOOST_PP_IS_EMPTY(BOOST_PP_TUPLE_ELEM(1, 0, TUPLE_NONE)) == 1 END BEGIN BOOST_PP_TUPLE_ELEM(6, 3, TUPLE) == 3 END BEGIN BOOST_PP_TUPLE_ELEM(6, 5, TUPLE) == 5 END BEGIN BOOST_PP_TUPLE_ELEM(33, 15, TUPLE_LARGE) == 15 END @@ -92,6 +95,7 @@ BEGIN BOOST_PP_SEQ_ELEM(55,BOOST_PP_TUPLE_TO_SEQ(64,TUPLE_VERY_LARGE)) == 55 END // elem +BEGIN BOOST_PP_IS_EMPTY(BOOST_PP_TUPLE_ELEM(0, TUPLE_NONE)) == 1 END BEGIN BOOST_PP_TUPLE_ELEM(3, TUPLE) == 3 END BEGIN BOOST_PP_TUPLE_ELEM(5, TUPLE) == 5 END BEGIN BOOST_PP_TUPLE_ELEM(15, TUPLE_LARGE) == 15 END @@ -161,7 +165,7 @@ BEGIN BOOST_PP_TUPLE_ELEM(33, BOOST_PP_TUPLE_PUSH_FRONT(TUPLE_LARGE, 33)) == 32 // rem -#if BOOST_PP_VARIADICS_MSVC && _MSC_VER == 1400 +#if BOOST_PP_VARIADICS_MSVC && _MSC_VER <= 1400 BEGIN BOOST_PP_VARIADIC_SIZE(BOOST_PP_TUPLE_REM(6)(0, 1, 2, 3, 4, 5)) == 6 END BEGIN BOOST_PP_VARIADIC_SIZE(BOOST_PP_TUPLE_REM(33)(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32)) == 33 END @@ -169,6 +173,12 @@ BEGIN BOOST_PP_VARIADIC_SIZE(BOOST_PP_TUPLE_REM(64)(0, 1, 2, 3, 4, 5, 6, 7, 8, 9 #else +#if BOOST_PP_VARIADICS_MSVC +BEGIN BOOST_PP_IS_EMPTY(BOOST_PP_TUPLE_REM_CAT() TUPLE_NONE) == 1 END +#else +BEGIN BOOST_PP_IS_EMPTY(BOOST_PP_TUPLE_REM() TUPLE_NONE) == 1 END +#endif + BEGIN BOOST_PP_VARIADIC_SIZE(BOOST_PP_TUPLE_REM()(0, 1, 2, 3, 4, 5)) == 6 END BEGIN BOOST_PP_VARIADIC_SIZE(BOOST_PP_TUPLE_REM()(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32)) == 33 END BEGIN BOOST_PP_VARIADIC_SIZE(BOOST_PP_TUPLE_REM()(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63)) == 64 END @@ -177,6 +187,7 @@ BEGIN BOOST_PP_VARIADIC_SIZE(BOOST_PP_TUPLE_REM()(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, // rem_ctor +BEGIN BOOST_PP_VARIADIC_SIZE(BOOST_PP_TUPLE_REM_CTOR(TUPLE_NONE)) == 1 END BEGIN BOOST_PP_VARIADIC_SIZE(BOOST_PP_TUPLE_REM_CTOR(TUPLE)) == 6 END BEGIN BOOST_PP_VARIADIC_SIZE(BOOST_PP_TUPLE_REM_CTOR(TUPLE_LARGE)) == 33 END BEGIN BOOST_PP_VARIADIC_SIZE(BOOST_PP_TUPLE_REM_CTOR(TUPLE_VERY_LARGE)) == 64 END From 70e775452ace77c19506282d84be29eade10b636 Mon Sep 17 00:00:00 2001 From: Edward Diener Date: Sat, 3 May 2014 02:15:47 -0400 Subject: [PATCH 10/58] Added remove_parens and tests. --- include/boost/preprocessor/punctuation.hpp | 1 + .../punctuation/remove_parens.hpp | 39 +++++++++++++++++++ test/punctuation.cxx | 12 ++++++ 3 files changed, 52 insertions(+) create mode 100644 include/boost/preprocessor/punctuation/remove_parens.hpp diff --git a/include/boost/preprocessor/punctuation.hpp b/include/boost/preprocessor/punctuation.hpp index a96bbff..56dd064 100644 --- a/include/boost/preprocessor/punctuation.hpp +++ b/include/boost/preprocessor/punctuation.hpp @@ -17,5 +17,6 @@ # include # include # include +# include # # endif diff --git a/include/boost/preprocessor/punctuation/remove_parens.hpp b/include/boost/preprocessor/punctuation/remove_parens.hpp new file mode 100644 index 0000000..4700936 --- /dev/null +++ b/include/boost/preprocessor/punctuation/remove_parens.hpp @@ -0,0 +1,39 @@ +# /* ************************************************************************** +# * * +# * (C) Copyright Edward Diener 2014. +# * 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_REMOVE_PARENS_HPP +#define BOOST_PREPROCESSOR_REMOVE_PARENS_HPP + +#include + +#if BOOST_PP_VARIADICS + +#include +#include +#include +#include + +#define BOOST_PP_REMOVE_PARENS(param) \ + BOOST_PP_IIF \ + ( \ + BOOST_PP_IS_BEGIN_PARENS(param), \ + BOOST_PP_REMOVE_PARENS_DO, \ + BOOST_PP_IDENTITY \ + ) \ + (param)() \ +/**/ + +#define BOOST_PP_REMOVE_PARENS_DO(param) \ + BOOST_PP_IDENTITY(BOOST_PP_TUPLE_ENUM(param)) \ +/**/ + +#endif /* BOOST_PP_VARIADICS */ +#endif /* BOOST_PREPROCESSOR_REMOVE_PARENS_HPP */ diff --git a/test/punctuation.cxx b/test/punctuation.cxx index 3eb364b..8e60e9a 100644 --- a/test/punctuation.cxx +++ b/test/punctuation.cxx @@ -23,6 +23,11 @@ # define A_SEQ (r)($)(#) # define AN_ARRAY (4,(5,7,f,x)) # define A_LIST (e,(g,(&,BOOST_PP_NIL))) +# define DATA (5 + 3) * 4 +# define DATA2 4 * (5 + 3) +# define DATA3 4 * (5 + 3) * (2 + 1) +# define DATA4 (5 + 3) * (2 + 1) * 4 + // is_begin_parens @@ -39,4 +44,11 @@ BEGIN BOOST_PP_IS_BEGIN_PARENS(AN_ARRAY) == 1 END BEGIN BOOST_PP_IS_BEGIN_PARENS(A_LIST) == 1 END BEGIN BOOST_PP_IS_BEGIN_PARENS((y)2(x)) == 1 END +// remove_parens + +BEGIN BOOST_PP_REMOVE_PARENS(DATA) == 17 END +BEGIN BOOST_PP_REMOVE_PARENS(DATA2)== 32 END +BEGIN BOOST_PP_REMOVE_PARENS(DATA3)== 96 END +BEGIN BOOST_PP_REMOVE_PARENS(DATA4)== 41 END + #endif From 697ebcd840e4646cca46b43ab44784a724bbf6b3 Mon Sep 17 00:00:00 2001 From: Edward Diener Date: Sun, 4 May 2014 03:07:00 -0400 Subject: [PATCH 11/58] Fixes for empty conversions and tests for empty conversions. --- include/boost/preprocessor/array/to_list.hpp | 20 +++++++++++-- include/boost/preprocessor/list/to_array.hpp | 17 +++++++++++ include/boost/preprocessor/tuple/to_seq.hpp | 3 ++ test/array.cxx | 10 +++++++ test/list.cxx | 30 +++++++++++++------- test/seq.cxx | 15 ++++++++++ test/tuple.cxx | 15 ++++++++++ 7 files changed, 96 insertions(+), 14 deletions(-) diff --git a/include/boost/preprocessor/array/to_list.hpp b/include/boost/preprocessor/array/to_list.hpp index 9198561..4cb45b6 100644 --- a/include/boost/preprocessor/array/to_list.hpp +++ b/include/boost/preprocessor/array/to_list.hpp @@ -15,19 +15,33 @@ # # include # include +# include +# include # include # # /* BOOST_PP_ARRAY_TO_LIST */ # +# define BOOST_PP_ARRAY_TO_LIST(array) \ + BOOST_PP_IF \ + ( \ + BOOST_PP_ARRAY_SIZE(array), \ + BOOST_PP_ARRAY_TO_LIST_DO, \ + BOOST_PP_ARRAY_TO_LIST_EMPTY \ + ) \ + (array) \ +/**/ +# +# define BOOST_PP_ARRAY_TO_LIST_EMPTY(array) BOOST_PP_NIL +# # if BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MSVC() -# define BOOST_PP_ARRAY_TO_LIST(array) BOOST_PP_ARRAY_TO_LIST_I(BOOST_PP_TUPLE_TO_LIST, array) +# define BOOST_PP_ARRAY_TO_LIST_DO(array) BOOST_PP_ARRAY_TO_LIST_I(BOOST_PP_TUPLE_TO_LIST, array) # define BOOST_PP_ARRAY_TO_LIST_I(m, args) BOOST_PP_ARRAY_TO_LIST_II(m, args) # define BOOST_PP_ARRAY_TO_LIST_II(m, args) BOOST_PP_CAT(m ## args,) # elif BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MWCC() -# define BOOST_PP_ARRAY_TO_LIST(array) BOOST_PP_ARRAY_TO_LIST_I(array) +# define BOOST_PP_ARRAY_TO_LIST_DO(array) BOOST_PP_ARRAY_TO_LIST_I(array) # define BOOST_PP_ARRAY_TO_LIST_I(array) BOOST_PP_TUPLE_TO_LIST ## array # else -# define BOOST_PP_ARRAY_TO_LIST(array) BOOST_PP_TUPLE_TO_LIST array +# define BOOST_PP_ARRAY_TO_LIST_DO(array) BOOST_PP_TUPLE_TO_LIST array # endif # # endif diff --git a/include/boost/preprocessor/list/to_array.hpp b/include/boost/preprocessor/list/to_array.hpp index 5a0433d..3711d4c 100644 --- a/include/boost/preprocessor/list/to_array.hpp +++ b/include/boost/preprocessor/list/to_array.hpp @@ -21,10 +21,27 @@ # include # include # include +# if BOOST_PP_VARIADICS && BOOST_PP_VARIADICS_MSVC && (_MSC_VER <= 1400) +# include +# endif # # /* BOOST_PP_LIST_TO_ARRAY */ # +# if BOOST_PP_VARIADICS && BOOST_PP_VARIADICS_MSVC && (_MSC_VER <= 1400) +# define BOOST_PP_LIST_TO_ARRAY(list) \ + BOOST_PP_IIF \ + ( \ + BOOST_PP_LIST_IS_NIL(list), \ + BOOST_PP_LIST_TO_ARRAY_VC8ORLESS_EMPTY, \ + BOOST_PP_LIST_TO_ARRAY_VC8ORLESS_DO \ + ) \ + (list) \ +/**/ +# define BOOST_PP_LIST_TO_ARRAY_VC8ORLESS_EMPTY(list) (0,()) +# define BOOST_PP_LIST_TO_ARRAY_VC8ORLESS_DO(list) BOOST_PP_LIST_TO_ARRAY_I(BOOST_PP_WHILE, list) +# else # define BOOST_PP_LIST_TO_ARRAY(list) BOOST_PP_LIST_TO_ARRAY_I(BOOST_PP_WHILE, list) +# endif # if BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MSVC() # define BOOST_PP_LIST_TO_ARRAY_I(w, list) \ diff --git a/include/boost/preprocessor/tuple/to_seq.hpp b/include/boost/preprocessor/tuple/to_seq.hpp index 8bd8485..a53f5a0 100644 --- a/include/boost/preprocessor/tuple/to_seq.hpp +++ b/include/boost/preprocessor/tuple/to_seq.hpp @@ -48,6 +48,9 @@ # endif # endif # +/* An empty array can be passed */ +# define BOOST_PP_TUPLE_TO_SEQ_0() () +# # define BOOST_PP_TUPLE_TO_SEQ_1(e0) (e0) # define BOOST_PP_TUPLE_TO_SEQ_2(e0, e1) (e0)(e1) # define BOOST_PP_TUPLE_TO_SEQ_3(e0, e1, e2) (e0)(e1)(e2) diff --git a/test/array.cxx b/test/array.cxx index a764077..fd189c7 100644 --- a/test/array.cxx +++ b/test/array.cxx @@ -13,9 +13,13 @@ # # include # include +# include # include +# include # include +# include # include +# include # if BOOST_PP_VARIADICS # include # include @@ -67,6 +71,7 @@ BEGIN BOOST_PP_LIST_AT(BOOST_PP_ARRAY_TO_LIST(ARRAY), 1) == 1 END BEGIN BOOST_PP_LIST_AT(BOOST_PP_ARRAY_TO_LIST((5, (0, 1, 2, 3, 4))), 4) == 4 END BEGIN BOOST_PP_LIST_AT(BOOST_PP_ARRAY_TO_LIST((33, (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32))), 26) == 26 END BEGIN BOOST_PP_LIST_AT(BOOST_PP_ARRAY_TO_LIST(ARRAY_VERY_LARGE), 60) == 60 END +BEGIN BOOST_PP_LIST_SIZE(BOOST_PP_ARRAY_TO_LIST(ARRAY_EMPTY)) == 0 END // to_seq @@ -74,6 +79,8 @@ BEGIN BOOST_PP_SEQ_ELEM(0, BOOST_PP_ARRAY_TO_SEQ(ARRAY)) == 0 END BEGIN BOOST_PP_SEQ_ELEM(3, BOOST_PP_ARRAY_TO_SEQ((5, (0, 1, 2, 3, 4)))) == 3 END BEGIN BOOST_PP_SEQ_ELEM(17, BOOST_PP_ARRAY_TO_SEQ(ARRAY_LARGE)) == 17 END BEGIN BOOST_PP_SEQ_ELEM(42, BOOST_PP_ARRAY_TO_SEQ((64, (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63)))) == 42 END +BEGIN BOOST_PP_IS_EMPTY(BOOST_PP_SEQ_ELEM(0,BOOST_PP_ARRAY_TO_SEQ(ARRAY_EMPTY))) == 1 END +BEGIN BOOST_PP_SEQ_SIZE(BOOST_PP_ARRAY_TO_SEQ(ARRAY_EMPTY)) == 1 END // to_tuple @@ -83,6 +90,8 @@ BEGIN BOOST_PP_TUPLE_ELEM(2, BOOST_PP_ARRAY_TO_TUPLE(ARRAY)) == 2 END BEGIN BOOST_PP_TUPLE_ELEM(1, BOOST_PP_ARRAY_TO_TUPLE((5, (0, 1, 2, 3, 4)))) == 1 END BEGIN BOOST_PP_TUPLE_ELEM(26, BOOST_PP_ARRAY_TO_TUPLE(ARRAY_LARGE)) == 26 END BEGIN BOOST_PP_TUPLE_ELEM(37, BOOST_PP_ARRAY_TO_TUPLE((64, (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63)))) == 37 END +BEGIN BOOST_PP_TUPLE_SIZE(BOOST_PP_ARRAY_TO_TUPLE(ARRAY_EMPTY)) == 1 END +BEGIN BOOST_PP_IS_EMPTY(BOOST_PP_TUPLE_ELEM(0, BOOST_PP_ARRAY_TO_TUPLE(ARRAY_EMPTY))) == 1 END # else @@ -90,6 +99,7 @@ BEGIN BOOST_PP_TUPLE_ELEM(3, 2, BOOST_PP_ARRAY_TO_TUPLE(ARRAY)) == 2 END BEGIN BOOST_PP_TUPLE_ELEM(5, 1, BOOST_PP_ARRAY_TO_TUPLE((5, (0, 1, 2, 3, 4)))) == 1 END BEGIN BOOST_PP_TUPLE_ELEM(33, 26, BOOST_PP_ARRAY_TO_TUPLE(ARRAY_LARGE)) == 26 END BEGIN BOOST_PP_TUPLE_ELEM(64, 37, BOOST_PP_ARRAY_TO_TUPLE((64, (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63)))) == 37 END +BEGIN BOOST_PP_IS_EMPTY(BOOST_PP_TUPLE_ELEM(1, 0, BOOST_PP_ARRAY_TO_TUPLE(ARRAY_EMPTY))) == 1 END # endif diff --git a/test/list.cxx b/test/list.cxx index 2f16086..1e33274 100644 --- a/test/list.cxx +++ b/test/list.cxx @@ -16,18 +16,27 @@ # include # include # include +# include # include # include +# include # include # include # include +# include # include # include # define LISTNIL BOOST_PP_NIL # define LIST (4, (1, (5, (2, BOOST_PP_NIL)))) - # define REVERSAL(d, x, y) BOOST_PP_SUB_D(d, y, x) +# define F1(r, state, x) + x + state +# define FI2(r, state, i, x) BOOST_PP_IIF(BOOST_PP_EQUAL(i,1),+ x + x + state,+ x + state) +# define F2(r, x) + BOOST_PP_TUPLE_ELEM(2, 0, x) + 2 - BOOST_PP_TUPLE_ELEM(2, 1, x) +# define L1 (0, (x, BOOST_PP_NIL)) +# define L2 (a, (1, (b, (2, BOOST_PP_NIL)))) +# define L3 (c, (3, (d, BOOST_PP_NIL))) +# define LL (L1, (L2, (L3, BOOST_PP_NIL))) BEGIN BOOST_PP_LIST_FIRST(LIST) == 4 END BEGIN BOOST_PP_LIST_IS_CONS(LIST) == 1 END @@ -52,31 +61,30 @@ BEGIN BOOST_PP_LIST_CAT(BOOST_PP_LIST_FIRST_N(2, LIST)) == 41 END BEGIN BOOST_PP_LIST_AT(LIST, 2) == 5 END BEGIN BOOST_PP_LIST_SIZE(LIST) == 4 END +BEGIN BOOST_PP_LIST_SIZE(LISTNIL) == 0 END BEGIN BOOST_PP_LIST_CAT(BOOST_PP_LIST_TRANSFORM(BOOST_PP_ADD_D, 2, LIST)) == 6374 END BEGIN BOOST_PP_LIST_CAT(BOOST_PP_LIST_APPEND(BOOST_PP_LIST_REST(LIST), LIST)) == 1524152 END -# define F1(r, state, x) + x + state -# define FI2(r, state, i, x) BOOST_PP_IIF(BOOST_PP_EQUAL(i,1),+ x + x + state,+ x + state) - BEGIN BOOST_PP_LIST_FOR_EACH(F1, 1, LIST) == 16 END BEGIN BOOST_PP_LIST_FOR_EACH_I(FI2, 1, LIST) == 17 END BEGIN BOOST_PP_TUPLE_ELEM(4, 3, BOOST_PP_LIST_TO_TUPLE(LIST)) == 2 END +BEGIN BOOST_PP_IS_EMPTY(BOOST_PP_TUPLE_ELEM(1, 0, BOOST_PP_LIST_TO_TUPLE(LISTNIL))) == 1 END + +#if BOOST_PP_VARIADICS + +BEGIN BOOST_PP_TUPLE_SIZE(BOOST_PP_LIST_TO_TUPLE(LISTNIL)) == 1 END + +#endif BEGIN BOOST_PP_LIST_CAT(BOOST_PP_LIST_FILTER(BOOST_PP_LESS_D, 3, LIST)) == 45 END -# define F2(r, x) + BOOST_PP_TUPLE_ELEM(2, 0, x) + 2 - BOOST_PP_TUPLE_ELEM(2, 1, x) BEGIN BOOST_PP_LIST_FOR_EACH_PRODUCT(F2, 2, ( (1, (0, BOOST_PP_NIL)), (2, (3, BOOST_PP_NIL)) )) == 0 END -# define L1 (0, (x, BOOST_PP_NIL)) -# define L2 (a, (1, (b, (2, BOOST_PP_NIL)))) -# define L3 (c, (3, (d, BOOST_PP_NIL))) - -# define LL (L1, (L2, (L3, BOOST_PP_NIL))) - BEGIN BOOST_PP_LIST_CAT(BOOST_PP_LIST_FOLD_LEFT(BOOST_PP_LIST_APPEND_D, BOOST_PP_NIL, LL)) == 0x0a1b2c3d END BEGIN BOOST_PP_ARRAY_ELEM(2, BOOST_PP_LIST_TO_ARRAY(LIST)) == 5 END BEGIN BOOST_PP_ARRAY_SIZE(BOOST_PP_LIST_TO_ARRAY(LISTNIL)) == 0 END BEGIN BOOST_PP_SEQ_ELEM(3, BOOST_PP_LIST_TO_SEQ(LIST)) == 2 END +BEGIN BOOST_PP_IS_EMPTY(BOOST_PP_LIST_TO_SEQ(LISTNIL)) == 1 END diff --git a/test/seq.cxx b/test/seq.cxx index b73ea99..ae37291 100644 --- a/test/seq.cxx +++ b/test/seq.cxx @@ -19,8 +19,11 @@ # include # include # include +# include # include +# include # include +# include # include # include @@ -55,8 +58,19 @@ BEGIN BOOST_PP_SEQ_FOR_EACH(F1, 1, SEQ) == 16 END BEGIN BOOST_PP_SEQ_FOR_EACH_I(FI2, 1, SEQ) == 21 END BEGIN BOOST_PP_TUPLE_ELEM(4, 3, BOOST_PP_SEQ_TO_TUPLE(SEQ)) == 2 END +BEGIN BOOST_PP_IS_EMPTY(BOOST_PP_TUPLE_ELEM(1, 0, BOOST_PP_SEQ_TO_TUPLE(SEQ_NONE))) == 1 END + +#if BOOST_PP_VARIADICS + +BEGIN BOOST_PP_TUPLE_SIZE(BOOST_PP_SEQ_TO_TUPLE(SEQ_NONE)) == 1 END + +#endif + BEGIN BOOST_PP_ARRAY_ELEM(3, BOOST_PP_SEQ_TO_ARRAY(SEQ)) == 2 END +BEGIN BOOST_PP_IS_EMPTY(BOOST_PP_ARRAY_ELEM(0, BOOST_PP_SEQ_TO_ARRAY(SEQ_NONE))) == 1 END +BEGIN BOOST_PP_ARRAY_SIZE(BOOST_PP_SEQ_TO_ARRAY(SEQ_NONE)) == 1 END + # define LESS_S(s, x, y) BOOST_PP_LESS(x, y) BEGIN BOOST_PP_SEQ_CAT(BOOST_PP_SEQ_FILTER(LESS_S, 3, SEQ)) == 45 END @@ -101,6 +115,7 @@ BEGIN BOOST_PP_SEQ_SIZE(BOOST_PP_SEQ_TAIL(BOOST_PP_SEQ_FOLD_LEFT(SEQ_APPEND, (~) BEGIN BOOST_PP_LIST_AT(BOOST_PP_SEQ_TO_LIST(SEQ), 2) == 5 END BEGIN BOOST_PP_IS_EMPTY(BOOST_PP_LIST_AT(BOOST_PP_SEQ_TO_LIST(SEQ_NONE),0)) == 1 END +BEGIN BOOST_PP_LIST_SIZE(BOOST_PP_SEQ_TO_LIST(SEQ_NONE)) == 1 END #if BOOST_PP_VARIADICS diff --git a/test/tuple.cxx b/test/tuple.cxx index 9187ff5..68d7209 100644 --- a/test/tuple.cxx +++ b/test/tuple.cxx @@ -15,8 +15,11 @@ # include # include # include +# include # include +# include # include +# include # include # if BOOST_PP_VARIADICS # include @@ -78,18 +81,24 @@ BEGIN TEST_EAT_VERY_LARGE == 8 END BEGIN BOOST_PP_ARRAY_ELEM(3,BOOST_PP_TUPLE_TO_ARRAY(6,TUPLE)) == 3 END BEGIN BOOST_PP_ARRAY_ELEM(29,BOOST_PP_TUPLE_TO_ARRAY(33,TUPLE_LARGE)) == 29 END BEGIN BOOST_PP_ARRAY_ELEM(61,BOOST_PP_TUPLE_TO_ARRAY(64,TUPLE_VERY_LARGE)) == 61 END +BEGIN BOOST_PP_IS_EMPTY(BOOST_PP_ARRAY_ELEM(0,BOOST_PP_TUPLE_TO_ARRAY(1,TUPLE_NONE))) == 1 END +BEGIN BOOST_PP_ARRAY_SIZE(BOOST_PP_TUPLE_TO_ARRAY(1,TUPLE_NONE)) == 1 END // to_list BEGIN BOOST_PP_LIST_AT(BOOST_PP_TUPLE_TO_LIST(6,TUPLE), 2) == 2 END BEGIN BOOST_PP_LIST_AT(BOOST_PP_TUPLE_TO_LIST(33,TUPLE_LARGE), 19) == 19 END BEGIN BOOST_PP_LIST_AT(BOOST_PP_TUPLE_TO_LIST(64,TUPLE_VERY_LARGE), 62) == 62 END +BEGIN BOOST_PP_IS_EMPTY(BOOST_PP_LIST_AT(BOOST_PP_TUPLE_TO_LIST(1,TUPLE_NONE), 0)) == 1 END +BEGIN BOOST_PP_LIST_SIZE(BOOST_PP_TUPLE_TO_LIST(1,TUPLE_NONE)) == 1 END // to_seq BEGIN BOOST_PP_SEQ_ELEM(4,BOOST_PP_TUPLE_TO_SEQ(6,TUPLE)) == 4 END BEGIN BOOST_PP_SEQ_ELEM(31,BOOST_PP_TUPLE_TO_SEQ(33,TUPLE_LARGE)) == 31 END BEGIN BOOST_PP_SEQ_ELEM(55,BOOST_PP_TUPLE_TO_SEQ(64,TUPLE_VERY_LARGE)) == 55 END +BEGIN BOOST_PP_IS_EMPTY(BOOST_PP_SEQ_ELEM(0,BOOST_PP_TUPLE_TO_SEQ(1,TUPLE_NONE))) == 1 END +BEGIN BOOST_PP_SEQ_SIZE(BOOST_PP_TUPLE_TO_SEQ(1,TUPLE_NONE)) == 1 END #if BOOST_PP_VARIADICS @@ -220,17 +229,23 @@ BEGIN BOOST_PP_TUPLE_SIZE(TUPLE_VERY_LARGE) == 64 END BEGIN BOOST_PP_ARRAY_ELEM(3,BOOST_PP_TUPLE_TO_ARRAY(TUPLE)) == 3 END BEGIN BOOST_PP_ARRAY_ELEM(29,BOOST_PP_TUPLE_TO_ARRAY(TUPLE_LARGE)) == 29 END BEGIN BOOST_PP_ARRAY_ELEM(61,BOOST_PP_TUPLE_TO_ARRAY(TUPLE_VERY_LARGE)) == 61 END +BEGIN BOOST_PP_IS_EMPTY(BOOST_PP_ARRAY_ELEM(0,BOOST_PP_TUPLE_TO_ARRAY(TUPLE_NONE))) == 1 END +BEGIN BOOST_PP_ARRAY_SIZE(BOOST_PP_TUPLE_TO_ARRAY(TUPLE_NONE)) == 1 END // to_tuple BEGIN BOOST_PP_LIST_AT(BOOST_PP_TUPLE_TO_LIST(TUPLE), 2) == 2 END BEGIN BOOST_PP_LIST_AT(BOOST_PP_TUPLE_TO_LIST(TUPLE_LARGE), 19) == 19 END BEGIN BOOST_PP_LIST_AT(BOOST_PP_TUPLE_TO_LIST(TUPLE_VERY_LARGE), 62) == 62 END +BEGIN BOOST_PP_IS_EMPTY(BOOST_PP_LIST_AT(BOOST_PP_TUPLE_TO_LIST(TUPLE_NONE), 0)) == 1 END +BEGIN BOOST_PP_LIST_SIZE(BOOST_PP_TUPLE_TO_LIST(TUPLE_NONE)) == 1 END // to_seq BEGIN BOOST_PP_SEQ_ELEM(4,BOOST_PP_TUPLE_TO_SEQ(TUPLE)) == 4 END BEGIN BOOST_PP_SEQ_ELEM(31,BOOST_PP_TUPLE_TO_SEQ(TUPLE_LARGE)) == 31 END BEGIN BOOST_PP_SEQ_ELEM(55,BOOST_PP_TUPLE_TO_SEQ(TUPLE_VERY_LARGE)) == 55 END +BEGIN BOOST_PP_IS_EMPTY(BOOST_PP_SEQ_ELEM(0,BOOST_PP_TUPLE_TO_SEQ(TUPLE_NONE))) == 1 END +BEGIN BOOST_PP_SEQ_SIZE(BOOST_PP_TUPLE_TO_SEQ(TUPLE_NONE)) == 1 END #endif From 181a88db7e5b578d16d7d26a07ee5bd093942d5b Mon Sep 17 00:00:00 2001 From: Edward Diener Date: Sun, 4 May 2014 23:55:53 -0400 Subject: [PATCH 12/58] Added further tests for empty lists and arrays. --- test/array.cxx | 6 ++++++ test/list.cxx | 9 +++++++++ 2 files changed, 15 insertions(+) diff --git a/test/array.cxx b/test/array.cxx index fd189c7..975aaa3 100644 --- a/test/array.cxx +++ b/test/array.cxx @@ -47,6 +47,7 @@ BEGIN BOOST_PP_ARRAY_SIZE(ARRAY_LARGE) == 33 END BEGIN BOOST_PP_ARRAY_SIZE((33, (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32))) == 33 END BEGIN BOOST_PP_ARRAY_SIZE(ARRAY_VERY_LARGE) == 64 END BEGIN BOOST_PP_ARRAY_SIZE((64, (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63))) == 64 END +BEGIN BOOST_PP_ARRAY_SIZE(ARRAY_EMPTY) == 0 END // enum @@ -62,6 +63,7 @@ BEGIN BOOST_PP_VARIADIC_SIZE(BOOST_PP_ARRAY_ENUM((5, (0, 1, 2, 3, 4)))) == 5 END BEGIN BOOST_PP_VARIADIC_SIZE(BOOST_PP_ARRAY_ENUM(ARRAY_LARGE)) == 33 END BEGIN BOOST_PP_VARIADIC_SIZE(BOOST_PP_ARRAY_ENUM(ARRAY_VERY_LARGE)) == 64 END BEGIN BOOST_PP_VARIADIC_SIZE(BOOST_PP_ARRAY_ENUM((64, (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63)))) == 64 END +BEGIN BOOST_PP_VARIADIC_SIZE(BOOST_PP_ARRAY_ENUM(ARRAY_EMPTY)) == 1 END # endif @@ -115,6 +117,9 @@ BEGIN BOOST_PP_ARRAY_ELEM(22, BOOST_PP_ARRAY_INSERT(ARRAY_LARGE,22,1000)) == 100 BEGIN BOOST_PP_ARRAY_ELEM(26, BOOST_PP_ARRAY_INSERT(ARRAY_LARGE,22,1000)) == 25 END BEGIN BOOST_PP_ARRAY_SIZE(BOOST_PP_ARRAY_INSERT(ARRAY_LARGE,22,1000)) == 34 END +BEGIN BOOST_PP_ARRAY_ELEM(0, BOOST_PP_ARRAY_INSERT(ARRAY_EMPTY,0,25)) == 25 END +BEGIN BOOST_PP_ARRAY_SIZE(BOOST_PP_ARRAY_INSERT(ARRAY_EMPTY,0,1000)) == 1 END + // pop_back BEGIN BOOST_PP_ARRAY_SIZE(BOOST_PP_ARRAY_POP_BACK(ARRAY)) == 2 END @@ -172,3 +177,4 @@ BEGIN BOOST_PP_ARRAY_SIZE(BOOST_PP_ARRAY_REVERSE(ARRAY_VERY_LARGE)) == 64 END BEGIN BOOST_PP_ARRAY_ELEM(0, BOOST_PP_ARRAY_REVERSE(ARRAY)) == 2 END BEGIN BOOST_PP_ARRAY_ELEM(29, BOOST_PP_ARRAY_REVERSE(ARRAY_LARGE)) == 3 END BEGIN BOOST_PP_ARRAY_ELEM(38, BOOST_PP_ARRAY_REVERSE(ARRAY_VERY_LARGE)) == 25 END +BEGIN BOOST_PP_ARRAY_SIZE(BOOST_PP_ARRAY_REVERSE(ARRAY_EMPTY)) == 0 END diff --git a/test/list.cxx b/test/list.cxx index 1e33274..187787b 100644 --- a/test/list.cxx +++ b/test/list.cxx @@ -51,12 +51,16 @@ BEGIN BOOST_PP_VARIADIC_ELEM(2,BOOST_PP_LIST_ENUM(LIST)) == 5 END #endif BEGIN BOOST_PP_LIST_FOLD_LEFT(BOOST_PP_SUB_D, 22, LIST) == 10 END +BEGIN BOOST_PP_LIST_FOLD_LEFT(BOOST_PP_SUB_D, 22, LISTNIL) == 22 END BEGIN BOOST_PP_LIST_FOLD_RIGHT(BOOST_PP_ADD_D, 0, LIST) == 12 END +BEGIN BOOST_PP_LIST_FOLD_RIGHT(BOOST_PP_ADD_D, 0, LISTNIL) == 0 END BEGIN BOOST_PP_LIST_FOLD_RIGHT(REVERSAL, 0, LIST) == 4 END BEGIN BOOST_PP_LIST_CAT(BOOST_PP_LIST_REVERSE(LIST)) == 2514 END +BEGIN BOOST_PP_LIST_IS_NIL(BOOST_PP_LIST_REVERSE(LISTNIL)) == 1 END BEGIN BOOST_PP_LIST_CAT(BOOST_PP_LIST_REST_N(2, LIST)) == 52 END +BEGIN BOOST_PP_LIST_IS_NIL(BOOST_PP_LIST_REST_N(0, LISTNIL)) == 1 END BEGIN BOOST_PP_LIST_CAT(BOOST_PP_LIST_FIRST_N(2, LIST)) == 41 END BEGIN BOOST_PP_LIST_AT(LIST, 2) == 5 END @@ -64,7 +68,11 @@ BEGIN BOOST_PP_LIST_SIZE(LIST) == 4 END BEGIN BOOST_PP_LIST_SIZE(LISTNIL) == 0 END BEGIN BOOST_PP_LIST_CAT(BOOST_PP_LIST_TRANSFORM(BOOST_PP_ADD_D, 2, LIST)) == 6374 END +BEGIN BOOST_PP_LIST_IS_NIL(BOOST_PP_LIST_TRANSFORM(BOOST_PP_ADD_D, 2, LISTNIL)) == 1 END BEGIN BOOST_PP_LIST_CAT(BOOST_PP_LIST_APPEND(BOOST_PP_LIST_REST(LIST), LIST)) == 1524152 END +BEGIN BOOST_PP_LIST_CAT(BOOST_PP_LIST_APPEND(LIST,LISTNIL)) == 4152 END +BEGIN BOOST_PP_LIST_CAT(BOOST_PP_LIST_APPEND(LISTNIL,LIST)) == 4152 END +BEGIN BOOST_PP_LIST_IS_NIL(BOOST_PP_LIST_APPEND(LISTNIL,LISTNIL)) == 1 END BEGIN BOOST_PP_LIST_FOR_EACH(F1, 1, LIST) == 16 END BEGIN BOOST_PP_LIST_FOR_EACH_I(FI2, 1, LIST) == 17 END @@ -79,6 +87,7 @@ BEGIN BOOST_PP_TUPLE_SIZE(BOOST_PP_LIST_TO_TUPLE(LISTNIL)) == 1 END #endif BEGIN BOOST_PP_LIST_CAT(BOOST_PP_LIST_FILTER(BOOST_PP_LESS_D, 3, LIST)) == 45 END +BEGIN BOOST_PP_LIST_IS_NIL(BOOST_PP_LIST_FILTER(BOOST_PP_LESS_D, 3, LISTNIL)) == 1 END BEGIN BOOST_PP_LIST_FOR_EACH_PRODUCT(F2, 2, ( (1, (0, BOOST_PP_NIL)), (2, (3, BOOST_PP_NIL)) )) == 0 END From 1f16a481c72933af001f710343ff114f74aa498b Mon Sep 17 00:00:00 2001 From: Edward Diener Date: Mon, 5 May 2014 20:49:20 -0400 Subject: [PATCH 13/58] Changed functionality so empty arrays/lists when converted to a seq or a tuple expand to nothing. --- include/boost/preprocessor/array/to_seq.hpp | 19 ++++++++++-- include/boost/preprocessor/array/to_tuple.hpp | 13 +++++++- include/boost/preprocessor/list/to_array.hpp | 14 +++++++++ include/boost/preprocessor/list/to_tuple.hpp | 30 ++++++++++++++++--- test/array.cxx | 5 ---- test/list.cxx | 8 ----- 6 files changed, 68 insertions(+), 21 deletions(-) diff --git a/include/boost/preprocessor/array/to_seq.hpp b/include/boost/preprocessor/array/to_seq.hpp index ebcae53..3534d9c 100644 --- a/include/boost/preprocessor/array/to_seq.hpp +++ b/include/boost/preprocessor/array/to_seq.hpp @@ -15,19 +15,32 @@ # # include # include +# include +# include +# include # include # # /* BOOST_PP_ARRAY_TO_SEQ */ # +# define BOOST_PP_ARRAY_TO_SEQ(array) \ + BOOST_PP_IF \ + ( \ + BOOST_PP_ARRAY_SIZE(array), \ + BOOST_PP_ARRAY_TO_SEQ_DO, \ + BOOST_PP_EMPTY \ + ) \ + (array) \ +/**/ +# # if BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MSVC() -# define BOOST_PP_ARRAY_TO_SEQ(array) BOOST_PP_ARRAY_TO_SEQ_I(BOOST_PP_TUPLE_TO_SEQ, array) +# define BOOST_PP_ARRAY_TO_SEQ_DO(array) BOOST_PP_ARRAY_TO_SEQ_I(BOOST_PP_TUPLE_TO_SEQ, array) # define BOOST_PP_ARRAY_TO_SEQ_I(m, args) BOOST_PP_ARRAY_TO_SEQ_II(m, args) # define BOOST_PP_ARRAY_TO_SEQ_II(m, args) BOOST_PP_CAT(m ## args,) # elif BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MWCC() -# define BOOST_PP_ARRAY_TO_SEQ(array) BOOST_PP_ARRAY_TO_SEQ_I(array) +# define BOOST_PP_ARRAY_TO_SEQ_DO(array) BOOST_PP_ARRAY_TO_SEQ_I(array) # define BOOST_PP_ARRAY_TO_SEQ_I(array) BOOST_PP_TUPLE_TO_SEQ ## array # else -# define BOOST_PP_ARRAY_TO_SEQ(array) BOOST_PP_TUPLE_TO_SEQ array +# define BOOST_PP_ARRAY_TO_SEQ_DO(array) BOOST_PP_TUPLE_TO_SEQ array # endif # # endif diff --git a/include/boost/preprocessor/array/to_tuple.hpp b/include/boost/preprocessor/array/to_tuple.hpp index eb83274..b513e22 100644 --- a/include/boost/preprocessor/array/to_tuple.hpp +++ b/include/boost/preprocessor/array/to_tuple.hpp @@ -14,9 +14,20 @@ # define BOOST_PREPROCESSOR_ARRAY_TO_TUPLE_HPP # # include +# include +# include +# include # # /* BOOST_PP_ARRAY_TO_TUPLE */ # -# define BOOST_PP_ARRAY_TO_TUPLE BOOST_PP_ARRAY_DATA +# define BOOST_PP_ARRAY_TO_TUPLE(array) \ + BOOST_PP_IF \ + ( \ + BOOST_PP_ARRAY_SIZE(array), \ + BOOST_PP_ARRAY_DATA, \ + BOOST_PP_EMPTY \ + ) \ + (array) \ +/**/ # # endif diff --git a/include/boost/preprocessor/list/to_array.hpp b/include/boost/preprocessor/list/to_array.hpp index 3711d4c..bd44d68 100644 --- a/include/boost/preprocessor/list/to_array.hpp +++ b/include/boost/preprocessor/list/to_array.hpp @@ -137,6 +137,20 @@ # # /* BOOST_PP_LIST_TO_ARRAY_D */ # +# if BOOST_PP_VARIADICS && BOOST_PP_VARIADICS_MSVC && (_MSC_VER <= 1400) +# define BOOST_PP_LIST_TO_ARRAY_D(d, list) \ + BOOST_PP_IIF \ + ( \ + BOOST_PP_LIST_IS_NIL(list), \ + BOOST_PP_LIST_TO_ARRAY_D_VC8ORLESS_EMPTY, \ + BOOST_PP_LIST_TO_ARRAY_D_VC8ORLESS_DO \ + ) \ + (d, list) \ +/**/ +# define BOOST_PP_LIST_TO_ARRAY_D_VC8ORLESS_EMPTY(d, list) (0,()) +# define BOOST_PP_LIST_TO_ARRAY_D_VC8ORLESS_DO(d, list) BOOST_PP_LIST_TO_ARRAY_I(BOOST_PP_WHILE_ ## d, list) +# else # define BOOST_PP_LIST_TO_ARRAY_D(d, list) BOOST_PP_LIST_TO_ARRAY_I(BOOST_PP_WHILE_ ## d, list) +# endif # # endif /* BOOST_PREPROCESSOR_LIST_TO_ARRAY_HPP */ diff --git a/include/boost/preprocessor/list/to_tuple.hpp b/include/boost/preprocessor/list/to_tuple.hpp index 557de36..d693b91 100644 --- a/include/boost/preprocessor/list/to_tuple.hpp +++ b/include/boost/preprocessor/list/to_tuple.hpp @@ -16,22 +16,44 @@ # # include # include +# include +# include # # /* BOOST_PP_LIST_TO_TUPLE */ # +# define BOOST_PP_LIST_TO_TUPLE(list) \ + BOOST_PP_IIF \ + ( \ + BOOST_PP_LIST_IS_NIL(list), \ + BOOST_PP_EMPTY, \ + BOOST_PP_LIST_TO_TUPLE_DO \ + ) \ + (list) \ +/**/ +# # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG() -# define BOOST_PP_LIST_TO_TUPLE(list) (BOOST_PP_LIST_ENUM(list)) +# define BOOST_PP_LIST_TO_TUPLE_DO(list) (BOOST_PP_LIST_ENUM(list)) # else -# define BOOST_PP_LIST_TO_TUPLE(list) BOOST_PP_LIST_TO_TUPLE_I(list) +# define BOOST_PP_LIST_TO_TUPLE_DO(list) BOOST_PP_LIST_TO_TUPLE_I(list) # define BOOST_PP_LIST_TO_TUPLE_I(list) (BOOST_PP_LIST_ENUM(list)) # endif # # /* BOOST_PP_LIST_TO_TUPLE_R */ # +# define BOOST_PP_LIST_TO_TUPLE_R(r, list) \ + BOOST_PP_IIF \ + ( \ + BOOST_PP_LIST_IS_NIL(list), \ + BOOST_PP_EMPTY, \ + BOOST_PP_LIST_TO_TUPLE_R_DO \ + ) \ + (r, list) \ +/**/ +# # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG() -# define BOOST_PP_LIST_TO_TUPLE_R(r, list) (BOOST_PP_LIST_ENUM_R(r, list)) +# define BOOST_PP_LIST_TO_TUPLE_R_DO(r, list) (BOOST_PP_LIST_ENUM_R(r, list)) # else -# define BOOST_PP_LIST_TO_TUPLE_R(r, list) BOOST_PP_LIST_TO_TUPLE_R_I(r, list) +# define BOOST_PP_LIST_TO_TUPLE_R_DO(r, list) BOOST_PP_LIST_TO_TUPLE_R_I(r, list) # define BOOST_PP_LIST_TO_TUPLE_R_I(r, list) (BOOST_PP_LIST_ENUM_R(r, list)) # endif # diff --git a/test/array.cxx b/test/array.cxx index 975aaa3..745581d 100644 --- a/test/array.cxx +++ b/test/array.cxx @@ -81,8 +81,6 @@ BEGIN BOOST_PP_SEQ_ELEM(0, BOOST_PP_ARRAY_TO_SEQ(ARRAY)) == 0 END BEGIN BOOST_PP_SEQ_ELEM(3, BOOST_PP_ARRAY_TO_SEQ((5, (0, 1, 2, 3, 4)))) == 3 END BEGIN BOOST_PP_SEQ_ELEM(17, BOOST_PP_ARRAY_TO_SEQ(ARRAY_LARGE)) == 17 END BEGIN BOOST_PP_SEQ_ELEM(42, BOOST_PP_ARRAY_TO_SEQ((64, (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63)))) == 42 END -BEGIN BOOST_PP_IS_EMPTY(BOOST_PP_SEQ_ELEM(0,BOOST_PP_ARRAY_TO_SEQ(ARRAY_EMPTY))) == 1 END -BEGIN BOOST_PP_SEQ_SIZE(BOOST_PP_ARRAY_TO_SEQ(ARRAY_EMPTY)) == 1 END // to_tuple @@ -92,8 +90,6 @@ BEGIN BOOST_PP_TUPLE_ELEM(2, BOOST_PP_ARRAY_TO_TUPLE(ARRAY)) == 2 END BEGIN BOOST_PP_TUPLE_ELEM(1, BOOST_PP_ARRAY_TO_TUPLE((5, (0, 1, 2, 3, 4)))) == 1 END BEGIN BOOST_PP_TUPLE_ELEM(26, BOOST_PP_ARRAY_TO_TUPLE(ARRAY_LARGE)) == 26 END BEGIN BOOST_PP_TUPLE_ELEM(37, BOOST_PP_ARRAY_TO_TUPLE((64, (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63)))) == 37 END -BEGIN BOOST_PP_TUPLE_SIZE(BOOST_PP_ARRAY_TO_TUPLE(ARRAY_EMPTY)) == 1 END -BEGIN BOOST_PP_IS_EMPTY(BOOST_PP_TUPLE_ELEM(0, BOOST_PP_ARRAY_TO_TUPLE(ARRAY_EMPTY))) == 1 END # else @@ -101,7 +97,6 @@ BEGIN BOOST_PP_TUPLE_ELEM(3, 2, BOOST_PP_ARRAY_TO_TUPLE(ARRAY)) == 2 END BEGIN BOOST_PP_TUPLE_ELEM(5, 1, BOOST_PP_ARRAY_TO_TUPLE((5, (0, 1, 2, 3, 4)))) == 1 END BEGIN BOOST_PP_TUPLE_ELEM(33, 26, BOOST_PP_ARRAY_TO_TUPLE(ARRAY_LARGE)) == 26 END BEGIN BOOST_PP_TUPLE_ELEM(64, 37, BOOST_PP_ARRAY_TO_TUPLE((64, (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63)))) == 37 END -BEGIN BOOST_PP_IS_EMPTY(BOOST_PP_TUPLE_ELEM(1, 0, BOOST_PP_ARRAY_TO_TUPLE(ARRAY_EMPTY))) == 1 END # endif diff --git a/test/list.cxx b/test/list.cxx index 187787b..7c99d70 100644 --- a/test/list.cxx +++ b/test/list.cxx @@ -78,13 +78,6 @@ BEGIN BOOST_PP_LIST_FOR_EACH(F1, 1, LIST) == 16 END BEGIN BOOST_PP_LIST_FOR_EACH_I(FI2, 1, LIST) == 17 END BEGIN BOOST_PP_TUPLE_ELEM(4, 3, BOOST_PP_LIST_TO_TUPLE(LIST)) == 2 END -BEGIN BOOST_PP_IS_EMPTY(BOOST_PP_TUPLE_ELEM(1, 0, BOOST_PP_LIST_TO_TUPLE(LISTNIL))) == 1 END - -#if BOOST_PP_VARIADICS - -BEGIN BOOST_PP_TUPLE_SIZE(BOOST_PP_LIST_TO_TUPLE(LISTNIL)) == 1 END - -#endif BEGIN BOOST_PP_LIST_CAT(BOOST_PP_LIST_FILTER(BOOST_PP_LESS_D, 3, LIST)) == 45 END BEGIN BOOST_PP_LIST_IS_NIL(BOOST_PP_LIST_FILTER(BOOST_PP_LESS_D, 3, LISTNIL)) == 1 END @@ -96,4 +89,3 @@ BEGIN BOOST_PP_LIST_CAT(BOOST_PP_LIST_FOLD_LEFT(BOOST_PP_LIST_APPEND_D, BOOST_PP BEGIN BOOST_PP_ARRAY_ELEM(2, BOOST_PP_LIST_TO_ARRAY(LIST)) == 5 END BEGIN BOOST_PP_ARRAY_SIZE(BOOST_PP_LIST_TO_ARRAY(LISTNIL)) == 0 END BEGIN BOOST_PP_SEQ_ELEM(3, BOOST_PP_LIST_TO_SEQ(LIST)) == 2 END -BEGIN BOOST_PP_IS_EMPTY(BOOST_PP_LIST_TO_SEQ(LISTNIL)) == 1 END From 9d308c1b9d8d9018e1fd460b581155cd59acbdc2 Mon Sep 17 00:00:00 2001 From: Edward Diener Date: Fri, 23 May 2014 10:23:40 -0400 Subject: [PATCH 14/58] Changed BOOST_PP_EMPTY to only use the variadic version when not VC++. Corrected others to use local version of EMPTY. --- include/boost/preprocessor/array/to_seq.hpp | 4 ++-- include/boost/preprocessor/array/to_tuple.hpp | 4 ++-- include/boost/preprocessor/facilities/empty.hpp | 6 +++++- .../boost/preprocessor/facilities/is_empty_variadic.hpp | 7 ++++--- include/boost/preprocessor/list/to_tuple.hpp | 7 ++++--- 5 files changed, 17 insertions(+), 11 deletions(-) diff --git a/include/boost/preprocessor/array/to_seq.hpp b/include/boost/preprocessor/array/to_seq.hpp index 3534d9c..7303f34 100644 --- a/include/boost/preprocessor/array/to_seq.hpp +++ b/include/boost/preprocessor/array/to_seq.hpp @@ -17,7 +17,6 @@ # include # include # include -# include # include # # /* BOOST_PP_ARRAY_TO_SEQ */ @@ -27,10 +26,11 @@ ( \ BOOST_PP_ARRAY_SIZE(array), \ BOOST_PP_ARRAY_TO_SEQ_DO, \ - BOOST_PP_EMPTY \ + BOOST_PP_ARRAY_TO_SEQ_EMPTY \ ) \ (array) \ /**/ +# define BOOST_PP_ARRAY_TO_SEQ_EMPTY(array) # # if BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MSVC() # define BOOST_PP_ARRAY_TO_SEQ_DO(array) BOOST_PP_ARRAY_TO_SEQ_I(BOOST_PP_TUPLE_TO_SEQ, array) diff --git a/include/boost/preprocessor/array/to_tuple.hpp b/include/boost/preprocessor/array/to_tuple.hpp index b513e22..0d8defa 100644 --- a/include/boost/preprocessor/array/to_tuple.hpp +++ b/include/boost/preprocessor/array/to_tuple.hpp @@ -16,7 +16,6 @@ # include # include # include -# include # # /* BOOST_PP_ARRAY_TO_TUPLE */ # @@ -25,9 +24,10 @@ ( \ BOOST_PP_ARRAY_SIZE(array), \ BOOST_PP_ARRAY_DATA, \ - BOOST_PP_EMPTY \ + BOOST_PP_ARRAY_TO_TUPLE_EMPTY \ ) \ (array) \ /**/ +# define BOOST_PP_ARRAY_TO_TUPLE_EMPTY(array) # # endif diff --git a/include/boost/preprocessor/facilities/empty.hpp b/include/boost/preprocessor/facilities/empty.hpp index 99e1daa..0829a13 100644 --- a/include/boost/preprocessor/facilities/empty.hpp +++ b/include/boost/preprocessor/facilities/empty.hpp @@ -19,10 +19,14 @@ # # /* BOOST_PP_EMPTY */ # -# if BOOST_PP_VARIADICS +# if BOOST_PP_VARIADICS && !BOOST_PP_VARIADICS_MSVC # define BOOST_PP_EMPTY(...) # else # define BOOST_PP_EMPTY() # endif # +# if BOOST_PP_VARIADICS +# define BOOST_PP_VARIADIC_EMPTY(...) +# endif +# # endif diff --git a/include/boost/preprocessor/facilities/is_empty_variadic.hpp b/include/boost/preprocessor/facilities/is_empty_variadic.hpp index c2700fe..eee4062 100644 --- a/include/boost/preprocessor/facilities/is_empty_variadic.hpp +++ b/include/boost/preprocessor/facilities/is_empty_variadic.hpp @@ -16,7 +16,6 @@ # # if BOOST_PP_VARIADICS # -# include # include # include # @@ -31,11 +30,12 @@ ) \ ) \ ( \ - 0 BOOST_PP_EMPTY, \ + BOOST_PP_IS_EMPTY_ZERO, \ BOOST_PP_DETAIL_IS_EMPTY_PROCESS \ ) \ (param) \ /**/ +#define BOOST_PP_IS_EMPTY_ZERO(param) 0 # else #define BOOST_PP_IS_EMPTY(...) \ BOOST_PP_DETAIL_IS_EMPTY_IIF \ @@ -46,11 +46,12 @@ ) \ ) \ ( \ - 0 BOOST_PP_EMPTY, \ + BOOST_PP_IS_EMPTY_ZERO, \ BOOST_PP_DETAIL_IS_EMPTY_PROCESS \ ) \ (__VA_ARGS__) \ /**/ +#define BOOST_PP_IS_EMPTY_ZERO(...) 0 # endif /* BOOST_PP_VARIADICS_MSVC && _MSC_VER <= 1400 */ # endif /* BOOST_PP_VARIADICS */ # endif /* BOOST_PREPROCESSOR_FACILITIES_IS_EMPTY_VARIADIC_HPP */ diff --git a/include/boost/preprocessor/list/to_tuple.hpp b/include/boost/preprocessor/list/to_tuple.hpp index d693b91..c7b3da8 100644 --- a/include/boost/preprocessor/list/to_tuple.hpp +++ b/include/boost/preprocessor/list/to_tuple.hpp @@ -17,7 +17,6 @@ # include # include # include -# include # # /* BOOST_PP_LIST_TO_TUPLE */ # @@ -25,11 +24,12 @@ BOOST_PP_IIF \ ( \ BOOST_PP_LIST_IS_NIL(list), \ - BOOST_PP_EMPTY, \ + BOOST_PP_LIST_TO_TUPLE_EMPTY, \ BOOST_PP_LIST_TO_TUPLE_DO \ ) \ (list) \ /**/ +# define BOOST_PP_LIST_TO_TUPLE_EMPTY(list) # # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG() # define BOOST_PP_LIST_TO_TUPLE_DO(list) (BOOST_PP_LIST_ENUM(list)) @@ -44,11 +44,12 @@ BOOST_PP_IIF \ ( \ BOOST_PP_LIST_IS_NIL(list), \ - BOOST_PP_EMPTY, \ + BOOST_PP_LIST_TO_TUPLE_R_EMPTY, \ BOOST_PP_LIST_TO_TUPLE_R_DO \ ) \ (r, list) \ /**/ +# define BOOST_PP_LIST_TO_TUPLE_R_EMPTY(r,list) # # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG() # define BOOST_PP_LIST_TO_TUPLE_R_DO(r, list) (BOOST_PP_LIST_ENUM_R(r, list)) From b03d46129c3bcaa898780d9938625c79d009f4e2 Mon Sep 17 00:00:00 2001 From: Edward Diener Date: Sun, 25 May 2014 07:53:44 -0400 Subject: [PATCH 15/58] Change back to original implementation. --- include/boost/preprocessor/facilities/empty.hpp | 9 --------- 1 file changed, 9 deletions(-) diff --git a/include/boost/preprocessor/facilities/empty.hpp b/include/boost/preprocessor/facilities/empty.hpp index 0829a13..6f215dc 100644 --- a/include/boost/preprocessor/facilities/empty.hpp +++ b/include/boost/preprocessor/facilities/empty.hpp @@ -8,7 +8,6 @@ # */ # # /* Revised by Paul Mensonides (2002) */ -# /* Revised by Edward Diener (2014) */ # # /* See http://www.boost.org for most recent version. */ # @@ -19,14 +18,6 @@ # # /* BOOST_PP_EMPTY */ # -# if BOOST_PP_VARIADICS && !BOOST_PP_VARIADICS_MSVC -# define BOOST_PP_EMPTY(...) -# else # define BOOST_PP_EMPTY() -# endif -# -# if BOOST_PP_VARIADICS -# define BOOST_PP_VARIADIC_EMPTY(...) -# endif # # endif From 70e0f2d6e0e3577c5783cda08f84f6f8319ca070 Mon Sep 17 00:00:00 2001 From: Edward Diener Date: Mon, 26 May 2014 16:36:30 -0400 Subject: [PATCH 16/58] Using BOOST_PP_IDENTITY makes code clearer. --- include/boost/preprocessor/facilities/is_empty.hpp | 4 ++-- include/boost/preprocessor/facilities/is_empty_or_1.hpp | 3 ++- include/boost/preprocessor/seq/rest_n.hpp | 6 +++--- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/include/boost/preprocessor/facilities/is_empty.hpp b/include/boost/preprocessor/facilities/is_empty.hpp index e7f821f..d0403a9 100644 --- a/include/boost/preprocessor/facilities/is_empty.hpp +++ b/include/boost/preprocessor/facilities/is_empty.hpp @@ -24,7 +24,7 @@ # include # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MSVC() && ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MWCC() # include -# include +# include # else # include # include @@ -35,7 +35,7 @@ # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MSVC() && ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MWCC() # define BOOST_PP_IS_EMPTY(x) BOOST_PP_IS_EMPTY_I(x BOOST_PP_IS_EMPTY_HELPER) # define BOOST_PP_IS_EMPTY_I(contents) BOOST_PP_TUPLE_ELEM(2, 1, (BOOST_PP_IS_EMPTY_DEF_ ## contents())) -# define BOOST_PP_IS_EMPTY_DEF_BOOST_PP_IS_EMPTY_HELPER 1, 1 BOOST_PP_EMPTY +# define BOOST_PP_IS_EMPTY_DEF_BOOST_PP_IS_EMPTY_HELPER 1, BOOST_PP_IDENTITY(1) # define BOOST_PP_IS_EMPTY_HELPER() , 0 # else # if BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MSVC() diff --git a/include/boost/preprocessor/facilities/is_empty_or_1.hpp b/include/boost/preprocessor/facilities/is_empty_or_1.hpp index baa5da9..815666f 100644 --- a/include/boost/preprocessor/facilities/is_empty_or_1.hpp +++ b/include/boost/preprocessor/facilities/is_empty_or_1.hpp @@ -14,6 +14,7 @@ # # include # include +# include # include # include # @@ -22,7 +23,7 @@ # define BOOST_PP_IS_EMPTY_OR_1(x) \ BOOST_PP_IIF( \ BOOST_PP_IS_EMPTY(x BOOST_PP_EMPTY()), \ - 1 BOOST_PP_EMPTY, \ + BOOST_PP_IDENTITY(1), \ BOOST_PP_IS_1 \ )(x) \ /**/ diff --git a/include/boost/preprocessor/seq/rest_n.hpp b/include/boost/preprocessor/seq/rest_n.hpp index 7e589cc..6423376 100644 --- a/include/boost/preprocessor/seq/rest_n.hpp +++ b/include/boost/preprocessor/seq/rest_n.hpp @@ -14,17 +14,17 @@ # # include # include -# include +# include # include # include # # /* 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), (nil) seq BOOST_PP_EMPTY))() +# 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 )))() # 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), (nil) seq BOOST_PP_EMPTY))() +# 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 )))() # endif # # endif From 7da3c88d82b74bf96d6204001f6725725896a9d5 Mon Sep 17 00:00:00 2001 From: 6recetru <6recetru@gmail.com> Date: Mon, 26 May 2014 16:55:07 -0700 Subject: [PATCH 17/58] #8454. Fixed minor typo in documentation. --- doc/ref/seq_replace.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/ref/seq_replace.html b/doc/ref/seq_replace.html index c757113..9a64e5d 100644 --- a/doc/ref/seq_replace.html +++ b/doc/ref/seq_replace.html @@ -11,7 +11,7 @@ Usage
- BOOST_PP_SEQ_RPLACE(seq, i, elem) + BOOST_PP_SEQ_REPLACE(seq, i, elem)

Arguments From e57370608eec0a6da06c30ef3dfbd2b5bf10152c Mon Sep 17 00:00:00 2001 From: Edward Diener Date: Wed, 4 Jun 2014 06:50:33 -0400 Subject: [PATCH 18/58] Updated doc for empty array and/or list when converted to other data type. --- doc/ref/array_to_list.html | 70 +++++++++++++----------- doc/ref/array_to_seq.html | 64 ++++++++++++---------- doc/ref/array_to_tuple.html | 66 ++++++++++++---------- doc/ref/list_to_array.html | 82 +++++++++++++++------------- doc/ref/list_to_array_d.html | 57 ++++++++++--------- doc/ref/list_to_seq.html | 80 ++++++++++++++------------- doc/ref/list_to_seq_r.html | 55 ++++++++++--------- doc/ref/list_to_tuple.html | 103 ++++++++++++++++------------------- doc/ref/list_to_tuple_r.html | 103 ++++++++++++++++------------------- 9 files changed, 356 insertions(+), 324 deletions(-) diff --git a/doc/ref/array_to_list.html b/doc/ref/array_to_list.html index 607b205..8ea7133 100644 --- a/doc/ref/array_to_list.html +++ b/doc/ref/array_to_list.html @@ -1,33 +1,41 @@ - - BOOST_PP_ARRAY_TO_LIST - - - -
The BOOST_PP_ARRAY_TO_LIST -macro converts an array to a list.
-

Usage

-
BOOST_PP_ARRAY_TO_LIST(array) -
-

Arguments

-
array
-
The array to be converted.
-
-
    -
-

Requirements

- -

Sample Code

-
-
#include <boost/preprocessor/array/to_list.hpp>

BOOST_PP_ARRAY_TO_LIST((3, (x, y, z)))
// expands to (x, (y, (z, BOOST_PP_NIL)))
-
-
-
© Copyright Edward Diener 2011
-
-

Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt -or copy at www.boost.org/LICENSE_1_0.txt)

-
- + + + BOOST_PP_ARRAY_TO_LIST + + + +
The BOOST_PP_ARRAY_TO_LIST macro + converts an array to a list.
+

Usage

+
BOOST_PP_ARRAY_TO_LIST(array)
+

Arguments

+
+
array
+
The array to be converted.
+
+
    +
+

Remarks

+

    If the array to be converted is empty, as + represented by '( 0, () )', the resulting list is empty, as + represented by 'BOOST_PP_NIL'.

+

Requirements

+ +

Sample Code

+
+
#include <boost/preprocessor/array/to_list.hpp>

BOOST_PP_ARRAY_TO_LIST((3, (x, y, z)))
// expands to (x, (y, (z, BOOST_PP_NIL)))
+
+
+
© Copyright Edward Diener 2011
+
+

Distributed under the Boost Software License, Version 1.0. (See + accompanying file LICENSE_1_0.txt + or copy at www.boost.org/LICENSE_1_0.txt)

+
+ s + diff --git a/doc/ref/array_to_seq.html b/doc/ref/array_to_seq.html index 308b364..7140176 100644 --- a/doc/ref/array_to_seq.html +++ b/doc/ref/array_to_seq.html @@ -1,31 +1,37 @@ - - BOOST_PP_ARRAY_TO_SEQ - - - -
The BOOST_PP_ARRAY_TO_SEQ macro -converts an array to a seq.
-

Usage

-
BOOST_PP_ARRAY_TO_SEQ(array) -
-

Arguments

-
array
-
The array to be converted.
-
-

Requirements

- -

Sample Code

-
-
#include <boost/preprocessor/array/to_seq.hpp>

BOOST_PP_ARRAY_TO_SEQ((3, (a, b, c))) // expands to (a)(b)(c)
-
-
-
© Copyright Edward Diener 2011
-
-

Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt -or copy at www.boost.org/LICENSE_1_0.txt)

-
- + + + BOOST_PP_ARRAY_TO_SEQ + + + +
The BOOST_PP_ARRAY_TO_SEQ macro + converts an array to a seq.
+

Usage

+
BOOST_PP_ARRAY_TO_SEQ(array)
+

Arguments

+
+
array
+
The array to be converted.
+
+

Remarks

+

    If the array to be converted is empty, as + represented by '( 0, () )', the resulting seq is undefined since a + seq cannot be empty.

+

Requirements

+ +

Sample Code

+
+
#include <boost/preprocessor/array/to_seq.hpp>

BOOST_PP_ARRAY_TO_SEQ((3, (a, b, c))) // expands to (a)(b)(c)
+
+
+
© Copyright Edward Diener 2011
+
+

Distributed under the Boost Software License, Version 1.0. (See + accompanying file LICENSE_1_0.txt + or copy at www.boost.org/LICENSE_1_0.txt)

+
+ diff --git a/doc/ref/array_to_tuple.html b/doc/ref/array_to_tuple.html index 085dd39..8f9c958 100644 --- a/doc/ref/array_to_tuple.html +++ b/doc/ref/array_to_tuple.html @@ -1,31 +1,39 @@ - - BOOST_PP_ARRAY_TO_TUPLE - - - -
The BOOST_PP_ARRAY_TO_TUPLE macro -converts an array to an tuple.
-

Usage

-
BOOST_PP_ARRAY_TO_TUPLE(array)
-

Arguments

-
-
array
-
The array to be converted.
-
-

Requirements

- -

Sample Code

-
-
#include <boost/preprocessor/array/to_tuple.hpp>

#define ARRAY (3,(a, b, c))

BOOST_PP_ARRAY_TO_TUPLE(ARRAY) // expands to (a, b, c)
-
-
-
© Copyright Edward Diener 2011
-
-

Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt -or copy at www.boost.org/LICENSE_1_0.txt)

-
- + + + BOOST_PP_ARRAY_TO_TUPLE + + + +
The BOOST_PP_ARRAY_TO_TUPLE macro + converts an array to an tuple.
+

Usage

+
BOOST_PP_ARRAY_TO_TUPLE(array)
+

Arguments

+
+
array
+
The array to be converted.
+
+

Remarks

+

    If the array to be converted is empty, as + represented by '( 0, () )', the resulting tuple is undefined + since a tuple cannot be empty.

+

Requirements

+ +

Sample Code

+
+
#include <boost/preprocessor/array/to_tuple.hpp>

#define ARRAY (3,(a, b, c))

BOOST_PP_ARRAY_TO_TUPLE(ARRAY) // expands to (a, b, c)
+
+
+
© Copyright Edward Diener 2011 +
+
+

Distributed under the Boost Software License, Version 1.0. (See + accompanying file LICENSE_1_0.txt + or copy at www.boost.org/LICENSE_1_0.txt)

+
+ diff --git a/doc/ref/list_to_array.html b/doc/ref/list_to_array.html index b691b34..46154c9 100644 --- a/doc/ref/list_to_array.html +++ b/doc/ref/list_to_array.html @@ -1,39 +1,47 @@ - - BOOST_PP_LIST_TO_ARRAY - - -
The BOOST_PP_LIST_TO_ARRAY macro -converts a list to an array.
-

Usage

-
BOOST_PP_LIST_TO_ARRAY(list)
-

Arguments

-
-
list
-
The list to be converted.
-
-

Remarks

-
- This macro uses BOOST_PP_WHILE. - Within BOOST_PP_WHILE, it is more efficient to use BOOST_PP_LIST_TO_ARRAY_D. -
-

See Also

- -

Requirements

- -

Sample Code

-
-
#include <boost/preprocessor/list/to_array.hpp>

#define LIST (a, (b, (c, BOOST_PP_NIL)))

BOOST_PP_LIST_TO_ARRAY(LIST) // expands to (3, (a, b, c))
-
-
-
© Copyright Edward Diener 2011
-
-

Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt -or copy at www.boost.org/LICENSE_1_0.txt)

-
- + + + BOOST_PP_LIST_TO_ARRAY + + + +
The BOOST_PP_LIST_TO_ARRAY macro + converts a list to an array.
+

Usage

+
BOOST_PP_LIST_TO_ARRAY(list)
+

Arguments

+
+
list
+
The list to be converted.
+
+
+

Remarks

+
This macro uses BOOST_PP_WHILE. Within BOOST_PP_WHILE, + it is more efficient to use BOOST_PP_LIST_TO_ARRAY_D.
+
+ If the list to be converted is empty, as represented by + 'BOOST_PP_NIL', the resulting array is empty, as represented by '( 0, () + )'.
+

See Also

+ +

Requirements

+ +

Sample Code

+
+
#include <boost/preprocessor/list/to_array.hpp>

#define LIST (a, (b, (c, BOOST_PP_NIL)))

BOOST_PP_LIST_TO_ARRAY(LIST) // expands to (3, (a, b, c))
+
+
+
© Copyright Edward Diener 2011 +
+
+

Distributed under the Boost Software License, Version 1.0. (See + accompanying file LICENSE_1_0.txt + or copy at www.boost.org/LICENSE_1_0.txt)

+
+ diff --git a/doc/ref/list_to_array_d.html b/doc/ref/list_to_array_d.html index 8d93328..835d9e2 100644 --- a/doc/ref/list_to_array_d.html +++ b/doc/ref/list_to_array_d.html @@ -1,27 +1,34 @@ - - BOOST_PP_LIST_TO_ARRAY_D - - -
-The BOOST_PP_LIST_TO_ARRAY_D macro converts a list to an array. -It reenters BOOST_PP_WHILE with maximum efficiency. -
-

Usage

-
BOOST_PP_LIST_TO_ARRAY_D(d, list)
-

Arguments

-
-
d
-
The next available BOOST_PP_WHILE iteration.
-
list
-
The list to be converted.
-
-

See Also

- -

Requirements

- - + + + BOOST_PP_LIST_TO_ARRAY_D + + + +
The BOOST_PP_LIST_TO_ARRAY_D macro + converts a list to an array. It reenters BOOST_PP_WHILE + with maximum efficiency.
+

Usage

+
BOOST_PP_LIST_TO_ARRAY_D(d, list) +
+

Arguments

+
+
d
+
The next available BOOST_PP_WHILE iteration.
+
list
+
The list to be converted.
+
+

Remarks

+

    If the list to be converted is empty, as + represented by 'BOOST_PP_NIL', the resulting array is empty, as + represented by '( 0, () )'.

+

See Also

+

See Also

+ +

Requirements

+ + diff --git a/doc/ref/list_to_seq.html b/doc/ref/list_to_seq.html index 2f77cf1..b023546 100644 --- a/doc/ref/list_to_seq.html +++ b/doc/ref/list_to_seq.html @@ -1,40 +1,44 @@ - - BOOST_PP_LIST_TO_SEQ - - - -
The BOOST_PP_LIST_TO_SEQ macro -converts a list to a seq.
-

Usage

-
BOOST_PP_LIST_TO_SEQ(list) -
-

Arguments

-
list
-
The list to be converted.
-
-

Remarks

-
- This macro uses BOOST_PP_FOR. - Within BOOST_PP_FOR, it is more efficient to use BOOST_PP_LIST_TO_SEQ_R. -
-

See Also

- -

Requirements

- -

Sample Code

-
-
#include <boost/preprocessor/list/to_seq.hpp>

BOOST_PP_LIST_TO_SEQ((a, (b, (c, BOOST_PP_NIL)))) // expands to (a)(b)(c)
-
-
-
© Copyright Edward Diener 2011
-
-

Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt -or copy at www.boost.org/LICENSE_1_0.txt)

-
- + + + BOOST_PP_LIST_TO_SEQ + + + +
The BOOST_PP_LIST_TO_SEQ macro + converts a list to a seq.
+

Usage

+
BOOST_PP_LIST_TO_SEQ(list)
+

Arguments

+
+
list
+
The list to be converted.
+
+

Remarks

+
This macro uses BOOST_PP_FOR. Within BOOST_PP_FOR, it + is more efficient to use BOOST_PP_LIST_TO_SEQ_R.
+
+ If the list to be converted is empty, as represented by + 'BOOST_PP_NIL', the resulting seq is undefined since a seq + cannot be empty.
+

See Also

+ +

Requirements

+ +

Sample Code

+
+
#include <boost/preprocessor/list/to_seq.hpp>

BOOST_PP_LIST_TO_SEQ((a, (b, (c, BOOST_PP_NIL)))) // expands to (a)(b)(c)
+
+
+
© Copyright Edward Diener 2011
+
+

Distributed under the Boost Software License, Version 1.0. (See + accompanying file LICENSE_1_0.txt + or copy at www.boost.org/LICENSE_1_0.txt)

+
+ diff --git a/doc/ref/list_to_seq_r.html b/doc/ref/list_to_seq_r.html index 2c2bb37..cc7a854 100644 --- a/doc/ref/list_to_seq_r.html +++ b/doc/ref/list_to_seq_r.html @@ -1,27 +1,32 @@ - - BOOST_PP_LIST_TO_SEQ_R - - -
-The BOOST_PP_LIST_TO_SEQ_R macro converts a list to an seq. -It reenters BOOST_PP_FOR with maximum efficiency. -
-

Usage

-
BOOST_PP_LIST_TO_SEQ_R(r, list)
-

Arguments

-
-
d
-
The next available BOOST_PP_FOR repetition.
-
list
-
The list to be converted.
-
-

See Also

- -

Requirements

- - + + + BOOST_PP_LIST_TO_SEQ_R + + + +
The BOOST_PP_LIST_TO_SEQ_R macro + converts a list to a seq. It reenters BOOST_PP_FOR + with maximum efficiency.
+

Usage

+
BOOST_PP_LIST_TO_SEQ_R(r, list)
+

Arguments

+
+
d
+
The next available BOOST_PP_FOR repetition.
+
list
+
The list to be converted.
+
+

Remarks

+

    If the list to be converted is empty, as + represented by 'BOOST_PP_NIL', the resulting seq is undefined + since a seq cannot be empty.

+

See Also

+ +

Requirements

+ + diff --git a/doc/ref/list_to_tuple.html b/doc/ref/list_to_tuple.html index 37e7311..d022c2b 100644 --- a/doc/ref/list_to_tuple.html +++ b/doc/ref/list_to_tuple.html @@ -1,62 +1,55 @@ - - BOOST_PP_LIST_TO_TUPLE - - - -
- The BOOST_PP_LIST_TO_TUPLE macro converts a list to a tuple. -
-

Usage

-
- BOOST_PP_LIST_TO_TUPLE(list) -
-

Arguments

-
-
list
-
- The list to be converted. -
-
-

Remarks

-
- If list is, for example, (a, (b, (c, BOOST_PP_NIL))), - this macro will produce: -
- (a, b, c) -
-
-
- Previously, this macro could not be used inside BOOST_PP_FOR.  - There is no longer any such restriction.  - It is more efficient, however, to use BOOST_PP_LIST_TO_TUPLE_R in such a situation. -
-

See Also

- -

Requirements

- -

Sample Code

-
-#include <boost/preprocessor/list/to_tuple.hpp>
+  
+    
+    BOOST_PP_LIST_TO_TUPLE
+    
+  
+  
+    
The BOOST_PP_LIST_TO_TUPLE macro + converts a list to a tuple.
+

Usage

+
BOOST_PP_LIST_TO_TUPLE(list)
+

Arguments

+
+
list
+
The list to be converted.
+
+

Remarks

+
If list is, for example, (a, (b, (c, BOOST_PP_NIL))), + this macro will produce: +
(a, b, c)
+
+
Previously, this macro could not be used inside BOOST_PP_FOR.  + There is no longer any such restriction.  It is more efficient, + however, to use BOOST_PP_LIST_TO_TUPLE_R in such a situation.
+
+ If the list to be converted is empty, as represented by 'BOOST_PP_NIL', + the resulting tuple is undefined since a tuple cannot be + empty.
+

See Also

+ +

Requirements

+ +

Sample Code

+
+
#include <boost/preprocessor/list/to_tuple.hpp>
 
 #define LIST (w, (x, (y, (z, BOOST_PP_NIL))))
 
 BOOST_PP_LIST_TO_TUPLE(LIST) // expands to (w, x, y, z)
 
-
-
- © Copyright Housemarque Oy 2002 -
© Copyright Paul Mensonides 2002 -
-
-

Distributed under the Boost Software License, Version 1.0. (See - accompanying file LICENSE_1_0.txt or - copy at www.boost.org/LICENSE_1_0.txt)

-
- +
+
© Copyright Housemarque Oy 2002
+ © Copyright Paul Mensonides 2002
+
+

Distributed under the Boost Software License, Version 1.0. (See + accompanying file LICENSE_1_0.txt + or copy at www.boost.org/LICENSE_1_0.txt)

+
+ diff --git a/doc/ref/list_to_tuple_r.html b/doc/ref/list_to_tuple_r.html index 1ba51a0..a72c4de 100644 --- a/doc/ref/list_to_tuple_r.html +++ b/doc/ref/list_to_tuple_r.html @@ -1,47 +1,42 @@ - - BOOST_PP_LIST_TO_TUPLE_R - - - -
- The BOOST_PP_LIST_TO_TUPLE_R macro converts a list to a tuple.  - It reenters BOOST_PP_FOR with maximum efficiency. -
-

Usage

-
- BOOST_PP_LIST_TO_TUPLE_R(r, list) -
-

Arguments

-
-
r
-
- The next available BOOST_PP_FOR repetition. -
-
list
-
- The list to be converted. -
-
-

Remarks

-
- If list is, for example, (a, (b, (c, BOOST_PP_NIL))), - this macro will produce: -
- (a, b, c) -
-
-

See Also

- -

Requirements

- -

Sample Code

-
-#include <boost/preprocessor/list/adt.hpp>
+  
+    
+    BOOST_PP_LIST_TO_TUPLE_R
+    
+  
+  
+    
The BOOST_PP_LIST_TO_TUPLE_R macro + converts a list to a tuple.  It reenters BOOST_PP_FOR + with maximum efficiency.
+

Usage

+
BOOST_PP_LIST_TO_TUPLE_R(r, list) +
+

Arguments

+
+
r
+
The next available BOOST_PP_FOR repetition.
+
list
+
The list to be converted.
+
+

Remarks

+

   If list is, for example, (a, (b, (c, + BOOST_PP_NIL))), this macro will produce:

+
+
(a, b, c)  
+
+

   If the list to + be converted is empty, as represented by 'BOOST_PP_NIL', the resulting tuple + is undefined since a tuple cannot be empty.

+

See Also

+ +

Requirements

+ +

Sample Code

+
+
#include <boost/preprocessor/list/adt.hpp>
 #include <boost/preprocessor/list/to_tuple.hpp>
 #include <boost/preprocessor/repetition/for.hpp>
 
@@ -54,16 +49,14 @@
 BOOST_PP_FOR(LIST, PRED, OP, MACRO)
    // expands to (x, y, z) (y, z) (z)
 
-
-
- © Copyright Housemarque Oy 2002 -
© Copyright Paul Mensonides 2002 -
-
-

Distributed under the Boost Software License, Version 1.0. (See - accompanying file LICENSE_1_0.txt or - copy at www.boost.org/LICENSE_1_0.txt)

-
- +
+
© Copyright Housemarque Oy 2002
+ © Copyright Paul Mensonides 2002
+
+

Distributed under the Boost Software License, Version 1.0. (See + accompanying file LICENSE_1_0.txt + or copy at www.boost.org/LICENSE_1_0.txt)

+
+ From b43a4708eb48375115fcf04d21c092cd4710265d Mon Sep 17 00:00:00 2001 From: Edward Diener Date: Wed, 4 Jun 2014 19:38:09 -0400 Subject: [PATCH 19/58] Correct line endings. --- doc/ref/array_to_list.html | 4 ++-- doc/ref/array_to_seq.html | 2 +- doc/ref/list_to_seq.html | 2 +- doc/ref/list_to_tuple_r.html | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/doc/ref/array_to_list.html b/doc/ref/array_to_list.html index 8ea7133..2fdd247 100644 --- a/doc/ref/array_to_list.html +++ b/doc/ref/array_to_list.html @@ -25,8 +25,8 @@

Sample Code

-
#include <boost/preprocessor/array/to_list.hpp>

BOOST_PP_ARRAY_TO_LIST((3, (x, y, z)))
// expands to (x, (y, (z, #include <boost/preprocessor/array/to_list.hpp>

BOOST_PP_ARRAY_TO_LIST((3, (x, y, z)))
// expands to (x, (y, (z, BOOST_PP_NIL)))

diff --git a/doc/ref/array_to_seq.html b/doc/ref/array_to_seq.html index 7140176..bf3518e 100644 --- a/doc/ref/array_to_seq.html +++ b/doc/ref/array_to_seq.html @@ -23,7 +23,7 @@

Sample Code


diff --git a/doc/ref/list_to_seq.html b/doc/ref/list_to_seq.html index b023546..3efc7e1 100644 --- a/doc/ref/list_to_seq.html +++ b/doc/ref/list_to_seq.html @@ -30,7 +30,7 @@

Sample Code


diff --git a/doc/ref/list_to_tuple_r.html b/doc/ref/list_to_tuple_r.html index a72c4de..0227d38 100644 --- a/doc/ref/list_to_tuple_r.html +++ b/doc/ref/list_to_tuple_r.html @@ -50,7 +50,7 @@ // expands to (x, y, z) (y, z) (z)
-
© Copyright © Copyright Housemarque Oy 2002
© Copyright Paul Mensonides 2002
From 3f75659921c3a4bb635c986d2882fa0da324446a Mon Sep 17 00:00:00 2001 From: Edward Diener Date: Sun, 8 Jun 2014 02:00:24 -0400 Subject: [PATCH 20/58] Added documentation for is_begin_parens and remove_parens. --- doc/headers.html | 2 + doc/headers/punctuation/is_begin_parens.html | 26 +++++++++++ doc/headers/punctuation/remove_parens.html | 26 +++++++++++ doc/ref.html | 2 + doc/ref/is_begin_parens.html | 47 ++++++++++++++++++++ doc/ref/remove_parens.html | 44 ++++++++++++++++++ 6 files changed, 147 insertions(+) create mode 100644 doc/headers/punctuation/is_begin_parens.html create mode 100644 doc/headers/punctuation/remove_parens.html create mode 100644 doc/ref/is_begin_parens.html create mode 100644 doc/ref/remove_parens.html diff --git a/doc/headers.html b/doc/headers.html index 90b59fd..e96b25e 100644 --- a/doc/headers.html +++ b/doc/headers.html @@ -138,8 +138,10 @@
  • punctuation/
  • comma.hpp
  • comma_if.hpp
  • +
  • is_begin_parens.hpp (v)
  • paren.hpp
  • paren_if.hpp
  • +
  • remove_parens.hpp (v)
  • repeat.hpp*
  • repeat_2nd.hpp*
  • repeat_3rd.hpp*
  • diff --git a/doc/headers/punctuation/is_begin_parens.html b/doc/headers/punctuation/is_begin_parens.html new file mode 100644 index 0000000..4897623 --- /dev/null +++ b/doc/headers/punctuation/is_begin_parens.html @@ -0,0 +1,26 @@ + + + + punctuation/is_begin_parens.hpp + + + +
    The punctuation/is_begin_parens.hpp + header defines a macro that determines if variadic data begins with a + parenthesis.
    +

    Usage

    +
    #include <boost/preprocessor/punctuation/is_begin_parens.hpp> +
    +

    Contents

    + +
    +
    © Copyright Edward Diener 2014
    +
    +

    Distributed under the Boost Software License, Version 1.0. (See + accompanying file LICENSE_1_0.txt + or copy at www.boost.org/LICENSE_1_0.txt)

    +
    + + diff --git a/doc/headers/punctuation/remove_parens.html b/doc/headers/punctuation/remove_parens.html new file mode 100644 index 0000000..f2b6e46 --- /dev/null +++ b/doc/headers/punctuation/remove_parens.html @@ -0,0 +1,26 @@ + + + + punctuation/remove_parens.hpp + + + +
    The punctuation/remove_parens.hpp + header defines a macro that removes the beginning parenthesis from its + input if it exists.
    +

    Usage

    +
    #include <boost/preprocessor/punctuation/remove_parens.hpp> +
    +

    Contents

    + +
    +
    © Copyright Edward Diener 2014
    +
    +

    Distributed under the Boost Software License, Version 1.0. (See + accompanying file LICENSE_1_0.txt + or copy at www.boost.org/LICENSE_1_0.txt)

    +
    + + diff --git a/doc/ref.html b/doc/ref.html index 82c2905..4d2081f 100644 --- a/doc/ref.html +++ b/doc/ref.html @@ -105,6 +105,7 @@
  • INCLUDE_SELF
  • INDIRECT_SELF
  • INTERCEPT
  • +
  • IS_BEGIN_PARENS (v)
  • IS_ITERATING
  • IS_SELFISH
  • ITERATE
  • @@ -209,6 +210,7 @@
  • RELATIVE_FLAGS
  • RELATIVE_ITERATION
  • RELATIVE_START
  • +
  • REMOVE_PARENS (v)
  • REPEAT
  • REPEAT_1ST*
  • REPEAT_2ND*
  • diff --git a/doc/ref/is_begin_parens.html b/doc/ref/is_begin_parens.html new file mode 100644 index 0000000..0e0b39c --- /dev/null +++ b/doc/ref/is_begin_parens.html @@ -0,0 +1,47 @@ + + + + BOOST_PP_IS_BEGIN_PARENS + + + +
    The BOOST_PP_IS_BEGIN_PARENS + determines whether the input starts with a set of parenthesis.
    +

    Usage

    +
    BOOST_PP_IS_BEGIN_PARENS(...) (v)
    +

    Arguments

    +

        ...        +     The input as variadic data.

    +

    Remarks

    +
    If the input input begins with a parenthesis, with any data within + that parenthesis, the macro returns 1, otherwise it returns 0. Data may + follow the beginning parenthesis and the macro still will return 1.
    +
    + For Visual Studio 2005 ( VC8 ) the input data must be a single parameter + else a compilation error will occur.
    +

    See Also

    + +

    Requirements

    + +

    Sample Code

    +
    +
    #include <boost/preprocessor/punctuation/is_begin_parens.hpp>
    +
    +#define VARDATA more_data , more_params
    #define VARDATAP ( data ) more_data , more_params
    #define DATA data
    #define DATAP ( data ) more_data
    +BOOST_PP_IS_BEGIN_PARENS(VARDATA) // expands to 0, compiler error with VC8 +BOOST_PP_IS_BEGIN_PARENS(VARDATAP) // expands to 1, compiler error with VC8

    BOOST_PP_IS_BEGIN_PARENS(DATA) // expands to 0 +BOOST_PP_IS_BEGIN_PARENS(DATAP) // expands to 1

    BOOST_PP_IS_BEGIN_PARENS() // expands to 0
    +
    +
    +
    © Copyright Edward Diener 2014
    +
    +

    Distributed under the Boost Software License, Version 1.0. (See + accompanying file LICENSE_1_0.txt + or copy at www.boost.org/LICENSE_1_0.txt)

    +
    + + diff --git a/doc/ref/remove_parens.html b/doc/ref/remove_parens.html new file mode 100644 index 0000000..72312dd --- /dev/null +++ b/doc/ref/remove_parens.html @@ -0,0 +1,44 @@ + + + + BOOST_PP_REMOVE_PARENS + + + +
    The BOOST_PP_REMOVE_PARENS macro + removes the beginning parenthesis, if it exists, from the input data and + expands to the result
    +

    Usage

    +
    BOOST_PP_REMOVE_PARENS(param) (v)
    +

    Arguments    

    +

        param   +         + The input data.

    +

    Remarks

    +
    If the input begins with a parenthesis, with any data within that + parenthesis, the macro removes the parenthesis and expands to the result. + If the input does not begin with a parenthesis the macro expands to the + input.
    +
    +

    See Also

    + +

    Requirements

    + +

    Sample Code

    +
    +
    #include <boost/preprocessor/punctuation/remove_parens.hpp>

    #define DATA data
    #define DATAP ( data ) more_data

    BOOST_PP_REMOVE_PARENS(DATA) // expands to 'data' +BOOST_PP_REMOVE_PARENS(DATAP) // expands to 'data more_data'
    +
    +
    +
    © Copyright Edward Diener 2014
    +
    +

    Distributed under the Boost Software License, Version 1.0. (See + accompanying file LICENSE_1_0.txt + or copy at www.boost.org/LICENSE_1_0.txt)

    +
    + + From 9d2d1fffdfd4f8ed322d7ee293633d29807c5507 Mon Sep 17 00:00:00 2001 From: Edward Diener Date: Mon, 16 Jun 2014 07:01:15 -0400 Subject: [PATCH 21/58] Revert use of variadic is_empty. --- include/boost/preprocessor/facilities/is_empty.hpp | 9 --------- 1 file changed, 9 deletions(-) diff --git a/include/boost/preprocessor/facilities/is_empty.hpp b/include/boost/preprocessor/facilities/is_empty.hpp index d0403a9..1e0fbb2 100644 --- a/include/boost/preprocessor/facilities/is_empty.hpp +++ b/include/boost/preprocessor/facilities/is_empty.hpp @@ -15,13 +15,6 @@ # # include # -# if BOOST_PP_VARIADICS -# -# include -# -# else -# -# include # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MSVC() && ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MWCC() # include # include @@ -52,6 +45,4 @@ # define BOOST_PP_IS_EMPTY_DEF_BOOST_PP_IS_EMPTY_HELPER 0, BOOST_PP_NIL # endif # -# endif /* BOOST_PP_VARIADICS */ -# # endif /* BOOST_PREPROCESSOR_FACILITIES_IS_EMPTY_HPP */ From 6b0be3fe4fb7c9c3a5e1f394a6e573dfbf598d3b Mon Sep 17 00:00:00 2001 From: Edward Diener Date: Mon, 16 Jun 2014 23:58:35 -0400 Subject: [PATCH 22/58] Revert "Merge branch 'master' into develop" This reverts commit 1422fce0dbdb4dd79d402692b277bae247496d8f, reversing changes made to 9d2d1fffdfd4f8ed322d7ee293633d29807c5507. --- doc/headers.html | 2 - doc/headers/punctuation/is_begin_parens.html | 26 --- doc/headers/punctuation/remove_parens.html | 26 --- doc/ref.html | 2 - doc/ref/array_to_list.html | 70 ++++---- doc/ref/array_to_seq.html | 64 ++++--- doc/ref/array_to_tuple.html | 66 ++++--- doc/ref/for_r.html | 160 ++++++++--------- doc/ref/for_r_macros.html | 44 ----- doc/ref/is_begin_parens.html | 47 ----- doc/ref/list_to_array.html | 82 ++++----- doc/ref/list_to_array_d.html | 57 +++---- doc/ref/list_to_seq.html | 80 +++++---- doc/ref/list_to_seq_r.html | 55 +++--- doc/ref/list_to_tuple.html | 103 +++++------ doc/ref/list_to_tuple_r.html | 103 +++++------ doc/ref/remove_parens.html | 44 ----- doc/ref/repeat_z.html | 143 ++++++++-------- doc/ref/repeat_z_macros.html | 45 ----- doc/ref/seq_replace.html | 2 +- doc/ref/while_d.html | 161 ++++++++++-------- doc/ref/while_d_macros.html | 86 ---------- .../preprocessor/array/detail/get_data.hpp | 50 ------ .../boost/preprocessor/array/push_back.hpp | 4 +- .../boost/preprocessor/array/push_front.hpp | 4 +- include/boost/preprocessor/array/to_list.hpp | 20 +-- include/boost/preprocessor/array/to_seq.hpp | 19 +-- include/boost/preprocessor/array/to_tuple.hpp | 13 +- .../facilities/detail/is_empty.hpp | 55 ------ .../boost/preprocessor/facilities/empty.hpp | 2 - .../preprocessor/facilities/is_empty.hpp | 13 +- .../preprocessor/facilities/is_empty_or_1.hpp | 3 +- .../facilities/is_empty_variadic.hpp | 57 ------- include/boost/preprocessor/list/to_array.hpp | 37 +--- include/boost/preprocessor/list/to_tuple.hpp | 31 +--- include/boost/preprocessor/punctuation.hpp | 2 - .../punctuation/detail/is_begin_parens.hpp | 48 ------ .../punctuation/is_begin_parens.hpp | 51 ------ .../punctuation/remove_parens.hpp | 39 ----- .../seq/detail/binary_transform.hpp | 14 +- include/boost/preprocessor/seq/rest_n.hpp | 6 +- .../tuple/detail/is_single_return.hpp | 28 --- include/boost/preprocessor/tuple/elem.hpp | 16 +- include/boost/preprocessor/tuple/rem.hpp | 16 +- include/boost/preprocessor/tuple/to_seq.hpp | 3 - .../variadic/detail/is_single_return.hpp | 28 --- test/Jamfile.v2 | 72 ++------ test/array.cxx | 16 -- test/isempty.c | 12 -- test/isempty.cpp | 12 -- test/isempty.cxx | 145 ---------------- test/isempty_variadic_standard_failure.c | 12 -- test/isempty_variadic_standard_failure.cpp | 12 -- test/isempty_variadic_standard_failure.cxx | 25 --- test/isempty_variadic_standard_failure2.c | 12 -- test/isempty_variadic_standard_failure2.cpp | 12 -- test/isempty_variadic_standard_failure2.cxx | 25 --- test/list.cxx | 33 ++-- test/punctuation.c | 14 -- test/punctuation.cpp | 14 -- test/punctuation.cxx | 54 ------ test/seq.cxx | 18 -- test/tuple.cxx | 33 +--- test/tuple_elem_bug_test.cxx | 38 ----- 64 files changed, 626 insertions(+), 1960 deletions(-) delete mode 100644 doc/headers/punctuation/is_begin_parens.html delete mode 100644 doc/headers/punctuation/remove_parens.html delete mode 100644 doc/ref/for_r_macros.html delete mode 100644 doc/ref/is_begin_parens.html delete mode 100644 doc/ref/remove_parens.html delete mode 100644 doc/ref/repeat_z_macros.html delete mode 100644 doc/ref/while_d_macros.html delete mode 100644 include/boost/preprocessor/array/detail/get_data.hpp delete mode 100644 include/boost/preprocessor/facilities/detail/is_empty.hpp delete mode 100644 include/boost/preprocessor/facilities/is_empty_variadic.hpp delete mode 100644 include/boost/preprocessor/punctuation/detail/is_begin_parens.hpp delete mode 100644 include/boost/preprocessor/punctuation/is_begin_parens.hpp delete mode 100644 include/boost/preprocessor/punctuation/remove_parens.hpp delete mode 100644 include/boost/preprocessor/tuple/detail/is_single_return.hpp delete mode 100644 include/boost/preprocessor/variadic/detail/is_single_return.hpp delete mode 100644 test/isempty.c delete mode 100644 test/isempty.cpp delete mode 100644 test/isempty.cxx delete mode 100644 test/isempty_variadic_standard_failure.c delete mode 100644 test/isempty_variadic_standard_failure.cpp delete mode 100644 test/isempty_variadic_standard_failure.cxx delete mode 100644 test/isempty_variadic_standard_failure2.c delete mode 100644 test/isempty_variadic_standard_failure2.cpp delete mode 100644 test/isempty_variadic_standard_failure2.cxx delete mode 100644 test/punctuation.c delete mode 100644 test/punctuation.cpp delete mode 100644 test/punctuation.cxx delete mode 100644 test/tuple_elem_bug_test.cxx diff --git a/doc/headers.html b/doc/headers.html index e96b25e..90b59fd 100644 --- a/doc/headers.html +++ b/doc/headers.html @@ -138,10 +138,8 @@
  • punctuation/
  • comma.hpp
  • comma_if.hpp
  • -
  • is_begin_parens.hpp (v)
  • paren.hpp
  • paren_if.hpp
  • -
  • remove_parens.hpp (v)
  • repeat.hpp*
  • repeat_2nd.hpp*
  • repeat_3rd.hpp*
  • diff --git a/doc/headers/punctuation/is_begin_parens.html b/doc/headers/punctuation/is_begin_parens.html deleted file mode 100644 index 4897623..0000000 --- a/doc/headers/punctuation/is_begin_parens.html +++ /dev/null @@ -1,26 +0,0 @@ - - - - punctuation/is_begin_parens.hpp - - - -
    The punctuation/is_begin_parens.hpp - header defines a macro that determines if variadic data begins with a - parenthesis.
    -

    Usage

    -
    #include <boost/preprocessor/punctuation/is_begin_parens.hpp> -
    -

    Contents

    - -
    -
    © Copyright Edward Diener 2014
    -
    -

    Distributed under the Boost Software License, Version 1.0. (See - accompanying file LICENSE_1_0.txt - or copy at www.boost.org/LICENSE_1_0.txt)

    -
    - - diff --git a/doc/headers/punctuation/remove_parens.html b/doc/headers/punctuation/remove_parens.html deleted file mode 100644 index f2b6e46..0000000 --- a/doc/headers/punctuation/remove_parens.html +++ /dev/null @@ -1,26 +0,0 @@ - - - - punctuation/remove_parens.hpp - - - -
    The punctuation/remove_parens.hpp - header defines a macro that removes the beginning parenthesis from its - input if it exists.
    -

    Usage

    -
    #include <boost/preprocessor/punctuation/remove_parens.hpp> -
    -

    Contents

    - -
    -
    © Copyright Edward Diener 2014
    -
    -

    Distributed under the Boost Software License, Version 1.0. (See - accompanying file LICENSE_1_0.txt - or copy at www.boost.org/LICENSE_1_0.txt)

    -
    - - diff --git a/doc/ref.html b/doc/ref.html index 4d2081f..82c2905 100644 --- a/doc/ref.html +++ b/doc/ref.html @@ -105,7 +105,6 @@
  • INCLUDE_SELF
  • INDIRECT_SELF
  • INTERCEPT
  • -
  • IS_BEGIN_PARENS (v)
  • IS_ITERATING
  • IS_SELFISH
  • ITERATE
  • @@ -210,7 +209,6 @@
  • RELATIVE_FLAGS
  • RELATIVE_ITERATION
  • RELATIVE_START
  • -
  • REMOVE_PARENS (v)
  • REPEAT
  • REPEAT_1ST*
  • REPEAT_2ND*
  • diff --git a/doc/ref/array_to_list.html b/doc/ref/array_to_list.html index 2fdd247..607b205 100644 --- a/doc/ref/array_to_list.html +++ b/doc/ref/array_to_list.html @@ -1,41 +1,33 @@ - - - BOOST_PP_ARRAY_TO_LIST - - - -
    The BOOST_PP_ARRAY_TO_LIST macro - converts an array to a list.
    -

    Usage

    -
    BOOST_PP_ARRAY_TO_LIST(array)
    -

    Arguments

    -
    -
    array
    -
    The array to be converted.
    -
    -
      -
    -

    Remarks

    -

        If the array to be converted is empty, as - represented by '( 0, () )', the resulting list is empty, as - represented by 'BOOST_PP_NIL'.

    -

    Requirements

    - -

    Sample Code

    -
    -
    #include <boost/preprocessor/array/to_list.hpp>

    BOOST_PP_ARRAY_TO_LIST((3, (x, y, z)))
    // expands to (x, (y, (z, BOOST_PP_NIL)))
    -
    -
    -
    © Copyright Edward Diener 2011
    -
    -

    Distributed under the Boost Software License, Version 1.0. (See - accompanying file LICENSE_1_0.txt - or copy at www.boost.org/LICENSE_1_0.txt)

    -
    - s - + + BOOST_PP_ARRAY_TO_LIST + + + +
    The BOOST_PP_ARRAY_TO_LIST +macro converts an array to a list.
    +

    Usage

    +
    BOOST_PP_ARRAY_TO_LIST(array) +
    +

    Arguments

    +
    array
    +
    The array to be converted.
    +
    +
      +
    +

    Requirements

    + +

    Sample Code

    +
    +
    #include <boost/preprocessor/array/to_list.hpp>

    BOOST_PP_ARRAY_TO_LIST((3, (x, y, z)))
    // expands to (x, (y, (z, BOOST_PP_NIL)))
    +
    +
    +
    © Copyright Edward Diener 2011
    +
    +

    Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt +or copy at www.boost.org/LICENSE_1_0.txt)

    +
    + diff --git a/doc/ref/array_to_seq.html b/doc/ref/array_to_seq.html index bf3518e..308b364 100644 --- a/doc/ref/array_to_seq.html +++ b/doc/ref/array_to_seq.html @@ -1,37 +1,31 @@ - - - BOOST_PP_ARRAY_TO_SEQ - - - -
    The BOOST_PP_ARRAY_TO_SEQ macro - converts an array to a seq.
    -

    Usage

    -
    BOOST_PP_ARRAY_TO_SEQ(array)
    -

    Arguments

    -
    -
    array
    -
    The array to be converted.
    -
    -

    Remarks

    -

        If the array to be converted is empty, as - represented by '( 0, () )', the resulting seq is undefined since a - seq cannot be empty.

    -

    Requirements

    - -

    Sample Code

    -
    -
    #include <boost/preprocessor/array/to_seq.hpp>

    BOOST_PP_ARRAY_TO_SEQ((3, (a, b, c))) // expands to (a)(b)(c)
    -
    -
    -
    © Copyright Edward Diener 2011
    -
    -

    Distributed under the Boost Software License, Version 1.0. (See - accompanying file LICENSE_1_0.txt - or copy at www.boost.org/LICENSE_1_0.txt)

    -
    - + + BOOST_PP_ARRAY_TO_SEQ + + + +
    The BOOST_PP_ARRAY_TO_SEQ macro +converts an array to a seq.
    +

    Usage

    +
    BOOST_PP_ARRAY_TO_SEQ(array) +
    +

    Arguments

    +
    array
    +
    The array to be converted.
    +
    +

    Requirements

    + +

    Sample Code

    +
    +
    #include <boost/preprocessor/array/to_seq.hpp>

    BOOST_PP_ARRAY_TO_SEQ((3, (a, b, c))) // expands to (a)(b)(c)
    +
    +
    +
    © Copyright Edward Diener 2011
    +
    +

    Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt +or copy at www.boost.org/LICENSE_1_0.txt)

    +
    + diff --git a/doc/ref/array_to_tuple.html b/doc/ref/array_to_tuple.html index 8f9c958..085dd39 100644 --- a/doc/ref/array_to_tuple.html +++ b/doc/ref/array_to_tuple.html @@ -1,39 +1,31 @@ - - - BOOST_PP_ARRAY_TO_TUPLE - - - -
    The BOOST_PP_ARRAY_TO_TUPLE macro - converts an array to an tuple.
    -

    Usage

    -
    BOOST_PP_ARRAY_TO_TUPLE(array)
    -

    Arguments

    -
    -
    array
    -
    The array to be converted.
    -
    -

    Remarks

    -

        If the array to be converted is empty, as - represented by '( 0, () )', the resulting tuple is undefined - since a tuple cannot be empty.

    -

    Requirements

    - -

    Sample Code

    -
    -
    #include <boost/preprocessor/array/to_tuple.hpp>

    #define ARRAY (3,(a, b, c))

    BOOST_PP_ARRAY_TO_TUPLE(ARRAY) // expands to (a, b, c)
    -
    -
    -
    © Copyright Edward Diener 2011 -
    -
    -

    Distributed under the Boost Software License, Version 1.0. (See - accompanying file LICENSE_1_0.txt - or copy at www.boost.org/LICENSE_1_0.txt)

    -
    - + + BOOST_PP_ARRAY_TO_TUPLE + + + +
    The BOOST_PP_ARRAY_TO_TUPLE macro +converts an array to an tuple.
    +

    Usage

    +
    BOOST_PP_ARRAY_TO_TUPLE(array)
    +

    Arguments

    +
    +
    array
    +
    The array to be converted.
    +
    +

    Requirements

    + +

    Sample Code

    +
    +
    #include <boost/preprocessor/array/to_tuple.hpp>

    #define ARRAY (3,(a, b, c))

    BOOST_PP_ARRAY_TO_TUPLE(ARRAY) // expands to (a, b, c)
    +
    +
    +
    © Copyright Edward Diener 2011
    +
    +

    Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt +or copy at www.boost.org/LICENSE_1_0.txt)

    +
    + diff --git a/doc/ref/for_r.html b/doc/ref/for_r.html index 3221f88..1c23bb4 100644 --- a/doc/ref/for_r.html +++ b/doc/ref/for_r.html @@ -1,68 +1,75 @@ - - - BOOST_PP_FOR_r - - - -
    The BOOST_PP_FOR_r macro - represents a reentry into the BOOST_PP_FOR repetition construct.
    -

    Usage

    -
    BOOST_PP_FOR_ ## r(state, pred, - op, macro)
    -

    Arguments

    -
    -
    r
    -
    The next available BOOST_PP_FOR repetition.
    -
    state
    -
    The initial state.
    -
    pred
    -
    A binary predicate of the form pred(r, state).  - This macro must expand to an integer in the range of 0 to BOOST_PP_LIMIT_MAG.  - BOOST_PP_FOR repeatedly expands macro while this - predicate returns non-zero.  This macro is called with the next - available BOOST_PP_FOR repetition and the current state. -
    -
    op
    -
    A binary operation of the form op(r, state).  - This operation is expanded by BOOST_PP_FOR with the next - available BOOST_PP_FOR repetition and the current state.  - This macro is repeatedly applied to the state, each time - producing a new state, until pred returns 0.
    -
    macro
    -
    A binary macro of the form macro(r, state).  - This macro is expanded by BOOST_PP_FOR with the next available BOOST_PP_FOR - repetition and the current state.  This macro is is - repeated by BOOST_PP_FOR until pred returns 0.
    -
    -

    Remarks

    -
    This macro expands to the sequence: -
    macro(r, state) macro(r, op(r, - state)) ... macro(r, op(r, ... op(r, - state) ... ))
    -
    -
    At certain times, it may be necessary to perform the concatenation - with BOOST_PP_CAT rather than the preprocessor token-pasting - operator.  This happens when the r value is a macro - invocation itself.  It needs a delay to allow it to expand.  The - syntax in such a scenario becomes: -
    BOOST_PP_CAT(BOOST_PP_FOR_, r)(state, - pred, op, macro)
    -
    -

    See Also

    - -

    Requirements

    - -

    Sample Code

    -
    -
    #include <boost/preprocessor/arithmetic/dec.hpp>
    +
    +	BOOST_PP_FOR_r
    +	
    +
    +
    +	
    + The BOOST_PP_FOR_r macro represents a reentry into the BOOST_PP_FOR repetition construct. +
    +

    Usage

    +
    + BOOST_PP_FOR_ ## r(state, pred, op, macro) +
    +

    Arguments

    +
    +
    r
    +
    + The next available BOOST_PP_FOR repetition. +
    +
    state
    +
    + The initial state. +
    +
    pred
    +
    + A binary predicate of the form pred(r, state).  + This macro must expand to an integer in the range of 0 to BOOST_PP_LIMIT_MAG.  + BOOST_PP_FOR repeatedly expands macro while this predicate returns non-zero.  + This macro is called with the next available BOOST_PP_FOR repetition and the current state. +
    +
    op
    +
    + A binary operation of the form op(r, state).  + This operation is expanded by BOOST_PP_FOR with the next available BOOST_PP_FOR repetition and the current state.  + This macro is repeatedly applied to the state, each time producing a new state, until pred returns 0. +
    +
    macro
    +
    + A binary macro of the form macro(r, state).  + This macro is expanded by BOOST_PP_FOR with the next available BOOST_PP_FOR repetition and the current state.  + This macro is is repeated by BOOST_PP_FOR until pred returns 0. +
    +
    +

    Remarks

    +
    + This macro expands to the sequence: +
    + macro(r, state) macro(r, op(r, state)) ... macro(r, op(r, ... op(r, state) ... )) +
    +
    +
    + At certain times, it may be necessary to perform the concatenation with BOOST_PP_CAT rather than the preprocessor token-pasting operator.  + This happens when the r value is a macro invocation itself.  + It needs a delay to allow it to expand.  + The syntax in such a scenario becomes: +
    + BOOST_PP_CAT(BOOST_PP_FOR_, r)(state, pred, op, macro) +
    +
    +

    See Also

    + +

    Requirements

    + +

    Sample Code

    +
    +#include <boost/preprocessor/arithmetic/dec.hpp>
     #include <boost/preprocessor/arithmetic/inc.hpp>
     #include <boost/preprocessor/comparison/not_equal.hpp>
     #include <boost/preprocessor/punctuation/comma_if.hpp>
    @@ -133,17 +140,16 @@ TEMPLATE_TEMPLATE(2, 4, T)
        template<class, class, class, class> class T4
     */
     
    -
    -
    © Copyright Housemarque Oy 2002
    - © Copyright Paul Mensonides 2002
    -
    © Copyright Edward Diener 2014
    -
    -
    -

    Distributed under the Boost Software License, Version 1.0. (See - accompanying file LICENSE_1_0.txt - or copy at www.boost.org/LICENSE_1_0.txt)

    -
    - +
    +
    + © Copyright Housemarque Oy 2002 +
    © Copyright Paul Mensonides 2002 +
    +
    +

    Distributed under the Boost Software License, Version 1.0. (See + accompanying file LICENSE_1_0.txt or + copy at www.boost.org/LICENSE_1_0.txt)

    +
    + diff --git a/doc/ref/for_r_macros.html b/doc/ref/for_r_macros.html deleted file mode 100644 index e5dda58..0000000 --- a/doc/ref/for_r_macros.html +++ /dev/null @@ -1,44 +0,0 @@ - - - - BOOST_PP_FOR_r_macros - - - This is a list, based on functionality, of the macros which have an - alternate _r name, representing a reentry into the BOOST_PP_FOR - looping construct: -

    repetition

    - - list
    - - seq
    - - base
    - -
    -
      -
    -
    -
    © Copyright Edward Diener 2014
    -
    -

    Distributed under the Boost Software License, Version 1.0. (See - accompanying file LICENSE_1_0.txt - or copy at www.boost.org/LICENSE_1_0.txt)

    -
    - - diff --git a/doc/ref/is_begin_parens.html b/doc/ref/is_begin_parens.html deleted file mode 100644 index 0e0b39c..0000000 --- a/doc/ref/is_begin_parens.html +++ /dev/null @@ -1,47 +0,0 @@ - - - - BOOST_PP_IS_BEGIN_PARENS - - - -
    The BOOST_PP_IS_BEGIN_PARENS - determines whether the input starts with a set of parenthesis.
    -

    Usage

    -
    BOOST_PP_IS_BEGIN_PARENS(...) (v)
    -

    Arguments

    -

        ...        -     The input as variadic data.

    -

    Remarks

    -
    If the input input begins with a parenthesis, with any data within - that parenthesis, the macro returns 1, otherwise it returns 0. Data may - follow the beginning parenthesis and the macro still will return 1.
    -
    - For Visual Studio 2005 ( VC8 ) the input data must be a single parameter - else a compilation error will occur.
    -

    See Also

    - -

    Requirements

    - -

    Sample Code

    -
    -
    #include <boost/preprocessor/punctuation/is_begin_parens.hpp>
    -
    -#define VARDATA more_data , more_params
    #define VARDATAP ( data ) more_data , more_params
    #define DATA data
    #define DATAP ( data ) more_data
    -BOOST_PP_IS_BEGIN_PARENS(VARDATA) // expands to 0, compiler error with VC8 -BOOST_PP_IS_BEGIN_PARENS(VARDATAP) // expands to 1, compiler error with VC8

    BOOST_PP_IS_BEGIN_PARENS(DATA) // expands to 0 -BOOST_PP_IS_BEGIN_PARENS(DATAP) // expands to 1

    BOOST_PP_IS_BEGIN_PARENS() // expands to 0
    -
    -
    -
    © Copyright Edward Diener 2014
    -
    -

    Distributed under the Boost Software License, Version 1.0. (See - accompanying file LICENSE_1_0.txt - or copy at www.boost.org/LICENSE_1_0.txt)

    -
    - - diff --git a/doc/ref/list_to_array.html b/doc/ref/list_to_array.html index 46154c9..b691b34 100644 --- a/doc/ref/list_to_array.html +++ b/doc/ref/list_to_array.html @@ -1,47 +1,39 @@ - - - BOOST_PP_LIST_TO_ARRAY - - - -
    The BOOST_PP_LIST_TO_ARRAY macro - converts a list to an array.
    -

    Usage

    -
    BOOST_PP_LIST_TO_ARRAY(list)
    -

    Arguments

    -
    -
    list
    -
    The list to be converted.
    -
    -
    -

    Remarks

    -
    This macro uses BOOST_PP_WHILE. Within BOOST_PP_WHILE, - it is more efficient to use BOOST_PP_LIST_TO_ARRAY_D.
    -
    - If the list to be converted is empty, as represented by - 'BOOST_PP_NIL', the resulting array is empty, as represented by '( 0, () - )'.
    -

    See Also

    - -

    Requirements

    - -

    Sample Code

    -
    -
    #include <boost/preprocessor/list/to_array.hpp>

    #define LIST (a, (b, (c, BOOST_PP_NIL)))

    BOOST_PP_LIST_TO_ARRAY(LIST) // expands to (3, (a, b, c))
    -
    -
    -
    © Copyright Edward Diener 2011 -
    -
    -

    Distributed under the Boost Software License, Version 1.0. (See - accompanying file LICENSE_1_0.txt - or copy at www.boost.org/LICENSE_1_0.txt)

    -
    - + + BOOST_PP_LIST_TO_ARRAY + + +
    The BOOST_PP_LIST_TO_ARRAY macro +converts a list to an array.
    +

    Usage

    +
    BOOST_PP_LIST_TO_ARRAY(list)
    +

    Arguments

    +
    +
    list
    +
    The list to be converted.
    +
    +

    Remarks

    +
    + This macro uses BOOST_PP_WHILE. + Within BOOST_PP_WHILE, it is more efficient to use BOOST_PP_LIST_TO_ARRAY_D. +
    +

    See Also

    + +

    Requirements

    + +

    Sample Code

    +
    +
    #include <boost/preprocessor/list/to_array.hpp>

    #define LIST (a, (b, (c, BOOST_PP_NIL)))

    BOOST_PP_LIST_TO_ARRAY(LIST) // expands to (3, (a, b, c))
    +
    +
    +
    © Copyright Edward Diener 2011
    +
    +

    Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt +or copy at www.boost.org/LICENSE_1_0.txt)

    +
    + diff --git a/doc/ref/list_to_array_d.html b/doc/ref/list_to_array_d.html index 835d9e2..8d93328 100644 --- a/doc/ref/list_to_array_d.html +++ b/doc/ref/list_to_array_d.html @@ -1,34 +1,27 @@ - - - BOOST_PP_LIST_TO_ARRAY_D - - - -
    The BOOST_PP_LIST_TO_ARRAY_D macro - converts a list to an array. It reenters BOOST_PP_WHILE - with maximum efficiency.
    -

    Usage

    -
    BOOST_PP_LIST_TO_ARRAY_D(d, list) -
    -

    Arguments

    -
    -
    d
    -
    The next available BOOST_PP_WHILE iteration.
    -
    list
    -
    The list to be converted.
    -
    -

    Remarks

    -

        If the list to be converted is empty, as - represented by 'BOOST_PP_NIL', the resulting array is empty, as - represented by '( 0, () )'.

    -

    See Also

    -

    See Also

    - -

    Requirements

    - - + + BOOST_PP_LIST_TO_ARRAY_D + + +
    +The BOOST_PP_LIST_TO_ARRAY_D macro converts a list to an array. +It reenters BOOST_PP_WHILE with maximum efficiency. +
    +

    Usage

    +
    BOOST_PP_LIST_TO_ARRAY_D(d, list)
    +

    Arguments

    +
    +
    d
    +
    The next available BOOST_PP_WHILE iteration.
    +
    list
    +
    The list to be converted.
    +
    +

    See Also

    + +

    Requirements

    + + diff --git a/doc/ref/list_to_seq.html b/doc/ref/list_to_seq.html index 3efc7e1..2f77cf1 100644 --- a/doc/ref/list_to_seq.html +++ b/doc/ref/list_to_seq.html @@ -1,44 +1,40 @@ - - - BOOST_PP_LIST_TO_SEQ - - - -
    The BOOST_PP_LIST_TO_SEQ macro - converts a list to a seq.
    -

    Usage

    -
    BOOST_PP_LIST_TO_SEQ(list)
    -

    Arguments

    -
    -
    list
    -
    The list to be converted.
    -
    -

    Remarks

    -
    This macro uses BOOST_PP_FOR. Within BOOST_PP_FOR, it - is more efficient to use BOOST_PP_LIST_TO_SEQ_R.
    -
    - If the list to be converted is empty, as represented by - 'BOOST_PP_NIL', the resulting seq is undefined since a seq - cannot be empty.
    -

    See Also

    - -

    Requirements

    - -

    Sample Code

    -
    -
    #include <boost/preprocessor/list/to_seq.hpp>

    BOOST_PP_LIST_TO_SEQ((a, (b, (c, BOOST_PP_NIL)))) // expands to (a)(b)(c)
    -
    -
    -
    © Copyright Edward Diener 2011
    -
    -

    Distributed under the Boost Software License, Version 1.0. (See - accompanying file LICENSE_1_0.txt - or copy at www.boost.org/LICENSE_1_0.txt)

    -
    - + + BOOST_PP_LIST_TO_SEQ + + + +
    The BOOST_PP_LIST_TO_SEQ macro +converts a list to a seq.
    +

    Usage

    +
    BOOST_PP_LIST_TO_SEQ(list) +
    +

    Arguments

    +
    list
    +
    The list to be converted.
    +
    +

    Remarks

    +
    + This macro uses BOOST_PP_FOR. + Within BOOST_PP_FOR, it is more efficient to use BOOST_PP_LIST_TO_SEQ_R. +
    +

    See Also

    + +

    Requirements

    + +

    Sample Code

    +
    +
    #include <boost/preprocessor/list/to_seq.hpp>

    BOOST_PP_LIST_TO_SEQ((a, (b, (c, BOOST_PP_NIL)))) // expands to (a)(b)(c)
    +
    +
    +
    © Copyright Edward Diener 2011
    +
    +

    Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt +or copy at www.boost.org/LICENSE_1_0.txt)

    +
    + diff --git a/doc/ref/list_to_seq_r.html b/doc/ref/list_to_seq_r.html index cc7a854..2c2bb37 100644 --- a/doc/ref/list_to_seq_r.html +++ b/doc/ref/list_to_seq_r.html @@ -1,32 +1,27 @@ - - - BOOST_PP_LIST_TO_SEQ_R - - - -
    The BOOST_PP_LIST_TO_SEQ_R macro - converts a list to a seq. It reenters BOOST_PP_FOR - with maximum efficiency.
    -

    Usage

    -
    BOOST_PP_LIST_TO_SEQ_R(r, list)
    -

    Arguments

    -
    -
    d
    -
    The next available BOOST_PP_FOR repetition.
    -
    list
    -
    The list to be converted.
    -
    -

    Remarks

    -

        If the list to be converted is empty, as - represented by 'BOOST_PP_NIL', the resulting seq is undefined - since a seq cannot be empty.

    -

    See Also

    - -

    Requirements

    - - + + BOOST_PP_LIST_TO_SEQ_R + + +
    +The BOOST_PP_LIST_TO_SEQ_R macro converts a list to an seq. +It reenters BOOST_PP_FOR with maximum efficiency. +
    +

    Usage

    +
    BOOST_PP_LIST_TO_SEQ_R(r, list)
    +

    Arguments

    +
    +
    d
    +
    The next available BOOST_PP_FOR repetition.
    +
    list
    +
    The list to be converted.
    +
    +

    See Also

    + +

    Requirements

    + + diff --git a/doc/ref/list_to_tuple.html b/doc/ref/list_to_tuple.html index d022c2b..37e7311 100644 --- a/doc/ref/list_to_tuple.html +++ b/doc/ref/list_to_tuple.html @@ -1,55 +1,62 @@ - - - BOOST_PP_LIST_TO_TUPLE - - - -
    The BOOST_PP_LIST_TO_TUPLE macro - converts a list to a tuple.
    -

    Usage

    -
    BOOST_PP_LIST_TO_TUPLE(list)
    -

    Arguments

    -
    -
    list
    -
    The list to be converted.
    -
    -

    Remarks

    -
    If list is, for example, (a, (b, (c, BOOST_PP_NIL))), - this macro will produce: -
    (a, b, c)
    -
    -
    Previously, this macro could not be used inside BOOST_PP_FOR.  - There is no longer any such restriction.  It is more efficient, - however, to use BOOST_PP_LIST_TO_TUPLE_R in such a situation.
    -
    - If the list to be converted is empty, as represented by 'BOOST_PP_NIL', - the resulting tuple is undefined since a tuple cannot be - empty.
    -

    See Also

    - -

    Requirements

    - -

    Sample Code

    -
    -
    #include <boost/preprocessor/list/to_tuple.hpp>
    +
    +	BOOST_PP_LIST_TO_TUPLE
    +	
    +
    +
    +	
    + The BOOST_PP_LIST_TO_TUPLE macro converts a list to a tuple. +
    +

    Usage

    +
    + BOOST_PP_LIST_TO_TUPLE(list) +
    +

    Arguments

    +
    +
    list
    +
    + The list to be converted. +
    +
    +

    Remarks

    +
    + If list is, for example, (a, (b, (c, BOOST_PP_NIL))), + this macro will produce: +
    + (a, b, c) +
    +
    +
    + Previously, this macro could not be used inside BOOST_PP_FOR.  + There is no longer any such restriction.  + It is more efficient, however, to use BOOST_PP_LIST_TO_TUPLE_R in such a situation. +
    +

    See Also

    + +

    Requirements

    + +

    Sample Code

    +
    +#include <boost/preprocessor/list/to_tuple.hpp>
     
     #define LIST (w, (x, (y, (z, BOOST_PP_NIL))))
     
     BOOST_PP_LIST_TO_TUPLE(LIST) // expands to (w, x, y, z)
     
    -
    -
    © Copyright Housemarque Oy 2002
    - © Copyright Paul Mensonides 2002
    -
    -

    Distributed under the Boost Software License, Version 1.0. (See - accompanying file LICENSE_1_0.txt - or copy at www.boost.org/LICENSE_1_0.txt)

    -
    - +
    +
    + © Copyright Housemarque Oy 2002 +
    © Copyright Paul Mensonides 2002 +
    +
    +

    Distributed under the Boost Software License, Version 1.0. (See + accompanying file LICENSE_1_0.txt or + copy at www.boost.org/LICENSE_1_0.txt)

    +
    + diff --git a/doc/ref/list_to_tuple_r.html b/doc/ref/list_to_tuple_r.html index 0227d38..1ba51a0 100644 --- a/doc/ref/list_to_tuple_r.html +++ b/doc/ref/list_to_tuple_r.html @@ -1,42 +1,47 @@ - - - BOOST_PP_LIST_TO_TUPLE_R - - - -
    The BOOST_PP_LIST_TO_TUPLE_R macro - converts a list to a tuple.  It reenters BOOST_PP_FOR - with maximum efficiency.
    -

    Usage

    -
    BOOST_PP_LIST_TO_TUPLE_R(r, list) -
    -

    Arguments

    -
    -
    r
    -
    The next available BOOST_PP_FOR repetition.
    -
    list
    -
    The list to be converted.
    -
    -

    Remarks

    -

       If list is, for example, (a, (b, (c, - BOOST_PP_NIL))), this macro will produce:

    -
    -
    (a, b, c)  
    -
    -

       If the list to - be converted is empty, as represented by 'BOOST_PP_NIL', the resulting tuple - is undefined since a tuple cannot be empty.

    -

    See Also

    - -

    Requirements

    - -

    Sample Code

    -
    -
    #include <boost/preprocessor/list/adt.hpp>
    +
    +	BOOST_PP_LIST_TO_TUPLE_R
    +	
    +
    +
    +	
    + The BOOST_PP_LIST_TO_TUPLE_R macro converts a list to a tuple.  + It reenters BOOST_PP_FOR with maximum efficiency. +
    +

    Usage

    +
    + BOOST_PP_LIST_TO_TUPLE_R(r, list) +
    +

    Arguments

    +
    +
    r
    +
    + The next available BOOST_PP_FOR repetition. +
    +
    list
    +
    + The list to be converted. +
    +
    +

    Remarks

    +
    + If list is, for example, (a, (b, (c, BOOST_PP_NIL))), + this macro will produce: +
    + (a, b, c) +
    +
    +

    See Also

    + +

    Requirements

    + +

    Sample Code

    +
    +#include <boost/preprocessor/list/adt.hpp>
     #include <boost/preprocessor/list/to_tuple.hpp>
     #include <boost/preprocessor/repetition/for.hpp>
     
    @@ -49,14 +54,16 @@
     BOOST_PP_FOR(LIST, PRED, OP, MACRO)
        // expands to (x, y, z) (y, z) (z)
     
    -
    -
    © Copyright Housemarque Oy 2002
    - © Copyright Paul Mensonides 2002
    -
    -

    Distributed under the Boost Software License, Version 1.0. (See - accompanying file LICENSE_1_0.txt - or copy at www.boost.org/LICENSE_1_0.txt)

    -
    - +
    +
    + © Copyright Housemarque Oy 2002 +
    © Copyright Paul Mensonides 2002 +
    +
    +

    Distributed under the Boost Software License, Version 1.0. (See + accompanying file LICENSE_1_0.txt or + copy at www.boost.org/LICENSE_1_0.txt)

    +
    + diff --git a/doc/ref/remove_parens.html b/doc/ref/remove_parens.html deleted file mode 100644 index 72312dd..0000000 --- a/doc/ref/remove_parens.html +++ /dev/null @@ -1,44 +0,0 @@ - - - - BOOST_PP_REMOVE_PARENS - - - -
    The BOOST_PP_REMOVE_PARENS macro - removes the beginning parenthesis, if it exists, from the input data and - expands to the result
    -

    Usage

    -
    BOOST_PP_REMOVE_PARENS(param) (v)
    -

    Arguments    

    -

        param   -         - The input data.

    -

    Remarks

    -
    If the input begins with a parenthesis, with any data within that - parenthesis, the macro removes the parenthesis and expands to the result. - If the input does not begin with a parenthesis the macro expands to the - input.
    -
    -

    See Also

    - -

    Requirements

    - -

    Sample Code

    -
    -
    #include <boost/preprocessor/punctuation/remove_parens.hpp>

    #define DATA data
    #define DATAP ( data ) more_data

    BOOST_PP_REMOVE_PARENS(DATA) // expands to 'data' -BOOST_PP_REMOVE_PARENS(DATAP) // expands to 'data more_data'
    -
    -
    -
    © Copyright Edward Diener 2014
    -
    -

    Distributed under the Boost Software License, Version 1.0. (See - accompanying file LICENSE_1_0.txt - or copy at www.boost.org/LICENSE_1_0.txt)

    -
    - - diff --git a/doc/ref/repeat_z.html b/doc/ref/repeat_z.html index a2f21b8..36d0d03 100644 --- a/doc/ref/repeat_z.html +++ b/doc/ref/repeat_z.html @@ -1,59 +1,67 @@ - - - BOOST_PP_REPEAT_z - - - -
    The BOOST_PP_REPEAT_z macro - represents a reentry into the BOOST_PP_REPEAT repetition - construct.
    -

    Usage

    -
    BOOST_PP_REPEAT_ ## z(count, macro, - data)
    -

    Arguments

    -
    -
    z
    -
    The next available BOOST_PP_REPEAT dimension.
    -
    count
    -
    The number of repetitious calls to macro.  Valid values - range from 0 to BOOST_PP_LIMIT_REPEAT.
    -
    macro
    -
    A ternary operation of the form macro(z, n, data).  - This macro is expanded by BOOST_PP_REPEAT with the next - available repetition depth, the current repetition number, and the - auxiliary data argument. 
    -
    data
    -
    Auxiliary data passed to macro.
    -
    -

    Remarks

    -
    This macro expands to the sequence: -
    macro(z, 0, data) macro(z, - 1, data) ... macro(z, count - 1, - data)
    -
    -
    At certain times, it may be necessary to perform the concatenation - with BOOST_PP_CAT rather than the preprocessor token-pasting - operator.  This happens when the z value is a macro - invocation itself.  It needs a delay to allow it to expand.  The - syntax in such a scenario becomes: -
    BOOST_PP_CAT(BOOST_PP_REPEAT_, z)(count, - macro, data)
    -
    -

    See Also

    - -

    Requirements

    - -

    Sample Code

    -
    -
    #include <boost/preprocessor/arithmetic/inc.hpp>
    +
    +	BOOST_PP_REPEAT_z
    +	
    +
    +
    +	
    + The BOOST_PP_REPEAT_z macro represents a reentry into the BOOST_PP_REPEAT repetition construct. +
    +

    Usage

    +
    + BOOST_PP_REPEAT_ ## z(count, macro, data) +
    +

    Arguments

    +
    +
    z
    +
    + The next available BOOST_PP_REPEAT dimension. +
    +
    count
    +
    + The number of repetitious calls to macro.  + Valid values range from 0 to BOOST_PP_LIMIT_REPEAT. +
    +
    macro
    +
    + A ternary operation of the form macro(z, n, data).  + This macro is expanded by BOOST_PP_REPEAT with the next available repetition depth, + the current repetition number, and the auxiliary data argument.  +
    +
    data
    +
    + Auxiliary data passed to macro. +
    +
    +

    Remarks

    +
    + This macro expands to the sequence: +
    + macro(z, 0, data) macro(z, 1, data) ... macro(z, count - 1, data) +
    +
    +
    + At certain times, it may be necessary to perform the concatenation with BOOST_PP_CAT rather than the preprocessor token-pasting operator.  + This happens when the z value is a macro invocation itself.  + It needs a delay to allow it to expand.  + The syntax in such a scenario becomes: +
    + BOOST_PP_CAT(BOOST_PP_REPEAT_, z)(count, macro, data) +
    +
    +

    See Also

    + +

    Requirements

    + +

    Sample Code

    +
    +#include <boost/preprocessor/arithmetic/inc.hpp>
     #include <boost/preprocessor/punctuation/comma_if.hpp>
     #include <boost/preprocessor/repetition/repeat.hpp>
     
    @@ -77,17 +85,16 @@
           template<class, class, class> class T2
        */
     
    -
    -
    © Copyright Housemarque Oy 2002
    - © Copyright Paul Mensonides 2002
    -
    © Copyright Edward Diener 2014
    -
    -
    -

    Distributed under the Boost Software License, Version 1.0. (See - accompanying file LICENSE_1_0.txt - or copy at www.boost.org/LICENSE_1_0.txt)

    -
    - +
    +
    + © Copyright Housemarque Oy 2002 +
    © Copyright Paul Mensonides 2002 +
    +
    +

    Distributed under the Boost Software License, Version 1.0. (See + accompanying file LICENSE_1_0.txt or + copy at www.boost.org/LICENSE_1_0.txt)

    +
    + diff --git a/doc/ref/repeat_z_macros.html b/doc/ref/repeat_z_macros.html deleted file mode 100644 index 14b8182..0000000 --- a/doc/ref/repeat_z_macros.html +++ /dev/null @@ -1,45 +0,0 @@ - - - - BOOST_PP_REPEAT_z_macros - - - This is a list, based on functionality, of the macros which have an - alternate _z name, representing a reentry into the BOOST_PP_REPEAT - looping construct:
    -
    - array
    - - repetition
    - - base
    - -
    -
    
    -    
    -
    © Copyright Edward Diener 2014
    -
    -

    Distributed under the Boost Software License, Version 1.0. (See - accompanying file LICENSE_1_0.txt - or copy at www.boost.org/LICENSE_1_0.txt)

    -
    - - diff --git a/doc/ref/seq_replace.html b/doc/ref/seq_replace.html index 9a64e5d..c757113 100644 --- a/doc/ref/seq_replace.html +++ b/doc/ref/seq_replace.html @@ -11,7 +11,7 @@ Usage

    - BOOST_PP_SEQ_REPLACE(seq, i, elem) + BOOST_PP_SEQ_RPLACE(seq, i, elem)

    Arguments diff --git a/doc/ref/while_d.html b/doc/ref/while_d.html index 42f9eab..8b59f10 100644 --- a/doc/ref/while_d.html +++ b/doc/ref/while_d.html @@ -1,66 +1,78 @@ - - - BOOST_PP_WHILE_d - - - -
    The BOOST_PP_WHILE_d macro - represents a reentry into the BOOST_PP_WHILE looping construct.
    -

    Usage

    -
    BOOST_PP_WHILE_ ## d(pred, op, - state)
    -

    Arguments

    -
    -
    d
    -
    The next available BOOST_PP_WHILE iteration.
    -
    pred
    -
    A binary predicate of the form pred(d, state).  - This predicate is expanded by BOOST_PP_WHILE with the next - available iteration d and the current state.  This - predicate must expand to value in the range of 0 to BOOST_PP_LIMIT_MAG. - The construct continues to loop until this predicate returns 0.  - When this predicate returns 0, BOOST_PP_WHILE returns - the current state.
    -
    op
    -
    A binary operation of the form op(d, state).  - This operation is expanded by BOOST_PP_WHILE with the next - available iteration d and the current state.  This - macro is repeatedly applied to the state, each time producing a - new state, until pred returns 0.
    -
    state
    -
    The initial state.  Often this argument is a tuple.
    -
    -

    Remarks

    -
    This macro iterates op(d, state) while pred(d, - state) is non-zero.  In other words expands to: -
    op(d, ... op(d, op(d, state)) - ... ).
    -
    -
    At certain times, it may be necessary to perform the concatenation - with BOOST_PP_CAT rather than the preprocessor token-pasting - operator.  This happens when the d value is a macro - invocation itself.  It needs a delay to allow it to expand.  The - syntax in such a scenario becomes: -
    BOOST_PP_CAT(BOOST_PP_WHILE_, d)(pred, - op, state).
    -
    -
    Previously, it was possible to concatenate d directly to BOOST_PP_WHILE - (without the trailing underscore).  This is no longer supported.
    -

    See Also

    - -

    Requirements

    - -

    Sample Code

    -
    -
    #include <boost/preprocessor/arithmetic/add.hpp>
    +
    +	BOOST_PP_WHILE_d
    +	
    +
    +
    +	
    + The BOOST_PP_WHILE_d macro represents a reentry into the BOOST_PP_WHILE looping construct. +
    +

    Usage

    +
    + BOOST_PP_WHILE_ ## d(pred, op, state) +
    +

    Arguments

    +
    +
    d
    +
    + The next available BOOST_PP_WHILE iteration. +
    +
    pred
    +
    + A binary predicate of the form pred(d, state).  + This predicate is expanded by BOOST_PP_WHILE with the next available + iteration d and the current state.  + This predicate must expand to value in the range of 0 to BOOST_PP_LIMIT_MAG. + The construct continues to loop until this predicate returns 0.  + When this predicate returns 0, BOOST_PP_WHILE returns the current state. +
    +
    op
    +
    + A binary operation of the form op(d, state).  + This operation is expanded by BOOST_PP_WHILE with the next available + iteration d and the current state.  + This macro is repeatedly applied to the state, each time producing a new state, until pred returns 0. +
    +
    state
    +
    + The initial state.  + Often this argument is a tuple. +
    +
    +

    Remarks

    +
    + This macro iterates op(d, state) while pred(d, state) is non-zero.  + In other words expands to: +
    + op(d, ... op(d, op(d, state)) ... ). +
    +
    +
    + At certain times, it may be necessary to perform the concatenation with BOOST_PP_CAT rather than the preprocessor token-pasting operator.  + This happens when the d value is a macro invocation itself.  + It needs a delay to allow it to expand.  + The syntax in such a scenario becomes: +
    + BOOST_PP_CAT(BOOST_PP_WHILE_, d)(pred, op, state). +
    +
    +
    + Previously, it was possible to concatenate d directly to BOOST_PP_WHILE (without the trailing underscore).  + This is no longer supported. +
    +

    See Also

    + +

    Requirements

    + +

    Sample Code

    +
    +#include <boost/preprocessor/arithmetic/add.hpp>
     #include <boost/preprocessor/arithmetic/dec.hpp>
     #include <boost/preprocessor/array/elem.hpp>
     #include <boost/preprocessor/array/size.hpp>
    @@ -102,17 +114,16 @@
     
     ACCUMULATE_D(1, ARRAY)// expands to 10
     
    -
    -
    © Copyright Housemarque Oy 2002
    - © Copyright Paul Mensonides 2002
    -
    © Copyright Edward Diener 2014
    -
    -
    -

    Distributed under the Boost Software License, Version 1.0. (See - accompanying file LICENSE_1_0.txt - or copy at www.boost.org/LICENSE_1_0.txt)

    -
    - +
    +
    + © Copyright Housemarque Oy 2002 +
    © Copyright Paul Mensonides 2002 +
    +
    +

    Distributed under the Boost Software License, Version 1.0. (See + accompanying file LICENSE_1_0.txt or + copy at www.boost.org/LICENSE_1_0.txt)

    +
    + diff --git a/doc/ref/while_d_macros.html b/doc/ref/while_d_macros.html deleted file mode 100644 index 7d8a945..0000000 --- a/doc/ref/while_d_macros.html +++ /dev/null @@ -1,86 +0,0 @@ - - - - BOOST_PP_WHILE_d_macros - - - This is a list, based on functionality, of the macros which have an - alternate _d name, representing a reentry into the BOOST_PP_WHILE - looping construct:
    -
    - arithmetic
    - - array
    - - comparison
    - - control
    - - list
    -
      -
    - - selection
    - - repetition
    - - tuple
    - - base
    - -
    -
    -
    © Copyright Edward Diener 2014
    -
    -

    Distributed under the Boost Software License, Version 1.0. (See - accompanying file LICENSE_1_0.txt - or copy at www.boost.org/LICENSE_1_0.txt)

    -
    - - diff --git a/include/boost/preprocessor/array/detail/get_data.hpp b/include/boost/preprocessor/array/detail/get_data.hpp deleted file mode 100644 index fafa498..0000000 --- a/include/boost/preprocessor/array/detail/get_data.hpp +++ /dev/null @@ -1,50 +0,0 @@ -# /* ************************************************************************** -# * * -# * (C) Copyright Edward Diener 2014. * -# * 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_ARRAY_DETAIL_GET_DATA_HPP -# define BOOST_PREPROCESSOR_ARRAY_DETAIL_GET_DATA_HPP -# -# include -# include -# -# if BOOST_PP_VARIADICS && BOOST_PP_VARIADICS_MSVC && _MSC_VER > 1400 -# include -# include -# include -# include -# -# /* BOOST_PP_ARRAY_DETAIL_GET_DATA */ -# -# define BOOST_PP_ARRAY_DETAIL_GET_DATA_SINGLE(size, data) BOOST_PP_TUPLE_REM_CAT(size) data -# define BOOST_PP_ARRAY_DETAIL_GET_DATA_ANY(size, data) BOOST_PP_TUPLE_REM(size) data -# define BOOST_PP_ARRAY_DETAIL_GET_DATA_CHECK_ZERO(size, data) \ - BOOST_PP_IF \ - ( \ - size, \ - BOOST_PP_ARRAY_DETAIL_GET_DATA_ANY, \ - BOOST_PP_ARRAY_DETAIL_GET_DATA_SINGLE \ - ) \ - (size,data) \ -/**/ -# define BOOST_PP_ARRAY_DETAIL_GET_DATA(size, data) \ - BOOST_PP_IIF \ - ( \ - BOOST_PP_IS_1(size), \ - BOOST_PP_ARRAY_DETAIL_GET_DATA_SINGLE, \ - BOOST_PP_ARRAY_DETAIL_GET_DATA_CHECK_ZERO \ - ) \ - (size,data) \ -/**/ -# else -# define BOOST_PP_ARRAY_DETAIL_GET_DATA(size, data) BOOST_PP_TUPLE_REM(size) data -# endif /* BOOST_PP_VARIADICS && BOOST_PP_VARIADICS_MSVC && _MSC_VER > 1400 */ -# -# endif /* BOOST_PREPROCESSOR_ARRAY_DETAIL_GET_DATA_HPP */ diff --git a/include/boost/preprocessor/array/push_back.hpp b/include/boost/preprocessor/array/push_back.hpp index 5dce9e0..6d98d8e 100644 --- a/include/boost/preprocessor/array/push_back.hpp +++ b/include/boost/preprocessor/array/push_back.hpp @@ -1,7 +1,6 @@ # /* ************************************************************************** # * * # * (C) Copyright Paul Mensonides 2002. -# * (C) Copyright Edward Diener 2014. # * 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) @@ -19,7 +18,6 @@ # include # include # include -# include # # /* BOOST_PP_ARRAY_PUSH_BACK */ # @@ -30,6 +28,6 @@ # define BOOST_PP_ARRAY_PUSH_BACK_D(array, elem) BOOST_PP_ARRAY_PUSH_BACK_I(BOOST_PP_ARRAY_SIZE(array), BOOST_PP_ARRAY_DATA(array), elem) # endif # -# define BOOST_PP_ARRAY_PUSH_BACK_I(size, data, elem) (BOOST_PP_INC(size), (BOOST_PP_ARRAY_DETAIL_GET_DATA(size,data) BOOST_PP_COMMA_IF(size) elem)) +# define BOOST_PP_ARRAY_PUSH_BACK_I(size, data, elem) (BOOST_PP_INC(size), (BOOST_PP_TUPLE_REM(size) data BOOST_PP_COMMA_IF(size) elem)) # # endif diff --git a/include/boost/preprocessor/array/push_front.hpp b/include/boost/preprocessor/array/push_front.hpp index a6c6dc7..59344c3 100644 --- a/include/boost/preprocessor/array/push_front.hpp +++ b/include/boost/preprocessor/array/push_front.hpp @@ -1,7 +1,6 @@ # /* ************************************************************************** # * * # * (C) Copyright Paul Mensonides 2002. -# * (C) Copyright Edward Diener 2014. # * 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) @@ -19,7 +18,6 @@ # include # include # include -# include # # /* BOOST_PP_ARRAY_PUSH_FRONT */ # @@ -30,6 +28,6 @@ # define BOOST_PP_ARRAY_PUSH_FRONT_D(array, elem) BOOST_PP_ARRAY_PUSH_FRONT_I(BOOST_PP_ARRAY_SIZE(array), BOOST_PP_ARRAY_DATA(array), elem) # endif # -# define BOOST_PP_ARRAY_PUSH_FRONT_I(size, data, elem) (BOOST_PP_INC(size), (elem BOOST_PP_COMMA_IF(size) BOOST_PP_ARRAY_DETAIL_GET_DATA(size,data))) +# define BOOST_PP_ARRAY_PUSH_FRONT_I(size, data, elem) (BOOST_PP_INC(size), (elem BOOST_PP_COMMA_IF(size) BOOST_PP_TUPLE_REM(size) data)) # # endif diff --git a/include/boost/preprocessor/array/to_list.hpp b/include/boost/preprocessor/array/to_list.hpp index 4cb45b6..9198561 100644 --- a/include/boost/preprocessor/array/to_list.hpp +++ b/include/boost/preprocessor/array/to_list.hpp @@ -15,33 +15,19 @@ # # include # include -# include -# include # include # # /* BOOST_PP_ARRAY_TO_LIST */ # -# define BOOST_PP_ARRAY_TO_LIST(array) \ - BOOST_PP_IF \ - ( \ - BOOST_PP_ARRAY_SIZE(array), \ - BOOST_PP_ARRAY_TO_LIST_DO, \ - BOOST_PP_ARRAY_TO_LIST_EMPTY \ - ) \ - (array) \ -/**/ -# -# define BOOST_PP_ARRAY_TO_LIST_EMPTY(array) BOOST_PP_NIL -# # if BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MSVC() -# define BOOST_PP_ARRAY_TO_LIST_DO(array) BOOST_PP_ARRAY_TO_LIST_I(BOOST_PP_TUPLE_TO_LIST, array) +# define BOOST_PP_ARRAY_TO_LIST(array) BOOST_PP_ARRAY_TO_LIST_I(BOOST_PP_TUPLE_TO_LIST, array) # define BOOST_PP_ARRAY_TO_LIST_I(m, args) BOOST_PP_ARRAY_TO_LIST_II(m, args) # define BOOST_PP_ARRAY_TO_LIST_II(m, args) BOOST_PP_CAT(m ## args,) # elif BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MWCC() -# define BOOST_PP_ARRAY_TO_LIST_DO(array) BOOST_PP_ARRAY_TO_LIST_I(array) +# define BOOST_PP_ARRAY_TO_LIST(array) BOOST_PP_ARRAY_TO_LIST_I(array) # define BOOST_PP_ARRAY_TO_LIST_I(array) BOOST_PP_TUPLE_TO_LIST ## array # else -# define BOOST_PP_ARRAY_TO_LIST_DO(array) BOOST_PP_TUPLE_TO_LIST array +# define BOOST_PP_ARRAY_TO_LIST(array) BOOST_PP_TUPLE_TO_LIST array # endif # # endif diff --git a/include/boost/preprocessor/array/to_seq.hpp b/include/boost/preprocessor/array/to_seq.hpp index 7303f34..ebcae53 100644 --- a/include/boost/preprocessor/array/to_seq.hpp +++ b/include/boost/preprocessor/array/to_seq.hpp @@ -15,32 +15,19 @@ # # include # include -# include -# include # include # # /* BOOST_PP_ARRAY_TO_SEQ */ # -# define BOOST_PP_ARRAY_TO_SEQ(array) \ - BOOST_PP_IF \ - ( \ - BOOST_PP_ARRAY_SIZE(array), \ - BOOST_PP_ARRAY_TO_SEQ_DO, \ - BOOST_PP_ARRAY_TO_SEQ_EMPTY \ - ) \ - (array) \ -/**/ -# define BOOST_PP_ARRAY_TO_SEQ_EMPTY(array) -# # if BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MSVC() -# define BOOST_PP_ARRAY_TO_SEQ_DO(array) BOOST_PP_ARRAY_TO_SEQ_I(BOOST_PP_TUPLE_TO_SEQ, array) +# define BOOST_PP_ARRAY_TO_SEQ(array) BOOST_PP_ARRAY_TO_SEQ_I(BOOST_PP_TUPLE_TO_SEQ, array) # define BOOST_PP_ARRAY_TO_SEQ_I(m, args) BOOST_PP_ARRAY_TO_SEQ_II(m, args) # define BOOST_PP_ARRAY_TO_SEQ_II(m, args) BOOST_PP_CAT(m ## args,) # elif BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MWCC() -# define BOOST_PP_ARRAY_TO_SEQ_DO(array) BOOST_PP_ARRAY_TO_SEQ_I(array) +# define BOOST_PP_ARRAY_TO_SEQ(array) BOOST_PP_ARRAY_TO_SEQ_I(array) # define BOOST_PP_ARRAY_TO_SEQ_I(array) BOOST_PP_TUPLE_TO_SEQ ## array # else -# define BOOST_PP_ARRAY_TO_SEQ_DO(array) BOOST_PP_TUPLE_TO_SEQ array +# define BOOST_PP_ARRAY_TO_SEQ(array) BOOST_PP_TUPLE_TO_SEQ array # endif # # endif diff --git a/include/boost/preprocessor/array/to_tuple.hpp b/include/boost/preprocessor/array/to_tuple.hpp index 0d8defa..eb83274 100644 --- a/include/boost/preprocessor/array/to_tuple.hpp +++ b/include/boost/preprocessor/array/to_tuple.hpp @@ -14,20 +14,9 @@ # define BOOST_PREPROCESSOR_ARRAY_TO_TUPLE_HPP # # include -# include -# include # # /* BOOST_PP_ARRAY_TO_TUPLE */ # -# define BOOST_PP_ARRAY_TO_TUPLE(array) \ - BOOST_PP_IF \ - ( \ - BOOST_PP_ARRAY_SIZE(array), \ - BOOST_PP_ARRAY_DATA, \ - BOOST_PP_ARRAY_TO_TUPLE_EMPTY \ - ) \ - (array) \ -/**/ -# define BOOST_PP_ARRAY_TO_TUPLE_EMPTY(array) +# define BOOST_PP_ARRAY_TO_TUPLE BOOST_PP_ARRAY_DATA # # endif diff --git a/include/boost/preprocessor/facilities/detail/is_empty.hpp b/include/boost/preprocessor/facilities/detail/is_empty.hpp deleted file mode 100644 index e044970..0000000 --- a/include/boost/preprocessor/facilities/detail/is_empty.hpp +++ /dev/null @@ -1,55 +0,0 @@ -# /* ************************************************************************** -# * * -# * (C) Copyright Edward Diener 2014. -# * 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_DETAIL_IS_EMPTY_HPP -#define BOOST_PREPROCESSOR_DETAIL_IS_EMPTY_HPP - -#include - -#if BOOST_PP_VARIADICS_MSVC - -# pragma warning(once:4002) - -#define BOOST_PP_DETAIL_IS_EMPTY_IIF_0(t, b) b -#define BOOST_PP_DETAIL_IS_EMPTY_IIF_1(t, b) t - -#else - -#define BOOST_PP_DETAIL_IS_EMPTY_IIF_0(t, ...) __VA_ARGS__ -#define BOOST_PP_DETAIL_IS_EMPTY_IIF_1(t, ...) t - -#endif - -#if BOOST_PP_VARIADICS_MSVC && _MSC_VER <= 1400 - -#define BOOST_PP_DETAIL_IS_EMPTY_PROCESS(param) \ - BOOST_PP_IS_BEGIN_PARENS \ - ( \ - BOOST_PP_DETAIL_IS_EMPTY_NON_FUNCTION_C param () \ - ) \ -/**/ - -#else - -#define BOOST_PP_DETAIL_IS_EMPTY_PROCESS(...) \ - BOOST_PP_IS_BEGIN_PARENS \ - ( \ - BOOST_PP_DETAIL_IS_EMPTY_NON_FUNCTION_C __VA_ARGS__ () \ - ) \ -/**/ - -#endif - -#define BOOST_PP_DETAIL_IS_EMPTY_PRIMITIVE_CAT(a, b) a ## b -#define BOOST_PP_DETAIL_IS_EMPTY_IIF(bit) BOOST_PP_DETAIL_IS_EMPTY_PRIMITIVE_CAT(BOOST_PP_DETAIL_IS_EMPTY_IIF_,bit) -#define BOOST_PP_DETAIL_IS_EMPTY_NON_FUNCTION_C(...) () - -#endif /* BOOST_PREPROCESSOR_DETAIL_IS_EMPTY_HPP */ diff --git a/include/boost/preprocessor/facilities/empty.hpp b/include/boost/preprocessor/facilities/empty.hpp index 6f215dc..46db190 100644 --- a/include/boost/preprocessor/facilities/empty.hpp +++ b/include/boost/preprocessor/facilities/empty.hpp @@ -14,8 +14,6 @@ # ifndef BOOST_PREPROCESSOR_FACILITIES_EMPTY_HPP # define BOOST_PREPROCESSOR_FACILITIES_EMPTY_HPP # -# include -# # /* BOOST_PP_EMPTY */ # # define BOOST_PP_EMPTY() diff --git a/include/boost/preprocessor/facilities/is_empty.hpp b/include/boost/preprocessor/facilities/is_empty.hpp index 1e0fbb2..638265c 100644 --- a/include/boost/preprocessor/facilities/is_empty.hpp +++ b/include/boost/preprocessor/facilities/is_empty.hpp @@ -1,7 +1,6 @@ # /* ************************************************************************** # * * # * (C) Copyright Paul Mensonides 2003. -# * (C) Copyright Edward Diener 2014. # * 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) @@ -14,21 +13,17 @@ # define BOOST_PREPROCESSOR_FACILITIES_IS_EMPTY_HPP # # include -# -# if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MSVC() && ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MWCC() -# include -# include -# else # include +# include +# include # include -# endif # # /* BOOST_PP_IS_EMPTY */ # # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MSVC() && ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MWCC() # define BOOST_PP_IS_EMPTY(x) BOOST_PP_IS_EMPTY_I(x BOOST_PP_IS_EMPTY_HELPER) # define BOOST_PP_IS_EMPTY_I(contents) BOOST_PP_TUPLE_ELEM(2, 1, (BOOST_PP_IS_EMPTY_DEF_ ## contents())) -# define BOOST_PP_IS_EMPTY_DEF_BOOST_PP_IS_EMPTY_HELPER 1, BOOST_PP_IDENTITY(1) +# define BOOST_PP_IS_EMPTY_DEF_BOOST_PP_IS_EMPTY_HELPER 1, 1 BOOST_PP_EMPTY # define BOOST_PP_IS_EMPTY_HELPER() , 0 # else # if BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MSVC() @@ -45,4 +40,4 @@ # define BOOST_PP_IS_EMPTY_DEF_BOOST_PP_IS_EMPTY_HELPER 0, BOOST_PP_NIL # endif # -# endif /* BOOST_PREPROCESSOR_FACILITIES_IS_EMPTY_HPP */ +# endif diff --git a/include/boost/preprocessor/facilities/is_empty_or_1.hpp b/include/boost/preprocessor/facilities/is_empty_or_1.hpp index 815666f..baa5da9 100644 --- a/include/boost/preprocessor/facilities/is_empty_or_1.hpp +++ b/include/boost/preprocessor/facilities/is_empty_or_1.hpp @@ -14,7 +14,6 @@ # # include # include -# include # include # include # @@ -23,7 +22,7 @@ # define BOOST_PP_IS_EMPTY_OR_1(x) \ BOOST_PP_IIF( \ BOOST_PP_IS_EMPTY(x BOOST_PP_EMPTY()), \ - BOOST_PP_IDENTITY(1), \ + 1 BOOST_PP_EMPTY, \ BOOST_PP_IS_1 \ )(x) \ /**/ diff --git a/include/boost/preprocessor/facilities/is_empty_variadic.hpp b/include/boost/preprocessor/facilities/is_empty_variadic.hpp deleted file mode 100644 index eee4062..0000000 --- a/include/boost/preprocessor/facilities/is_empty_variadic.hpp +++ /dev/null @@ -1,57 +0,0 @@ -# /* ************************************************************************** -# * * -# * (C) Copyright Edward Diener 2014. -# * 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_FACILITIES_IS_EMPTY_VARIADIC_HPP -# define BOOST_PREPROCESSOR_FACILITIES_IS_EMPTY_VARIADIC_HPP -# -# include -# -# if BOOST_PP_VARIADICS -# -# include -# include -# -#if BOOST_PP_VARIADICS_MSVC && _MSC_VER <= 1400 -# -#define BOOST_PP_IS_EMPTY(param) \ - BOOST_PP_DETAIL_IS_EMPTY_IIF \ - ( \ - BOOST_PP_IS_BEGIN_PARENS \ - ( \ - param \ - ) \ - ) \ - ( \ - BOOST_PP_IS_EMPTY_ZERO, \ - BOOST_PP_DETAIL_IS_EMPTY_PROCESS \ - ) \ - (param) \ -/**/ -#define BOOST_PP_IS_EMPTY_ZERO(param) 0 -# else -#define BOOST_PP_IS_EMPTY(...) \ - BOOST_PP_DETAIL_IS_EMPTY_IIF \ - ( \ - BOOST_PP_IS_BEGIN_PARENS \ - ( \ - __VA_ARGS__ \ - ) \ - ) \ - ( \ - BOOST_PP_IS_EMPTY_ZERO, \ - BOOST_PP_DETAIL_IS_EMPTY_PROCESS \ - ) \ - (__VA_ARGS__) \ -/**/ -#define BOOST_PP_IS_EMPTY_ZERO(...) 0 -# endif /* BOOST_PP_VARIADICS_MSVC && _MSC_VER <= 1400 */ -# endif /* BOOST_PP_VARIADICS */ -# endif /* BOOST_PREPROCESSOR_FACILITIES_IS_EMPTY_VARIADIC_HPP */ diff --git a/include/boost/preprocessor/list/to_array.hpp b/include/boost/preprocessor/list/to_array.hpp index bd44d68..83f8a63 100644 --- a/include/boost/preprocessor/list/to_array.hpp +++ b/include/boost/preprocessor/list/to_array.hpp @@ -1,7 +1,6 @@ # /* ************************************************************************** # * * -# * (C) Copyright Paul Mensonides 2011. -# * (C) Copyright Edward Diener 2011,2014. +# * (C) Copyright Edward Diener 2011. # * 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) @@ -20,28 +19,10 @@ # include # include # include -# include -# if BOOST_PP_VARIADICS && BOOST_PP_VARIADICS_MSVC && (_MSC_VER <= 1400) -# include -# endif # # /* BOOST_PP_LIST_TO_ARRAY */ # -# if BOOST_PP_VARIADICS && BOOST_PP_VARIADICS_MSVC && (_MSC_VER <= 1400) -# define BOOST_PP_LIST_TO_ARRAY(list) \ - BOOST_PP_IIF \ - ( \ - BOOST_PP_LIST_IS_NIL(list), \ - BOOST_PP_LIST_TO_ARRAY_VC8ORLESS_EMPTY, \ - BOOST_PP_LIST_TO_ARRAY_VC8ORLESS_DO \ - ) \ - (list) \ -/**/ -# define BOOST_PP_LIST_TO_ARRAY_VC8ORLESS_EMPTY(list) (0,()) -# define BOOST_PP_LIST_TO_ARRAY_VC8ORLESS_DO(list) BOOST_PP_LIST_TO_ARRAY_I(BOOST_PP_WHILE, list) -# else # define BOOST_PP_LIST_TO_ARRAY(list) BOOST_PP_LIST_TO_ARRAY_I(BOOST_PP_WHILE, list) -# endif # if BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MSVC() # define BOOST_PP_LIST_TO_ARRAY_I(w, list) \ @@ -133,24 +114,10 @@ # endif # define BOOST_PP_LIST_TO_ARRAY_P(d, state) BOOST_PP_LIST_IS_CONS(BOOST_PP_TUPLE_ELEM(3, 0, state)) # define BOOST_PP_LIST_TO_ARRAY_O(d, state) BOOST_PP_LIST_TO_ARRAY_O_I state -# define BOOST_PP_LIST_TO_ARRAY_O_I(list, size, tuple) (BOOST_PP_LIST_REST(list), BOOST_PP_INC(size), (BOOST_PP_ARRAY_DETAIL_GET_DATA(size,tuple), BOOST_PP_LIST_FIRST(list))) +# define BOOST_PP_LIST_TO_ARRAY_O_I(list, size, tuple) (BOOST_PP_LIST_REST(list), BOOST_PP_INC(size), (BOOST_PP_TUPLE_REM(size) tuple, BOOST_PP_LIST_FIRST(list))) # # /* BOOST_PP_LIST_TO_ARRAY_D */ # -# if BOOST_PP_VARIADICS && BOOST_PP_VARIADICS_MSVC && (_MSC_VER <= 1400) -# define BOOST_PP_LIST_TO_ARRAY_D(d, list) \ - BOOST_PP_IIF \ - ( \ - BOOST_PP_LIST_IS_NIL(list), \ - BOOST_PP_LIST_TO_ARRAY_D_VC8ORLESS_EMPTY, \ - BOOST_PP_LIST_TO_ARRAY_D_VC8ORLESS_DO \ - ) \ - (d, list) \ -/**/ -# define BOOST_PP_LIST_TO_ARRAY_D_VC8ORLESS_EMPTY(d, list) (0,()) -# define BOOST_PP_LIST_TO_ARRAY_D_VC8ORLESS_DO(d, list) BOOST_PP_LIST_TO_ARRAY_I(BOOST_PP_WHILE_ ## d, list) -# else # define BOOST_PP_LIST_TO_ARRAY_D(d, list) BOOST_PP_LIST_TO_ARRAY_I(BOOST_PP_WHILE_ ## d, list) -# endif # # endif /* BOOST_PREPROCESSOR_LIST_TO_ARRAY_HPP */ diff --git a/include/boost/preprocessor/list/to_tuple.hpp b/include/boost/preprocessor/list/to_tuple.hpp index c7b3da8..557de36 100644 --- a/include/boost/preprocessor/list/to_tuple.hpp +++ b/include/boost/preprocessor/list/to_tuple.hpp @@ -16,45 +16,22 @@ # # include # include -# include # # /* BOOST_PP_LIST_TO_TUPLE */ # -# define BOOST_PP_LIST_TO_TUPLE(list) \ - BOOST_PP_IIF \ - ( \ - BOOST_PP_LIST_IS_NIL(list), \ - BOOST_PP_LIST_TO_TUPLE_EMPTY, \ - BOOST_PP_LIST_TO_TUPLE_DO \ - ) \ - (list) \ -/**/ -# define BOOST_PP_LIST_TO_TUPLE_EMPTY(list) -# # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG() -# define BOOST_PP_LIST_TO_TUPLE_DO(list) (BOOST_PP_LIST_ENUM(list)) +# define BOOST_PP_LIST_TO_TUPLE(list) (BOOST_PP_LIST_ENUM(list)) # else -# define BOOST_PP_LIST_TO_TUPLE_DO(list) BOOST_PP_LIST_TO_TUPLE_I(list) +# define BOOST_PP_LIST_TO_TUPLE(list) BOOST_PP_LIST_TO_TUPLE_I(list) # define BOOST_PP_LIST_TO_TUPLE_I(list) (BOOST_PP_LIST_ENUM(list)) # endif # # /* BOOST_PP_LIST_TO_TUPLE_R */ # -# define BOOST_PP_LIST_TO_TUPLE_R(r, list) \ - BOOST_PP_IIF \ - ( \ - BOOST_PP_LIST_IS_NIL(list), \ - BOOST_PP_LIST_TO_TUPLE_R_EMPTY, \ - BOOST_PP_LIST_TO_TUPLE_R_DO \ - ) \ - (r, list) \ -/**/ -# define BOOST_PP_LIST_TO_TUPLE_R_EMPTY(r,list) -# # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG() -# define BOOST_PP_LIST_TO_TUPLE_R_DO(r, list) (BOOST_PP_LIST_ENUM_R(r, list)) +# define BOOST_PP_LIST_TO_TUPLE_R(r, list) (BOOST_PP_LIST_ENUM_R(r, list)) # else -# define BOOST_PP_LIST_TO_TUPLE_R_DO(r, list) BOOST_PP_LIST_TO_TUPLE_R_I(r, list) +# define BOOST_PP_LIST_TO_TUPLE_R(r, list) BOOST_PP_LIST_TO_TUPLE_R_I(r, list) # define BOOST_PP_LIST_TO_TUPLE_R_I(r, list) (BOOST_PP_LIST_ENUM_R(r, list)) # endif # diff --git a/include/boost/preprocessor/punctuation.hpp b/include/boost/preprocessor/punctuation.hpp index 56dd064..72da73e 100644 --- a/include/boost/preprocessor/punctuation.hpp +++ b/include/boost/preprocessor/punctuation.hpp @@ -14,9 +14,7 @@ # # include # include -# include # include # include -# include # # endif diff --git a/include/boost/preprocessor/punctuation/detail/is_begin_parens.hpp b/include/boost/preprocessor/punctuation/detail/is_begin_parens.hpp deleted file mode 100644 index c94ccf3..0000000 --- a/include/boost/preprocessor/punctuation/detail/is_begin_parens.hpp +++ /dev/null @@ -1,48 +0,0 @@ -# /* ************************************************************************** -# * * -# * (C) Copyright Edward Diener 2014. -# * 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_DETAIL_IS_BEGIN_PARENS_HPP -#define BOOST_PREPROCESSOR_DETAIL_IS_BEGIN_PARENS_HPP - -#if BOOST_PP_VARIADICS_MSVC - -#include - -#define BOOST_PP_DETAIL_VD_IBP_CAT(a, b) BOOST_PP_DETAIL_VD_IBP_CAT_I(a, b) -#define BOOST_PP_DETAIL_VD_IBP_CAT_I(a, b) BOOST_PP_DETAIL_VD_IBP_CAT_II(a ## b) -#define BOOST_PP_DETAIL_VD_IBP_CAT_II(res) res - -#define BOOST_PP_DETAIL_IBP_SPLIT(i, ...) \ - BOOST_PP_DETAIL_VD_IBP_CAT(BOOST_PP_DETAIL_IBP_PRIMITIVE_CAT(BOOST_PP_DETAIL_IBP_SPLIT_,i)(__VA_ARGS__),BOOST_PP_EMPTY()) \ -/**/ - -#define BOOST_PP_DETAIL_IBP_IS_VARIADIC_C(...) 1 1 - -#else - -#define BOOST_PP_DETAIL_IBP_SPLIT(i, ...) \ - BOOST_PP_DETAIL_IBP_PRIMITIVE_CAT(BOOST_PP_DETAIL_IBP_SPLIT_,i)(__VA_ARGS__) \ -/**/ - -#define BOOST_PP_DETAIL_IBP_IS_VARIADIC_C(...) 1 - -#endif /* BOOST_PP_VARIADICS_MSVC */ - -#define BOOST_PP_DETAIL_IBP_SPLIT_0(a, ...) a -#define BOOST_PP_DETAIL_IBP_SPLIT_1(a, ...) __VA_ARGS__ - -#define BOOST_PP_DETAIL_IBP_CAT(a, ...) BOOST_PP_DETAIL_IBP_PRIMITIVE_CAT(a,__VA_ARGS__) -#define BOOST_PP_DETAIL_IBP_PRIMITIVE_CAT(a, ...) a ## __VA_ARGS__ - -#define BOOST_PP_DETAIL_IBP_IS_VARIADIC_R_1 1, -#define BOOST_PP_DETAIL_IBP_IS_VARIADIC_R_BOOST_PP_DETAIL_IBP_IS_VARIADIC_C 0, - -#endif /* BOOST_PREPROCESSOR_DETAIL_IS_BEGIN_PARENS_HPP */ diff --git a/include/boost/preprocessor/punctuation/is_begin_parens.hpp b/include/boost/preprocessor/punctuation/is_begin_parens.hpp deleted file mode 100644 index 20b32bc..0000000 --- a/include/boost/preprocessor/punctuation/is_begin_parens.hpp +++ /dev/null @@ -1,51 +0,0 @@ -# /* ************************************************************************** -# * * -# * (C) Copyright Edward Diener 2014. -# * 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_IS_BEGIN_PARENS_HPP -# define BOOST_PREPROCESSOR_IS_BEGIN_PARENS_HPP - -# include - -#if BOOST_PP_VARIADICS - -#include - -#if BOOST_PP_VARIADICS_MSVC && _MSC_VER <= 1400 - -#define BOOST_PP_IS_BEGIN_PARENS(param) \ - BOOST_PP_DETAIL_IBP_SPLIT \ - ( \ - 0, \ - BOOST_PP_DETAIL_IBP_CAT \ - ( \ - BOOST_PP_DETAIL_IBP_IS_VARIADIC_R_, \ - BOOST_PP_DETAIL_IBP_IS_VARIADIC_C param \ - ) \ - ) \ -/**/ - -#else - -#define BOOST_PP_IS_BEGIN_PARENS(...) \ - BOOST_PP_DETAIL_IBP_SPLIT \ - ( \ - 0, \ - BOOST_PP_DETAIL_IBP_CAT \ - ( \ - BOOST_PP_DETAIL_IBP_IS_VARIADIC_R_, \ - BOOST_PP_DETAIL_IBP_IS_VARIADIC_C __VA_ARGS__ \ - ) \ - ) \ -/**/ - -#endif /* BOOST_PP_VARIADICS_MSVC && _MSC_VER <= 1400 */ -#endif /* BOOST_PP_VARIADICS */ -#endif /* BOOST_PREPROCESSOR_IS_BEGIN_PARENS_HPP */ diff --git a/include/boost/preprocessor/punctuation/remove_parens.hpp b/include/boost/preprocessor/punctuation/remove_parens.hpp deleted file mode 100644 index 4700936..0000000 --- a/include/boost/preprocessor/punctuation/remove_parens.hpp +++ /dev/null @@ -1,39 +0,0 @@ -# /* ************************************************************************** -# * * -# * (C) Copyright Edward Diener 2014. -# * 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_REMOVE_PARENS_HPP -#define BOOST_PREPROCESSOR_REMOVE_PARENS_HPP - -#include - -#if BOOST_PP_VARIADICS - -#include -#include -#include -#include - -#define BOOST_PP_REMOVE_PARENS(param) \ - BOOST_PP_IIF \ - ( \ - BOOST_PP_IS_BEGIN_PARENS(param), \ - BOOST_PP_REMOVE_PARENS_DO, \ - BOOST_PP_IDENTITY \ - ) \ - (param)() \ -/**/ - -#define BOOST_PP_REMOVE_PARENS_DO(param) \ - BOOST_PP_IDENTITY(BOOST_PP_TUPLE_ENUM(param)) \ -/**/ - -#endif /* BOOST_PP_VARIADICS */ -#endif /* BOOST_PREPROCESSOR_REMOVE_PARENS_HPP */ diff --git a/include/boost/preprocessor/seq/detail/binary_transform.hpp b/include/boost/preprocessor/seq/detail/binary_transform.hpp index 1c381a7..373e8a5 100644 --- a/include/boost/preprocessor/seq/detail/binary_transform.hpp +++ b/include/boost/preprocessor/seq/detail/binary_transform.hpp @@ -16,9 +16,6 @@ # include # include # include -# if BOOST_PP_VARIADICS && BOOST_PP_VARIADICS_MSVC -# include -# endif # # /* BOOST_PP_SEQ_BINARY_TRANSFORM */ # @@ -31,15 +28,8 @@ # define BOOST_PP_SEQ_BINARY_TRANSFORM(seq) BOOST_PP_CAT(BOOST_PP_SEQ_BINARY_TRANSFORM_A seq, 0) # endif # if BOOST_PP_VARIADICS -# if BOOST_PP_VARIADICS_MSVC -# define BOOST_PP_SEQ_BINARY_TRANSFORM_GET_REM(...) \ - BOOST_PP_VARIADIC_IS_SINGLE_RETURN(BOOST_PP_REM_CAT,BOOST_PP_REM,__VA_ARGS__) \ - /**/ -# else -# define BOOST_PP_SEQ_BINARY_TRANSFORM_GET_REM(...) BOOST_PP_REM -# endif -# define BOOST_PP_SEQ_BINARY_TRANSFORM_A(...) (BOOST_PP_SEQ_BINARY_TRANSFORM_GET_REM(__VA_ARGS__), __VA_ARGS__)() BOOST_PP_SEQ_BINARY_TRANSFORM_B -# define BOOST_PP_SEQ_BINARY_TRANSFORM_B(...) (BOOST_PP_SEQ_BINARY_TRANSFORM_GET_REM(__VA_ARGS__), __VA_ARGS__)() BOOST_PP_SEQ_BINARY_TRANSFORM_A +# define BOOST_PP_SEQ_BINARY_TRANSFORM_A(...) (BOOST_PP_REM, __VA_ARGS__)() BOOST_PP_SEQ_BINARY_TRANSFORM_B +# define BOOST_PP_SEQ_BINARY_TRANSFORM_B(...) (BOOST_PP_REM, __VA_ARGS__)() BOOST_PP_SEQ_BINARY_TRANSFORM_A # else # define BOOST_PP_SEQ_BINARY_TRANSFORM_A(e) (BOOST_PP_REM, e)() BOOST_PP_SEQ_BINARY_TRANSFORM_B # define BOOST_PP_SEQ_BINARY_TRANSFORM_B(e) (BOOST_PP_REM, e)() BOOST_PP_SEQ_BINARY_TRANSFORM_A diff --git a/include/boost/preprocessor/seq/rest_n.hpp b/include/boost/preprocessor/seq/rest_n.hpp index 6423376..7e589cc 100644 --- a/include/boost/preprocessor/seq/rest_n.hpp +++ b/include/boost/preprocessor/seq/rest_n.hpp @@ -14,17 +14,17 @@ # # include # include -# include +# include # include # include # # /* 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_TUPLE_ELEM(2, 1, BOOST_PP_SEQ_SPLIT(BOOST_PP_INC(n), (nil) seq BOOST_PP_EMPTY))() # 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_TUPLE_ELEM(2, 1, BOOST_PP_SEQ_SPLIT(BOOST_PP_INC(n), (nil) seq BOOST_PP_EMPTY))() # endif # # endif diff --git a/include/boost/preprocessor/tuple/detail/is_single_return.hpp b/include/boost/preprocessor/tuple/detail/is_single_return.hpp deleted file mode 100644 index 9ffa3cc..0000000 --- a/include/boost/preprocessor/tuple/detail/is_single_return.hpp +++ /dev/null @@ -1,28 +0,0 @@ -# /* ************************************************************************** -# * * -# * (C) Copyright Edward Diener 2014. * -# * 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_TUPLE_DETAIL_IS_SINGLE_RETURN_HPP -# define BOOST_PREPROCESSOR_TUPLE_DETAIL_IS_SINGLE_RETURN_HPP -# -# include -# include -# include -# include -# -# /* BOOST_PP_TUPLE_IS_SINGLE_RETURN */ -# -# if BOOST_PP_VARIADICS && BOOST_PP_VARIADICS_MSVC -# define BOOST_PP_TUPLE_IS_SINGLE_RETURN(sr,nsr,tuple) \ - BOOST_PP_IIF(BOOST_PP_IS_1(BOOST_PP_TUPLE_SIZE(tuple)),sr,nsr) \ - /**/ -# endif /* BOOST_PP_VARIADICS && BOOST_PP_VARIADICS_MSVC */ -# -# endif /* BOOST_PREPROCESSOR_TUPLE_DETAIL_IS_SINGLE_RETURN_HPP */ diff --git a/include/boost/preprocessor/tuple/elem.hpp b/include/boost/preprocessor/tuple/elem.hpp index ee8f0bd..3eba1c5 100644 --- a/include/boost/preprocessor/tuple/elem.hpp +++ b/include/boost/preprocessor/tuple/elem.hpp @@ -8,7 +8,7 @@ # */ # # /* Revised by Paul Mensonides (2002-2011) */ -# /* Revised by Edward Diener (2011,2014) */ +# /* Revised by Edward Diener (2011) */ # # /* See http://www.boost.org for most recent version. */ # @@ -21,27 +21,15 @@ # include # include # -# if BOOST_PP_VARIADICS && BOOST_PP_VARIADICS_MSVC -# include -# endif -# # if BOOST_PP_VARIADICS # if BOOST_PP_VARIADICS_MSVC # define BOOST_PP_TUPLE_ELEM(...) BOOST_PP_TUPLE_ELEM_I(BOOST_PP_OVERLOAD(BOOST_PP_TUPLE_ELEM_O_, __VA_ARGS__), (__VA_ARGS__)) # define BOOST_PP_TUPLE_ELEM_I(m, args) BOOST_PP_TUPLE_ELEM_II(m, args) # define BOOST_PP_TUPLE_ELEM_II(m, args) BOOST_PP_CAT(m ## args,) -/* - Use BOOST_PP_REM_CAT if it is a single element tuple ( which might be empty ) - else use BOOST_PP_REM. This fixes a VC++ problem with an empty tuple and BOOST_PP_TUPLE_ELEM - functionality. See tuple_elem_bug_test.cxx. -*/ -# define BOOST_PP_TUPLE_ELEM_O_2(n, tuple) \ - BOOST_PP_VARIADIC_ELEM(n, BOOST_PP_TUPLE_IS_SINGLE_RETURN(BOOST_PP_REM_CAT,BOOST_PP_REM,tuple) tuple) \ - /**/ # else # define BOOST_PP_TUPLE_ELEM(...) BOOST_PP_OVERLOAD(BOOST_PP_TUPLE_ELEM_O_, __VA_ARGS__)(__VA_ARGS__) -# define BOOST_PP_TUPLE_ELEM_O_2(n, tuple) BOOST_PP_VARIADIC_ELEM(n, BOOST_PP_REM tuple) # endif +# define BOOST_PP_TUPLE_ELEM_O_2(n, tuple) BOOST_PP_VARIADIC_ELEM(n, BOOST_PP_REM tuple) # define BOOST_PP_TUPLE_ELEM_O_3(size, n, tuple) BOOST_PP_TUPLE_ELEM_O_2(n, tuple) # else # if BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MSVC() diff --git a/include/boost/preprocessor/tuple/rem.hpp b/include/boost/preprocessor/tuple/rem.hpp index 78e47fe..270c31a 100644 --- a/include/boost/preprocessor/tuple/rem.hpp +++ b/include/boost/preprocessor/tuple/rem.hpp @@ -16,17 +16,10 @@ # include # include # include -# if BOOST_PP_VARIADICS && BOOST_PP_VARIADICS_MSVC -# include -# endif # # /* BOOST_PP_REM */ # # if BOOST_PP_VARIADICS -# if BOOST_PP_VARIADICS_MSVC - /* To be used internally when __VA_ARGS__ is a single element */ -# define BOOST_PP_REM_CAT(...) BOOST_PP_CAT(__VA_ARGS__,) -# endif # define BOOST_PP_REM(...) __VA_ARGS__ # else # define BOOST_PP_REM(x) x @@ -37,11 +30,7 @@ /* VC++8.0 cannot handle the variadic version of BOOST_PP_TUPLE_REM(size) */ -# if BOOST_PP_VARIADICS && !(BOOST_PP_VARIADICS_MSVC && _MSC_VER <= 1400) -# if BOOST_PP_VARIADICS_MSVC - /* To be used internally when the size is 1 */ -# define BOOST_PP_TUPLE_REM_CAT(size) BOOST_PP_REM_CAT -# endif +# if BOOST_PP_VARIADICS && !(BOOST_PP_VARIADICS_MSVC && _MSC_VER == 1400) # define BOOST_PP_TUPLE_REM(size) BOOST_PP_REM # else # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MWCC() @@ -125,11 +114,10 @@ # define BOOST_PP_TUPLE_REM_CTOR(...) BOOST_PP_TUPLE_REM_CTOR_I(BOOST_PP_OVERLOAD(BOOST_PP_TUPLE_REM_CTOR_O_, __VA_ARGS__), (__VA_ARGS__)) # define BOOST_PP_TUPLE_REM_CTOR_I(m, args) BOOST_PP_TUPLE_REM_CTOR_II(m, args) # define BOOST_PP_TUPLE_REM_CTOR_II(m, args) BOOST_PP_CAT(m ## args,) -# define BOOST_PP_TUPLE_REM_CTOR_O_1(tuple) BOOST_PP_TUPLE_IS_SINGLE_RETURN(BOOST_PP_REM_CAT,BOOST_PP_REM,tuple) tuple # else # define BOOST_PP_TUPLE_REM_CTOR(...) BOOST_PP_OVERLOAD(BOOST_PP_TUPLE_REM_CTOR_O_, __VA_ARGS__)(__VA_ARGS__) -# define BOOST_PP_TUPLE_REM_CTOR_O_1(tuple) BOOST_PP_REM tuple # endif +# define BOOST_PP_TUPLE_REM_CTOR_O_1(tuple) BOOST_PP_REM tuple # define BOOST_PP_TUPLE_REM_CTOR_O_2(size, tuple) BOOST_PP_TUPLE_REM_CTOR_O_1(tuple) # else # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG() diff --git a/include/boost/preprocessor/tuple/to_seq.hpp b/include/boost/preprocessor/tuple/to_seq.hpp index a53f5a0..8bd8485 100644 --- a/include/boost/preprocessor/tuple/to_seq.hpp +++ b/include/boost/preprocessor/tuple/to_seq.hpp @@ -48,9 +48,6 @@ # endif # endif # -/* An empty array can be passed */ -# define BOOST_PP_TUPLE_TO_SEQ_0() () -# # define BOOST_PP_TUPLE_TO_SEQ_1(e0) (e0) # define BOOST_PP_TUPLE_TO_SEQ_2(e0, e1) (e0)(e1) # define BOOST_PP_TUPLE_TO_SEQ_3(e0, e1, e2) (e0)(e1)(e2) diff --git a/include/boost/preprocessor/variadic/detail/is_single_return.hpp b/include/boost/preprocessor/variadic/detail/is_single_return.hpp deleted file mode 100644 index 491e06b..0000000 --- a/include/boost/preprocessor/variadic/detail/is_single_return.hpp +++ /dev/null @@ -1,28 +0,0 @@ -# /* ************************************************************************** -# * * -# * (C) Copyright Edward Diener 2014. * -# * 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_VARIADIC_DETAIL_IS_SINGLE_RETURN_HPP -# define BOOST_PREPROCESSOR_VARIADIC_DETAIL_IS_SINGLE_RETURN_HPP -# -# include -# include -# include -# include -# -# /* BOOST_PP_VARIADIC_IS_SINGLE_RETURN */ -# -# if BOOST_PP_VARIADICS && BOOST_PP_VARIADICS_MSVC -# define BOOST_PP_VARIADIC_IS_SINGLE_RETURN(sr,nsr,...) \ - BOOST_PP_IIF(BOOST_PP_IS_1(BOOST_PP_VARIADIC_SIZE(__VA_ARGS__)),sr,nsr) \ - /**/ -# endif /* BOOST_PP_VARIADICS && BOOST_PP_VARIADICS_MSVC */ -# -# endif /* BOOST_PREPROCESSOR_VARIADIC_DETAIL_IS_SINGLE_RETURN_HPP */ diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index 5e91c86..92d1716 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -19,22 +19,21 @@ project preprocessor_tests : requirements on test-suite preprocessor : - [ compile arithmetic.cpp : gcc:-std=c++0x ] - [ compile array.cpp : gcc:-std=c++0x ] - [ compile comparison.cpp : gcc:-std=c++0x ] - [ compile control.cpp : gcc:-std=c++0x ] - [ compile debug.cpp : gcc:-std=c++0x ] - [ compile facilities.cpp : gcc:-std=c++0x ] - [ compile iteration.cpp : gcc:-std=c++0x ] - [ compile list.cpp : gcc:-std=c++0x ] - [ compile logical.cpp : gcc:-std=c++0x ] - [ compile punctuation.cpp : gcc:-std=c++0x ] - [ compile repetition.cpp : gcc:-std=c++0x ] - [ compile selection.cpp : gcc:-std=c++0x ] - [ compile seq.cpp : gcc:-std=c++0x ] - [ compile slot.cpp : gcc:-std=c++0x ] - [ compile tuple.cpp : gcc:-std=c++0x ] - [ compile variadic.cpp : gcc:-std=c++0x ] + [ compile arithmetic.cpp ] + [ compile array.cpp ] + [ compile comparison.cpp ] + [ compile control.cpp ] + [ compile debug.cpp ] + [ compile facilities.cpp ] + [ compile iteration.cpp ] + [ compile list.cpp ] + [ compile logical.cpp ] + [ compile repetition.cpp ] + [ compile selection.cpp ] + [ compile seq.cpp ] + [ compile slot.cpp ] + [ compile tuple.cpp ] + [ compile variadic.cpp ] ; test-suite preprocessor_nvm @@ -89,10 +88,6 @@ test-suite preprocessor_c : gcc:-std=c99 : logical_c ] - [ compile punctuation.c - : gcc:-std=c99 - : punctuation_c - ] [ compile selection.c : gcc:-std=c99 : selection_c @@ -178,40 +173,3 @@ test-suite preprocessor_c_nvm : tuple_c_nvm ] ; - -test-suite preprocessor_isempty - : - [ compile isempty.cpp : gcc:-std=c++0x ] - [ compile-fail isempty_variadic_standard_failure.cpp : gcc:-std=c++0x ] - [ compile-fail isempty_variadic_standard_failure2.cpp : gcc:-std=c++0x ] - ; - -test-suite preprocessor_isempty_nvm - : - [ compile isempty.cpp : BOOST_PP_VARIADICS=0 : isempty_nvm ] - ; - -test-suite preprocessor_isempty_c - : - [ compile isempty.c - : gcc:-std=c99 - : isempty_c - ] - [ compile-fail isempty_variadic_standard_failure.c - : gcc:-std=c99 - : isempty_variadic_standard_failure_c - ] - [ compile-fail isempty_variadic_standard_failure2.c - : gcc:-std=c99 - : isempty_variadic_standard_failure2_c - ] - ; - -test-suite preprocessor_isempty_c_nvm - : - [ compile isempty.c - : BOOST_PP_VARIADICS=0 - gcc:-std=c99 - : isempty_c_nvm - ] - ; diff --git a/test/array.cxx b/test/array.cxx index 745581d..ae3a275 100644 --- a/test/array.cxx +++ b/test/array.cxx @@ -13,19 +13,14 @@ # # include # include -# include # include -# include # include -# include # include -# include # if BOOST_PP_VARIADICS # include # include # endif -# define ARRAY_EMPTY (0, ()) # define ARRAY (3, (0, 1, 2)) # define ARRAY_LARGE (33, (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32)) # define ARRAY_VERY_LARGE (64, (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63)) @@ -47,7 +42,6 @@ BEGIN BOOST_PP_ARRAY_SIZE(ARRAY_LARGE) == 33 END BEGIN BOOST_PP_ARRAY_SIZE((33, (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32))) == 33 END BEGIN BOOST_PP_ARRAY_SIZE(ARRAY_VERY_LARGE) == 64 END BEGIN BOOST_PP_ARRAY_SIZE((64, (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63))) == 64 END -BEGIN BOOST_PP_ARRAY_SIZE(ARRAY_EMPTY) == 0 END // enum @@ -63,7 +57,6 @@ BEGIN BOOST_PP_VARIADIC_SIZE(BOOST_PP_ARRAY_ENUM((5, (0, 1, 2, 3, 4)))) == 5 END BEGIN BOOST_PP_VARIADIC_SIZE(BOOST_PP_ARRAY_ENUM(ARRAY_LARGE)) == 33 END BEGIN BOOST_PP_VARIADIC_SIZE(BOOST_PP_ARRAY_ENUM(ARRAY_VERY_LARGE)) == 64 END BEGIN BOOST_PP_VARIADIC_SIZE(BOOST_PP_ARRAY_ENUM((64, (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63)))) == 64 END -BEGIN BOOST_PP_VARIADIC_SIZE(BOOST_PP_ARRAY_ENUM(ARRAY_EMPTY)) == 1 END # endif @@ -73,7 +66,6 @@ BEGIN BOOST_PP_LIST_AT(BOOST_PP_ARRAY_TO_LIST(ARRAY), 1) == 1 END BEGIN BOOST_PP_LIST_AT(BOOST_PP_ARRAY_TO_LIST((5, (0, 1, 2, 3, 4))), 4) == 4 END BEGIN BOOST_PP_LIST_AT(BOOST_PP_ARRAY_TO_LIST((33, (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32))), 26) == 26 END BEGIN BOOST_PP_LIST_AT(BOOST_PP_ARRAY_TO_LIST(ARRAY_VERY_LARGE), 60) == 60 END -BEGIN BOOST_PP_LIST_SIZE(BOOST_PP_ARRAY_TO_LIST(ARRAY_EMPTY)) == 0 END // to_seq @@ -112,9 +104,6 @@ BEGIN BOOST_PP_ARRAY_ELEM(22, BOOST_PP_ARRAY_INSERT(ARRAY_LARGE,22,1000)) == 100 BEGIN BOOST_PP_ARRAY_ELEM(26, BOOST_PP_ARRAY_INSERT(ARRAY_LARGE,22,1000)) == 25 END BEGIN BOOST_PP_ARRAY_SIZE(BOOST_PP_ARRAY_INSERT(ARRAY_LARGE,22,1000)) == 34 END -BEGIN BOOST_PP_ARRAY_ELEM(0, BOOST_PP_ARRAY_INSERT(ARRAY_EMPTY,0,25)) == 25 END -BEGIN BOOST_PP_ARRAY_SIZE(BOOST_PP_ARRAY_INSERT(ARRAY_EMPTY,0,1000)) == 1 END - // pop_back BEGIN BOOST_PP_ARRAY_SIZE(BOOST_PP_ARRAY_POP_BACK(ARRAY)) == 2 END @@ -135,19 +124,15 @@ BEGIN BOOST_PP_ARRAY_ELEM(55, BOOST_PP_ARRAY_POP_FRONT(ARRAY_VERY_LARGE)) == 56 BEGIN BOOST_PP_ARRAY_SIZE(BOOST_PP_ARRAY_PUSH_BACK(ARRAY, 3)) == 4 END BEGIN BOOST_PP_ARRAY_SIZE(BOOST_PP_ARRAY_PUSH_BACK(ARRAY_LARGE, 33)) == 34 END -BEGIN BOOST_PP_ARRAY_SIZE(BOOST_PP_ARRAY_PUSH_BACK(ARRAY_EMPTY, 10)) == 1 END BEGIN BOOST_PP_ARRAY_ELEM(0, BOOST_PP_ARRAY_PUSH_BACK(ARRAY, 3)) == 0 END BEGIN BOOST_PP_ARRAY_ELEM(33, BOOST_PP_ARRAY_PUSH_BACK(ARRAY_LARGE, 33)) == 33 END -BEGIN BOOST_PP_ARRAY_ELEM(0, BOOST_PP_ARRAY_PUSH_BACK(ARRAY_EMPTY, 136)) == 136 END // push_front BEGIN BOOST_PP_ARRAY_SIZE(BOOST_PP_ARRAY_PUSH_FRONT(ARRAY, 555)) == 4 END BEGIN BOOST_PP_ARRAY_SIZE(BOOST_PP_ARRAY_PUSH_FRONT(ARRAY_LARGE, 666)) == 34 END -BEGIN BOOST_PP_ARRAY_SIZE(BOOST_PP_ARRAY_PUSH_FRONT(ARRAY_EMPTY, 10)) == 1 END BEGIN BOOST_PP_ARRAY_ELEM(0, BOOST_PP_ARRAY_PUSH_FRONT(ARRAY, 555)) == 555 END BEGIN BOOST_PP_ARRAY_ELEM(33, BOOST_PP_ARRAY_PUSH_FRONT(ARRAY_LARGE, 33)) == 32 END -BEGIN BOOST_PP_ARRAY_ELEM(0, BOOST_PP_ARRAY_PUSH_FRONT(ARRAY_EMPTY, 136)) == 136 END // remove @@ -172,4 +157,3 @@ BEGIN BOOST_PP_ARRAY_SIZE(BOOST_PP_ARRAY_REVERSE(ARRAY_VERY_LARGE)) == 64 END BEGIN BOOST_PP_ARRAY_ELEM(0, BOOST_PP_ARRAY_REVERSE(ARRAY)) == 2 END BEGIN BOOST_PP_ARRAY_ELEM(29, BOOST_PP_ARRAY_REVERSE(ARRAY_LARGE)) == 3 END BEGIN BOOST_PP_ARRAY_ELEM(38, BOOST_PP_ARRAY_REVERSE(ARRAY_VERY_LARGE)) == 25 END -BEGIN BOOST_PP_ARRAY_SIZE(BOOST_PP_ARRAY_REVERSE(ARRAY_EMPTY)) == 0 END diff --git a/test/isempty.c b/test/isempty.c deleted file mode 100644 index bd4c2c6..0000000 --- a/test/isempty.c +++ /dev/null @@ -1,12 +0,0 @@ -# /* ************************************************************************** -# * * -# * (C) Copyright Edward Diener 2014. -# * 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. */ -# -# include diff --git a/test/isempty.cpp b/test/isempty.cpp deleted file mode 100644 index bd4c2c6..0000000 --- a/test/isempty.cpp +++ /dev/null @@ -1,12 +0,0 @@ -# /* ************************************************************************** -# * * -# * (C) Copyright Edward Diener 2014. -# * 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. */ -# -# include diff --git a/test/isempty.cxx b/test/isempty.cxx deleted file mode 100644 index d0c3776..0000000 --- a/test/isempty.cxx +++ /dev/null @@ -1,145 +0,0 @@ -# /* ************************************************************************** -# * * -# * (C) Copyright Edward Diener 2014. -# * 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. */ -# -# include -# -#if (BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_STRICT()) || (BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MSVC()) - -# include -# include -# include - -#define DATA -#define OBJECT OBJECT2 -#define OBJECT2 -#define FUNC(x) FUNC2(x) -#define FUNC2(x) -#define FUNC_GEN() () -#define FUNC_GEN2(x) () -#define FUNC_GEN3() (&) -#define FUNC_GEN4(x) (y) -#define FUNC_GEN5() (y,z) -#define FUNC_GEN6() anything -#define FUNC_GEN7(x) anything -#define FUNC_GEN8(x,y) (1,2,3) -#define FUNC_GEN9(x,y,z) anything -#define FUNC_GEN10(x) (y) data -#define NAME &name -#define ATUPLE (atuple) -#define ATUPLE_PLUS (atuple) data - -#if BOOST_PP_VARIADICS - -#if defined(BOOST_PP_VARIADICS_MSVC) /* Testing the VC++ variadic version */ - -/* INCORRECT */ - -BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN) == 1 END -BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN2) == 1 END -BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN3) == 1 END -BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN4) == 1 END -BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN5) == 1 END -BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN8) == 1 END -BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN10) == 1 END - -/* CORRECT */ - -BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN9) == 0 END - -#else /* Testing the non-VC++ variadic version */ - -/* CORRECT */ - -BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN) == 0 END -BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN2) == 0 END -BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN3) == 0 END -BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN4) == 0 END -BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN5) == 0 END -BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN10) == 0 END - -/* COMPILER ERROR */ - -// BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN8) == 0 END -// BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN9) == 0 END - -#endif - -/* Testing the variadic version */ - -/* CORRECT */ - -BEGIN BOOST_PP_IS_EMPTY(BOOST_PP_EMPTY()) == 1 END -BEGIN BOOST_PP_IS_EMPTY(DATA BOOST_PP_EMPTY()) == 1 END -BEGIN BOOST_PP_IS_EMPTY(x BOOST_PP_EMPTY()) == 0 END -BEGIN BOOST_PP_IS_EMPTY(OBJECT BOOST_PP_EMPTY()) == 1 END -BEGIN BOOST_PP_IS_EMPTY(FUNC(z) BOOST_PP_EMPTY()) == 1 END -BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN6) == 0 END -BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN7) == 0 END -BEGIN BOOST_PP_IS_EMPTY(NAME) == 0 END -BEGIN BOOST_PP_IS_EMPTY(ATUPLE) == 0 END -BEGIN BOOST_PP_IS_EMPTY(ATUPLE_PLUS) == 0 END - -#else - -#if BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MSVC() /* Testing the VC++ non-variadic version */ - -/* INCORRECT */ - -BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN) == 1 END -BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN2) == 1 END -BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN3) == 1 END -BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN4) == 1 END -BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN5) == 1 END -BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN8) == 1 END -BEGIN BOOST_PP_IS_EMPTY(ATUPLE) == 1 END -BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN10) == 1 END -BEGIN BOOST_PP_IS_EMPTY(ATUPLE_PLUS) == 1 END - -/* CORRECT */ - -BEGIN BOOST_PP_IS_EMPTY(NAME) == 0 END - -#else /* Testing the non-VC++ non-variadic version */ - -/* CORRECT */ - -BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN) == 0 END -BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN2) == 0 END -BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN3) == 0 END -BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN4) == 0 END -BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN5) == 0 END -BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN8) == 0 END -BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN10) == 0 END - -/* UNDEFINED BEHAVIOR */ - -// BEGIN BOOST_PP_IS_EMPTY(ATUPLE) == 0 END -// BEGIN BOOST_PP_IS_EMPTY(ATUPLE_PLUS) == 1 END -// BEGIN BOOST_PP_IS_EMPTY(NAME) == 0 END - -#endif - -/* Testing the non-variadic version */ - -/* CORRECT */ - -BEGIN BOOST_PP_IS_EMPTY(BOOST_PP_EMPTY()) == 1 END -BEGIN BOOST_PP_IS_EMPTY(DATA BOOST_PP_EMPTY()) == 1 END -BEGIN BOOST_PP_IS_EMPTY(x BOOST_PP_EMPTY()) == 0 END -BEGIN BOOST_PP_IS_EMPTY(OBJECT BOOST_PP_EMPTY()) == 1 END -BEGIN BOOST_PP_IS_EMPTY(FUNC(z) BOOST_PP_EMPTY()) == 1 END -BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN6) == 0 END -BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN7) == 0 END -BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN9) == 0 END - -#endif - -#endif diff --git a/test/isempty_variadic_standard_failure.c b/test/isempty_variadic_standard_failure.c deleted file mode 100644 index 36f6ff7..0000000 --- a/test/isempty_variadic_standard_failure.c +++ /dev/null @@ -1,12 +0,0 @@ -# /* ************************************************************************** -# * * -# * (C) Copyright Edward Diener 2014. -# * 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. */ -# -# include diff --git a/test/isempty_variadic_standard_failure.cpp b/test/isempty_variadic_standard_failure.cpp deleted file mode 100644 index 36f6ff7..0000000 --- a/test/isempty_variadic_standard_failure.cpp +++ /dev/null @@ -1,12 +0,0 @@ -# /* ************************************************************************** -# * * -# * (C) Copyright Edward Diener 2014. -# * 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. */ -# -# include diff --git a/test/isempty_variadic_standard_failure.cxx b/test/isempty_variadic_standard_failure.cxx deleted file mode 100644 index bfbbc9d..0000000 --- a/test/isempty_variadic_standard_failure.cxx +++ /dev/null @@ -1,25 +0,0 @@ -# /* ************************************************************************** -# * * -# * (C) Copyright Edward Diener 2014. -# * 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. */ -# -# include -# include - -#if BOOST_PP_VARIADICS && (BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_STRICT()) && !defined(BOOST_PP_VARIADICS_MSVC) - -#define FUNC_GEN8(x,y) (1,2,3) - -BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN8) == 0 END - -#else - -BEGIN 1 == 0 END - -#endif diff --git a/test/isempty_variadic_standard_failure2.c b/test/isempty_variadic_standard_failure2.c deleted file mode 100644 index a2aa690..0000000 --- a/test/isempty_variadic_standard_failure2.c +++ /dev/null @@ -1,12 +0,0 @@ -# /* ************************************************************************** -# * * -# * (C) Copyright Edward Diener 2014. -# * 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. */ -# -# include diff --git a/test/isempty_variadic_standard_failure2.cpp b/test/isempty_variadic_standard_failure2.cpp deleted file mode 100644 index a2aa690..0000000 --- a/test/isempty_variadic_standard_failure2.cpp +++ /dev/null @@ -1,12 +0,0 @@ -# /* ************************************************************************** -# * * -# * (C) Copyright Edward Diener 2014. -# * 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. */ -# -# include diff --git a/test/isempty_variadic_standard_failure2.cxx b/test/isempty_variadic_standard_failure2.cxx deleted file mode 100644 index d730626..0000000 --- a/test/isempty_variadic_standard_failure2.cxx +++ /dev/null @@ -1,25 +0,0 @@ -# /* ************************************************************************** -# * * -# * (C) Copyright Edward Diener 2014. -# * 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. */ -# -# include -# include - -#if BOOST_PP_VARIADICS && (BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_STRICT()) && !defined(BOOST_PP_VARIADICS_MSVC) - -#define FUNC_GEN9(x,y,z) anything - -BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN9) == 0 END - -#else - -BEGIN 1 == 0 END - -#endif diff --git a/test/list.cxx b/test/list.cxx index 7c99d70..db6c432 100644 --- a/test/list.cxx +++ b/test/list.cxx @@ -16,27 +16,17 @@ # include # include # include -# include # include # include -# include # include -# include # include -# include # include # include # define LISTNIL BOOST_PP_NIL # define LIST (4, (1, (5, (2, BOOST_PP_NIL)))) + # define REVERSAL(d, x, y) BOOST_PP_SUB_D(d, y, x) -# define F1(r, state, x) + x + state -# define FI2(r, state, i, x) BOOST_PP_IIF(BOOST_PP_EQUAL(i,1),+ x + x + state,+ x + state) -# define F2(r, x) + BOOST_PP_TUPLE_ELEM(2, 0, x) + 2 - BOOST_PP_TUPLE_ELEM(2, 1, x) -# define L1 (0, (x, BOOST_PP_NIL)) -# define L2 (a, (1, (b, (2, BOOST_PP_NIL)))) -# define L3 (c, (3, (d, BOOST_PP_NIL))) -# define LL (L1, (L2, (L3, BOOST_PP_NIL))) BEGIN BOOST_PP_LIST_FIRST(LIST) == 4 END BEGIN BOOST_PP_LIST_IS_CONS(LIST) == 1 END @@ -51,28 +41,22 @@ BEGIN BOOST_PP_VARIADIC_ELEM(2,BOOST_PP_LIST_ENUM(LIST)) == 5 END #endif BEGIN BOOST_PP_LIST_FOLD_LEFT(BOOST_PP_SUB_D, 22, LIST) == 10 END -BEGIN BOOST_PP_LIST_FOLD_LEFT(BOOST_PP_SUB_D, 22, LISTNIL) == 22 END BEGIN BOOST_PP_LIST_FOLD_RIGHT(BOOST_PP_ADD_D, 0, LIST) == 12 END -BEGIN BOOST_PP_LIST_FOLD_RIGHT(BOOST_PP_ADD_D, 0, LISTNIL) == 0 END BEGIN BOOST_PP_LIST_FOLD_RIGHT(REVERSAL, 0, LIST) == 4 END BEGIN BOOST_PP_LIST_CAT(BOOST_PP_LIST_REVERSE(LIST)) == 2514 END -BEGIN BOOST_PP_LIST_IS_NIL(BOOST_PP_LIST_REVERSE(LISTNIL)) == 1 END BEGIN BOOST_PP_LIST_CAT(BOOST_PP_LIST_REST_N(2, LIST)) == 52 END -BEGIN BOOST_PP_LIST_IS_NIL(BOOST_PP_LIST_REST_N(0, LISTNIL)) == 1 END BEGIN BOOST_PP_LIST_CAT(BOOST_PP_LIST_FIRST_N(2, LIST)) == 41 END BEGIN BOOST_PP_LIST_AT(LIST, 2) == 5 END BEGIN BOOST_PP_LIST_SIZE(LIST) == 4 END -BEGIN BOOST_PP_LIST_SIZE(LISTNIL) == 0 END BEGIN BOOST_PP_LIST_CAT(BOOST_PP_LIST_TRANSFORM(BOOST_PP_ADD_D, 2, LIST)) == 6374 END -BEGIN BOOST_PP_LIST_IS_NIL(BOOST_PP_LIST_TRANSFORM(BOOST_PP_ADD_D, 2, LISTNIL)) == 1 END BEGIN BOOST_PP_LIST_CAT(BOOST_PP_LIST_APPEND(BOOST_PP_LIST_REST(LIST), LIST)) == 1524152 END -BEGIN BOOST_PP_LIST_CAT(BOOST_PP_LIST_APPEND(LIST,LISTNIL)) == 4152 END -BEGIN BOOST_PP_LIST_CAT(BOOST_PP_LIST_APPEND(LISTNIL,LIST)) == 4152 END -BEGIN BOOST_PP_LIST_IS_NIL(BOOST_PP_LIST_APPEND(LISTNIL,LISTNIL)) == 1 END + +# define F1(r, state, x) + x + state +# define FI2(r, state, i, x) BOOST_PP_IIF(BOOST_PP_EQUAL(i,1),+ x + x + state,+ x + state) BEGIN BOOST_PP_LIST_FOR_EACH(F1, 1, LIST) == 16 END BEGIN BOOST_PP_LIST_FOR_EACH_I(FI2, 1, LIST) == 17 END @@ -80,12 +64,17 @@ BEGIN BOOST_PP_LIST_FOR_EACH_I(FI2, 1, LIST) == 17 END BEGIN BOOST_PP_TUPLE_ELEM(4, 3, BOOST_PP_LIST_TO_TUPLE(LIST)) == 2 END BEGIN BOOST_PP_LIST_CAT(BOOST_PP_LIST_FILTER(BOOST_PP_LESS_D, 3, LIST)) == 45 END -BEGIN BOOST_PP_LIST_IS_NIL(BOOST_PP_LIST_FILTER(BOOST_PP_LESS_D, 3, LISTNIL)) == 1 END +# define F2(r, x) + BOOST_PP_TUPLE_ELEM(2, 0, x) + 2 - BOOST_PP_TUPLE_ELEM(2, 1, x) BEGIN BOOST_PP_LIST_FOR_EACH_PRODUCT(F2, 2, ( (1, (0, BOOST_PP_NIL)), (2, (3, BOOST_PP_NIL)) )) == 0 END +# define L1 (0, (x, BOOST_PP_NIL)) +# define L2 (a, (1, (b, (2, BOOST_PP_NIL)))) +# define L3 (c, (3, (d, BOOST_PP_NIL))) + +# define LL (L1, (L2, (L3, BOOST_PP_NIL))) + BEGIN BOOST_PP_LIST_CAT(BOOST_PP_LIST_FOLD_LEFT(BOOST_PP_LIST_APPEND_D, BOOST_PP_NIL, LL)) == 0x0a1b2c3d END BEGIN BOOST_PP_ARRAY_ELEM(2, BOOST_PP_LIST_TO_ARRAY(LIST)) == 5 END -BEGIN BOOST_PP_ARRAY_SIZE(BOOST_PP_LIST_TO_ARRAY(LISTNIL)) == 0 END BEGIN BOOST_PP_SEQ_ELEM(3, BOOST_PP_LIST_TO_SEQ(LIST)) == 2 END diff --git a/test/punctuation.c b/test/punctuation.c deleted file mode 100644 index 8fc5dfc..0000000 --- a/test/punctuation.c +++ /dev/null @@ -1,14 +0,0 @@ -# /* ************************************************************************** -# * * -# * (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) -# * * -# ************************************************************************** */ -# -# /* Revised by Edward Diener (2011) */ -# -# /* See http://www.boost.org for most recent version. */ -# -# include diff --git a/test/punctuation.cpp b/test/punctuation.cpp deleted file mode 100644 index 8fc5dfc..0000000 --- a/test/punctuation.cpp +++ /dev/null @@ -1,14 +0,0 @@ -# /* ************************************************************************** -# * * -# * (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) -# * * -# ************************************************************************** */ -# -# /* Revised by Edward Diener (2011) */ -# -# /* See http://www.boost.org for most recent version. */ -# -# include diff --git a/test/punctuation.cxx b/test/punctuation.cxx deleted file mode 100644 index 8e60e9a..0000000 --- a/test/punctuation.cxx +++ /dev/null @@ -1,54 +0,0 @@ -# /* ************************************************************************** -# * * -# * (C) Copyright Edward Diener 2014. -# * 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. */ -# -# if BOOST_PP_VARIADICS -# include -# include - -# define A_TUPLE (*,#,zz) -# define A_TUPLE2 (*,#,(zz,44,(e7))) -# define A_TUPLE_PLUS (mmf,34,^^,!) 456 -# define PLUS_ATUPLE yyt (j,ii%) -# define JDATA ggh -# define NOT_TUPLE y6() -# define NOT_TUPLE2 &(kkkgg,(e)) -# define A_SEQ (r)($)(#) -# define AN_ARRAY (4,(5,7,f,x)) -# define A_LIST (e,(g,(&,BOOST_PP_NIL))) -# define DATA (5 + 3) * 4 -# define DATA2 4 * (5 + 3) -# define DATA3 4 * (5 + 3) * (2 + 1) -# define DATA4 (5 + 3) * (2 + 1) * 4 - - -// is_begin_parens - -BEGIN BOOST_PP_IS_BEGIN_PARENS() == 0 END -BEGIN BOOST_PP_IS_BEGIN_PARENS(A_TUPLE) == 1 END -BEGIN BOOST_PP_IS_BEGIN_PARENS(A_TUPLE2) == 1 END -BEGIN BOOST_PP_IS_BEGIN_PARENS(A_TUPLE_PLUS) == 1 END -BEGIN BOOST_PP_IS_BEGIN_PARENS(PLUS_ATUPLE) == 0 END -BEGIN BOOST_PP_IS_BEGIN_PARENS(JDATA) == 0 END -BEGIN BOOST_PP_IS_BEGIN_PARENS(NOT_TUPLE) == 0 END -BEGIN BOOST_PP_IS_BEGIN_PARENS(NOT_TUPLE2) == 0 END -BEGIN BOOST_PP_IS_BEGIN_PARENS(A_SEQ) == 1 END -BEGIN BOOST_PP_IS_BEGIN_PARENS(AN_ARRAY) == 1 END -BEGIN BOOST_PP_IS_BEGIN_PARENS(A_LIST) == 1 END -BEGIN BOOST_PP_IS_BEGIN_PARENS((y)2(x)) == 1 END - -// remove_parens - -BEGIN BOOST_PP_REMOVE_PARENS(DATA) == 17 END -BEGIN BOOST_PP_REMOVE_PARENS(DATA2)== 32 END -BEGIN BOOST_PP_REMOVE_PARENS(DATA3)== 96 END -BEGIN BOOST_PP_REMOVE_PARENS(DATA4)== 41 END - -#endif diff --git a/test/seq.cxx b/test/seq.cxx index ae37291..c64085d 100644 --- a/test/seq.cxx +++ b/test/seq.cxx @@ -16,18 +16,13 @@ # include # include # include -# include # include # include -# include # include -# include # include -# include # include # include -# define SEQ_NONE () # define SEQ (4)(1)(5)(2) # define SEQVAR (4,5,8,3,61)(1,0)(5,22,43)(2)(17,45,33) @@ -58,19 +53,8 @@ BEGIN BOOST_PP_SEQ_FOR_EACH(F1, 1, SEQ) == 16 END BEGIN BOOST_PP_SEQ_FOR_EACH_I(FI2, 1, SEQ) == 21 END BEGIN BOOST_PP_TUPLE_ELEM(4, 3, BOOST_PP_SEQ_TO_TUPLE(SEQ)) == 2 END -BEGIN BOOST_PP_IS_EMPTY(BOOST_PP_TUPLE_ELEM(1, 0, BOOST_PP_SEQ_TO_TUPLE(SEQ_NONE))) == 1 END - -#if BOOST_PP_VARIADICS - -BEGIN BOOST_PP_TUPLE_SIZE(BOOST_PP_SEQ_TO_TUPLE(SEQ_NONE)) == 1 END - -#endif - BEGIN BOOST_PP_ARRAY_ELEM(3, BOOST_PP_SEQ_TO_ARRAY(SEQ)) == 2 END -BEGIN BOOST_PP_IS_EMPTY(BOOST_PP_ARRAY_ELEM(0, BOOST_PP_SEQ_TO_ARRAY(SEQ_NONE))) == 1 END -BEGIN BOOST_PP_ARRAY_SIZE(BOOST_PP_SEQ_TO_ARRAY(SEQ_NONE)) == 1 END - # define LESS_S(s, x, y) BOOST_PP_LESS(x, y) BEGIN BOOST_PP_SEQ_CAT(BOOST_PP_SEQ_FILTER(LESS_S, 3, SEQ)) == 45 END @@ -114,8 +98,6 @@ BEGIN BOOST_PP_SEQ_CAT(BOOST_PP_SEQ_TAIL(BOOST_PP_SEQ_FOLD_LEFT(SEQ_APPEND, (~), BEGIN BOOST_PP_SEQ_SIZE(BOOST_PP_SEQ_TAIL(BOOST_PP_SEQ_FOLD_LEFT(SEQ_APPEND, (~), LL))) == 9 END BEGIN BOOST_PP_LIST_AT(BOOST_PP_SEQ_TO_LIST(SEQ), 2) == 5 END -BEGIN BOOST_PP_IS_EMPTY(BOOST_PP_LIST_AT(BOOST_PP_SEQ_TO_LIST(SEQ_NONE),0)) == 1 END -BEGIN BOOST_PP_LIST_SIZE(BOOST_PP_SEQ_TO_LIST(SEQ_NONE)) == 1 END #if BOOST_PP_VARIADICS diff --git a/test/tuple.cxx b/test/tuple.cxx index 68d7209..d5d941a 100644 --- a/test/tuple.cxx +++ b/test/tuple.cxx @@ -7,29 +7,21 @@ # * * # ************************************************************************** */ # -# /* Revised by Edward Diener (2011,2014) */ +# /* Revised by Edward Diener (2011) */ # # /* See http://www.boost.org for most recent version. */ # -# include -# include # include # include -# include # include -# include # include -# include -# include # if BOOST_PP_VARIADICS # include # include # endif # include -# include # define TUPLE (0, 1, 2, 3, 4, 5) -# define TUPLE_NONE () # define TUPLE_LARGE (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32) # define TUPLE_VERY_LARGE (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63) # define T2 (+3, /2, +6) @@ -52,7 +44,6 @@ // elem -BEGIN BOOST_PP_IS_EMPTY(BOOST_PP_TUPLE_ELEM(1, 0, TUPLE_NONE)) == 1 END BEGIN BOOST_PP_TUPLE_ELEM(6, 3, TUPLE) == 3 END BEGIN BOOST_PP_TUPLE_ELEM(6, 5, TUPLE) == 5 END BEGIN BOOST_PP_TUPLE_ELEM(33, 15, TUPLE_LARGE) == 15 END @@ -81,30 +72,23 @@ BEGIN TEST_EAT_VERY_LARGE == 8 END BEGIN BOOST_PP_ARRAY_ELEM(3,BOOST_PP_TUPLE_TO_ARRAY(6,TUPLE)) == 3 END BEGIN BOOST_PP_ARRAY_ELEM(29,BOOST_PP_TUPLE_TO_ARRAY(33,TUPLE_LARGE)) == 29 END BEGIN BOOST_PP_ARRAY_ELEM(61,BOOST_PP_TUPLE_TO_ARRAY(64,TUPLE_VERY_LARGE)) == 61 END -BEGIN BOOST_PP_IS_EMPTY(BOOST_PP_ARRAY_ELEM(0,BOOST_PP_TUPLE_TO_ARRAY(1,TUPLE_NONE))) == 1 END -BEGIN BOOST_PP_ARRAY_SIZE(BOOST_PP_TUPLE_TO_ARRAY(1,TUPLE_NONE)) == 1 END // to_list BEGIN BOOST_PP_LIST_AT(BOOST_PP_TUPLE_TO_LIST(6,TUPLE), 2) == 2 END BEGIN BOOST_PP_LIST_AT(BOOST_PP_TUPLE_TO_LIST(33,TUPLE_LARGE), 19) == 19 END BEGIN BOOST_PP_LIST_AT(BOOST_PP_TUPLE_TO_LIST(64,TUPLE_VERY_LARGE), 62) == 62 END -BEGIN BOOST_PP_IS_EMPTY(BOOST_PP_LIST_AT(BOOST_PP_TUPLE_TO_LIST(1,TUPLE_NONE), 0)) == 1 END -BEGIN BOOST_PP_LIST_SIZE(BOOST_PP_TUPLE_TO_LIST(1,TUPLE_NONE)) == 1 END // to_seq BEGIN BOOST_PP_SEQ_ELEM(4,BOOST_PP_TUPLE_TO_SEQ(6,TUPLE)) == 4 END BEGIN BOOST_PP_SEQ_ELEM(31,BOOST_PP_TUPLE_TO_SEQ(33,TUPLE_LARGE)) == 31 END BEGIN BOOST_PP_SEQ_ELEM(55,BOOST_PP_TUPLE_TO_SEQ(64,TUPLE_VERY_LARGE)) == 55 END -BEGIN BOOST_PP_IS_EMPTY(BOOST_PP_SEQ_ELEM(0,BOOST_PP_TUPLE_TO_SEQ(1,TUPLE_NONE))) == 1 END -BEGIN BOOST_PP_SEQ_SIZE(BOOST_PP_TUPLE_TO_SEQ(1,TUPLE_NONE)) == 1 END #if BOOST_PP_VARIADICS // elem -BEGIN BOOST_PP_IS_EMPTY(BOOST_PP_TUPLE_ELEM(0, TUPLE_NONE)) == 1 END BEGIN BOOST_PP_TUPLE_ELEM(3, TUPLE) == 3 END BEGIN BOOST_PP_TUPLE_ELEM(5, TUPLE) == 5 END BEGIN BOOST_PP_TUPLE_ELEM(15, TUPLE_LARGE) == 15 END @@ -174,7 +158,7 @@ BEGIN BOOST_PP_TUPLE_ELEM(33, BOOST_PP_TUPLE_PUSH_FRONT(TUPLE_LARGE, 33)) == 32 // rem -#if BOOST_PP_VARIADICS_MSVC && _MSC_VER <= 1400 +#if BOOST_PP_VARIADICS_MSVC && _MSC_VER == 1400 BEGIN BOOST_PP_VARIADIC_SIZE(BOOST_PP_TUPLE_REM(6)(0, 1, 2, 3, 4, 5)) == 6 END BEGIN BOOST_PP_VARIADIC_SIZE(BOOST_PP_TUPLE_REM(33)(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32)) == 33 END @@ -182,12 +166,6 @@ BEGIN BOOST_PP_VARIADIC_SIZE(BOOST_PP_TUPLE_REM(64)(0, 1, 2, 3, 4, 5, 6, 7, 8, 9 #else -#if BOOST_PP_VARIADICS_MSVC -BEGIN BOOST_PP_IS_EMPTY(BOOST_PP_TUPLE_REM_CAT() TUPLE_NONE) == 1 END -#else -BEGIN BOOST_PP_IS_EMPTY(BOOST_PP_TUPLE_REM() TUPLE_NONE) == 1 END -#endif - BEGIN BOOST_PP_VARIADIC_SIZE(BOOST_PP_TUPLE_REM()(0, 1, 2, 3, 4, 5)) == 6 END BEGIN BOOST_PP_VARIADIC_SIZE(BOOST_PP_TUPLE_REM()(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32)) == 33 END BEGIN BOOST_PP_VARIADIC_SIZE(BOOST_PP_TUPLE_REM()(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63)) == 64 END @@ -196,7 +174,6 @@ BEGIN BOOST_PP_VARIADIC_SIZE(BOOST_PP_TUPLE_REM()(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, // rem_ctor -BEGIN BOOST_PP_VARIADIC_SIZE(BOOST_PP_TUPLE_REM_CTOR(TUPLE_NONE)) == 1 END BEGIN BOOST_PP_VARIADIC_SIZE(BOOST_PP_TUPLE_REM_CTOR(TUPLE)) == 6 END BEGIN BOOST_PP_VARIADIC_SIZE(BOOST_PP_TUPLE_REM_CTOR(TUPLE_LARGE)) == 33 END BEGIN BOOST_PP_VARIADIC_SIZE(BOOST_PP_TUPLE_REM_CTOR(TUPLE_VERY_LARGE)) == 64 END @@ -229,23 +206,17 @@ BEGIN BOOST_PP_TUPLE_SIZE(TUPLE_VERY_LARGE) == 64 END BEGIN BOOST_PP_ARRAY_ELEM(3,BOOST_PP_TUPLE_TO_ARRAY(TUPLE)) == 3 END BEGIN BOOST_PP_ARRAY_ELEM(29,BOOST_PP_TUPLE_TO_ARRAY(TUPLE_LARGE)) == 29 END BEGIN BOOST_PP_ARRAY_ELEM(61,BOOST_PP_TUPLE_TO_ARRAY(TUPLE_VERY_LARGE)) == 61 END -BEGIN BOOST_PP_IS_EMPTY(BOOST_PP_ARRAY_ELEM(0,BOOST_PP_TUPLE_TO_ARRAY(TUPLE_NONE))) == 1 END -BEGIN BOOST_PP_ARRAY_SIZE(BOOST_PP_TUPLE_TO_ARRAY(TUPLE_NONE)) == 1 END // to_tuple BEGIN BOOST_PP_LIST_AT(BOOST_PP_TUPLE_TO_LIST(TUPLE), 2) == 2 END BEGIN BOOST_PP_LIST_AT(BOOST_PP_TUPLE_TO_LIST(TUPLE_LARGE), 19) == 19 END BEGIN BOOST_PP_LIST_AT(BOOST_PP_TUPLE_TO_LIST(TUPLE_VERY_LARGE), 62) == 62 END -BEGIN BOOST_PP_IS_EMPTY(BOOST_PP_LIST_AT(BOOST_PP_TUPLE_TO_LIST(TUPLE_NONE), 0)) == 1 END -BEGIN BOOST_PP_LIST_SIZE(BOOST_PP_TUPLE_TO_LIST(TUPLE_NONE)) == 1 END // to_seq BEGIN BOOST_PP_SEQ_ELEM(4,BOOST_PP_TUPLE_TO_SEQ(TUPLE)) == 4 END BEGIN BOOST_PP_SEQ_ELEM(31,BOOST_PP_TUPLE_TO_SEQ(TUPLE_LARGE)) == 31 END BEGIN BOOST_PP_SEQ_ELEM(55,BOOST_PP_TUPLE_TO_SEQ(TUPLE_VERY_LARGE)) == 55 END -BEGIN BOOST_PP_IS_EMPTY(BOOST_PP_SEQ_ELEM(0,BOOST_PP_TUPLE_TO_SEQ(TUPLE_NONE))) == 1 END -BEGIN BOOST_PP_SEQ_SIZE(BOOST_PP_TUPLE_TO_SEQ(TUPLE_NONE)) == 1 END #endif diff --git a/test/tuple_elem_bug_test.cxx b/test/tuple_elem_bug_test.cxx deleted file mode 100644 index 56e36a6..0000000 --- a/test/tuple_elem_bug_test.cxx +++ /dev/null @@ -1,38 +0,0 @@ -# /* ************************************************************************** -# * * -# * (C) Copyright Edward Diener 2014. -# * 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. */ -# -# include -# include -# include -# include - -#define TN_GEN_ONE(p) (1) -#define TN_GEN_ZERO(p) (0) -#define TN_TEST_ONE_MORE(parameter,ens) \ - BOOST_PP_IF \ - ( \ - BOOST_PP_CAT(BOOST_PP_TUPLE_ELEM(1,0,ens),0), \ - TN_GEN_ONE, \ - TN_GEN_ZERO \ - ) \ - (parameter) \ -/**/ -#define TN_TEST_ONE(parameter,ens) \ - BOOST_PP_TUPLE_ELEM \ - ( \ - 1, \ - 0, \ - TN_TEST_ONE_MORE(parameter,ens) \ - ) \ -/**/ - -BEGIN TN_TEST_ONE(A,(1)) == 1 END -BEGIN TN_TEST_ONE(A,()) == 0 END From 21ccb35814e810cb76e4ce4f02bbfa8fd4aab49a Mon Sep 17 00:00:00 2001 From: Edward Diener Date: Tue, 17 Jun 2014 07:08:04 -0400 Subject: [PATCH 23/58] Reapply typo fix. --- doc/ref/seq_replace.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/ref/seq_replace.html b/doc/ref/seq_replace.html index c757113..9a64e5d 100644 --- a/doc/ref/seq_replace.html +++ b/doc/ref/seq_replace.html @@ -11,7 +11,7 @@ Usage
    - BOOST_PP_SEQ_RPLACE(seq, i, elem) + BOOST_PP_SEQ_REPLACE(seq, i, elem)

    Arguments From f80bb83f3b31d2cc9e7962f740bfa7c420b37e9c Mon Sep 17 00:00:00 2001 From: Edward Diener Date: Sun, 27 Apr 2014 12:00:13 -0400 Subject: [PATCH 24/58] Fixes for empty tuple processing --- .../preprocessor/array/detail/get_data.hpp | 52 +++++++++++++++++++ .../boost/preprocessor/array/push_back.hpp | 4 +- .../boost/preprocessor/array/push_front.hpp | 4 +- include/boost/preprocessor/list/to_array.hpp | 6 ++- include/boost/preprocessor/tuple/elem.hpp | 27 +++++++++- 5 files changed, 87 insertions(+), 6 deletions(-) create mode 100644 include/boost/preprocessor/array/detail/get_data.hpp diff --git a/include/boost/preprocessor/array/detail/get_data.hpp b/include/boost/preprocessor/array/detail/get_data.hpp new file mode 100644 index 0000000..d72547a --- /dev/null +++ b/include/boost/preprocessor/array/detail/get_data.hpp @@ -0,0 +1,52 @@ +# /* ************************************************************************** +# * * +# * (C) Copyright Edward Diener 2014. * +# * 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_ARRAY_DETAIL_GET_DATA_HPP +# define BOOST_PREPROCESSOR_ARRAY_DETAIL_GET_DATA_HPP +# +# include +# include +# +# if BOOST_PP_VARIADICS && BOOST_PP_VARIADICS_MSVC && _MSC_VER != 1400 +# include +# include +# include +# include +# +# /* BOOST_PP_ARRAY_DETAIL_GET_DATA */ +# +# define BOOST_PP_ARRAY_DETAIL_GET_DATA_REM(...) BOOST_PP_CAT(__VA_ARGS__,) +# define BOOST_PP_ARRAY_DETAIL_GET_DATA_TUPLE_REM(size) BOOST_PP_ARRAY_DETAIL_GET_DATA_REM +# define BOOST_PP_ARRAY_DETAIL_GET_DATA_SINGLE(size, data) BOOST_PP_ARRAY_DETAIL_GET_DATA_TUPLE_REM(size) data +# define BOOST_PP_ARRAY_DETAIL_GET_DATA_ANY(size, data) BOOST_PP_TUPLE_REM(size) data +# define BOOST_PP_ARRAY_DETAIL_GET_DATA_CHECK_ZERO(size, data) \ + BOOST_PP_IF \ + ( \ + size, \ + BOOST_PP_ARRAY_DETAIL_GET_DATA_ANY, \ + BOOST_PP_ARRAY_DETAIL_GET_DATA_SINGLE \ + ) \ + (size,data) \ +/**/ +# define BOOST_PP_ARRAY_DETAIL_GET_DATA(size, data) \ + BOOST_PP_IIF \ + ( \ + BOOST_PP_IS_1(size), \ + BOOST_PP_ARRAY_DETAIL_GET_DATA_SINGLE, \ + BOOST_PP_ARRAY_DETAIL_GET_DATA_CHECK_ZERO \ + ) \ + (size,data) \ +/**/ +# else +# define BOOST_PP_ARRAY_DETAIL_GET_DATA(size, data) BOOST_PP_TUPLE_REM(size) data +# endif /* BOOST_PP_VARIADICS && BOOST_PP_VARIADICS_MSVC && _MSC_VER != 1400 */ +# +# endif /* BOOST_PREPROCESSOR_ARRAY_DETAIL_GET_DATA_HPP */ diff --git a/include/boost/preprocessor/array/push_back.hpp b/include/boost/preprocessor/array/push_back.hpp index 6d98d8e..5dce9e0 100644 --- a/include/boost/preprocessor/array/push_back.hpp +++ b/include/boost/preprocessor/array/push_back.hpp @@ -1,6 +1,7 @@ # /* ************************************************************************** # * * # * (C) Copyright Paul Mensonides 2002. +# * (C) Copyright Edward Diener 2014. # * 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) @@ -18,6 +19,7 @@ # include # include # include +# include # # /* BOOST_PP_ARRAY_PUSH_BACK */ # @@ -28,6 +30,6 @@ # define BOOST_PP_ARRAY_PUSH_BACK_D(array, elem) BOOST_PP_ARRAY_PUSH_BACK_I(BOOST_PP_ARRAY_SIZE(array), BOOST_PP_ARRAY_DATA(array), elem) # endif # -# define BOOST_PP_ARRAY_PUSH_BACK_I(size, data, elem) (BOOST_PP_INC(size), (BOOST_PP_TUPLE_REM(size) data BOOST_PP_COMMA_IF(size) elem)) +# define BOOST_PP_ARRAY_PUSH_BACK_I(size, data, elem) (BOOST_PP_INC(size), (BOOST_PP_ARRAY_DETAIL_GET_DATA(size,data) BOOST_PP_COMMA_IF(size) elem)) # # endif diff --git a/include/boost/preprocessor/array/push_front.hpp b/include/boost/preprocessor/array/push_front.hpp index 59344c3..a6c6dc7 100644 --- a/include/boost/preprocessor/array/push_front.hpp +++ b/include/boost/preprocessor/array/push_front.hpp @@ -1,6 +1,7 @@ # /* ************************************************************************** # * * # * (C) Copyright Paul Mensonides 2002. +# * (C) Copyright Edward Diener 2014. # * 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) @@ -18,6 +19,7 @@ # include # include # include +# include # # /* BOOST_PP_ARRAY_PUSH_FRONT */ # @@ -28,6 +30,6 @@ # define BOOST_PP_ARRAY_PUSH_FRONT_D(array, elem) BOOST_PP_ARRAY_PUSH_FRONT_I(BOOST_PP_ARRAY_SIZE(array), BOOST_PP_ARRAY_DATA(array), elem) # endif # -# define BOOST_PP_ARRAY_PUSH_FRONT_I(size, data, elem) (BOOST_PP_INC(size), (elem BOOST_PP_COMMA_IF(size) BOOST_PP_TUPLE_REM(size) data)) +# define BOOST_PP_ARRAY_PUSH_FRONT_I(size, data, elem) (BOOST_PP_INC(size), (elem BOOST_PP_COMMA_IF(size) BOOST_PP_ARRAY_DETAIL_GET_DATA(size,data))) # # endif diff --git a/include/boost/preprocessor/list/to_array.hpp b/include/boost/preprocessor/list/to_array.hpp index 83f8a63..5a0433d 100644 --- a/include/boost/preprocessor/list/to_array.hpp +++ b/include/boost/preprocessor/list/to_array.hpp @@ -1,6 +1,7 @@ # /* ************************************************************************** # * * -# * (C) Copyright Edward Diener 2011. +# * (C) Copyright Paul Mensonides 2011. +# * (C) Copyright Edward Diener 2011,2014. # * 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) @@ -19,6 +20,7 @@ # include # include # include +# include # # /* BOOST_PP_LIST_TO_ARRAY */ # @@ -114,7 +116,7 @@ # endif # define BOOST_PP_LIST_TO_ARRAY_P(d, state) BOOST_PP_LIST_IS_CONS(BOOST_PP_TUPLE_ELEM(3, 0, state)) # define BOOST_PP_LIST_TO_ARRAY_O(d, state) BOOST_PP_LIST_TO_ARRAY_O_I state -# define BOOST_PP_LIST_TO_ARRAY_O_I(list, size, tuple) (BOOST_PP_LIST_REST(list), BOOST_PP_INC(size), (BOOST_PP_TUPLE_REM(size) tuple, BOOST_PP_LIST_FIRST(list))) +# define BOOST_PP_LIST_TO_ARRAY_O_I(list, size, tuple) (BOOST_PP_LIST_REST(list), BOOST_PP_INC(size), (BOOST_PP_ARRAY_DETAIL_GET_DATA(size,tuple), BOOST_PP_LIST_FIRST(list))) # # /* BOOST_PP_LIST_TO_ARRAY_D */ # diff --git a/include/boost/preprocessor/tuple/elem.hpp b/include/boost/preprocessor/tuple/elem.hpp index 3eba1c5..762a171 100644 --- a/include/boost/preprocessor/tuple/elem.hpp +++ b/include/boost/preprocessor/tuple/elem.hpp @@ -8,7 +8,7 @@ # */ # # /* Revised by Paul Mensonides (2002-2011) */ -# /* Revised by Edward Diener (2011) */ +# /* Revised by Edward Diener (2011,2014) */ # # /* See http://www.boost.org for most recent version. */ # @@ -21,15 +21,38 @@ # include # include # +# if BOOST_PP_VARIADICS && BOOST_PP_VARIADICS_MSVC +# include +# include +# include +# endif +# # if BOOST_PP_VARIADICS # if BOOST_PP_VARIADICS_MSVC # define BOOST_PP_TUPLE_ELEM(...) BOOST_PP_TUPLE_ELEM_I(BOOST_PP_OVERLOAD(BOOST_PP_TUPLE_ELEM_O_, __VA_ARGS__), (__VA_ARGS__)) # define BOOST_PP_TUPLE_ELEM_I(m, args) BOOST_PP_TUPLE_ELEM_II(m, args) # define BOOST_PP_TUPLE_ELEM_II(m, args) BOOST_PP_CAT(m ## args,) +/* + Use BOOST_PP_TUPLE_ELEM_O_2_CAT if it is a single element tuple ( which might be empty ) + else use BOOST_PP_REM. This fixes a VC++ problem with an empty tuple and BOOST_PP_TUPLE_ELEM + functionality. +*/ +# define BOOST_PP_TUPLE_ELEM_O_2_CAT(...) BOOST_PP_CAT(__VA_ARGS__,) +# define BOOST_PP_TUPLE_ELEM_O_2_SINGLE(n, tuple) BOOST_PP_VARIADIC_ELEM(n, BOOST_PP_TUPLE_ELEM_O_2_CAT tuple) +# define BOOST_PP_TUPLE_ELEM_O_2_ANY(n, tuple) BOOST_PP_VARIADIC_ELEM(n, BOOST_PP_REM tuple) +# define BOOST_PP_TUPLE_ELEM_O_2(n, tuple) \ + BOOST_PP_IIF \ + ( \ + BOOST_PP_EQUAL(BOOST_PP_TUPLE_SIZE(tuple),1), \ + BOOST_PP_TUPLE_ELEM_O_2_SINGLE, \ + BOOST_PP_TUPLE_ELEM_O_2_ANY \ + ) \ + (n, tuple) \ + /**/ # else # define BOOST_PP_TUPLE_ELEM(...) BOOST_PP_OVERLOAD(BOOST_PP_TUPLE_ELEM_O_, __VA_ARGS__)(__VA_ARGS__) +# define BOOST_PP_TUPLE_ELEM_O_2(n, tuple) BOOST_PP_VARIADIC_ELEM(n, BOOST_PP_REM tuple) # endif -# define BOOST_PP_TUPLE_ELEM_O_2(n, tuple) BOOST_PP_VARIADIC_ELEM(n, BOOST_PP_REM tuple) # define BOOST_PP_TUPLE_ELEM_O_3(size, n, tuple) BOOST_PP_TUPLE_ELEM_O_2(n, tuple) # else # if BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MSVC() From 975c39b910f17ada5d8656fc4bc511fc9c31e07d Mon Sep 17 00:00:00 2001 From: Edward Diener Date: Mon, 28 Apr 2014 19:24:42 -0400 Subject: [PATCH 25/58] Added variadic is_empty and is_begin_parens along with tests. --- .../facilities/detail/is_empty.hpp | 55 ++++++++++++++++++ .../preprocessor/facilities/is_empty.hpp | 13 ++++- .../facilities/is_empty_variadic.hpp | 56 +++++++++++++++++++ include/boost/preprocessor/punctuation.hpp | 1 + .../punctuation/detail/is_begin_parens.hpp | 48 ++++++++++++++++ .../punctuation/is_begin_parens.hpp | 51 +++++++++++++++++ test/Jamfile.v2 | 16 ++++++ test/isempty.c | 12 ++++ test/isempty.cpp | 12 ++++ test/isempty.cxx | 42 ++++++++++++++ test/punctuation.c | 14 +++++ test/punctuation.cpp | 14 +++++ test/punctuation.cxx | 42 ++++++++++++++ 13 files changed, 375 insertions(+), 1 deletion(-) create mode 100644 include/boost/preprocessor/facilities/detail/is_empty.hpp create mode 100644 include/boost/preprocessor/facilities/is_empty_variadic.hpp create mode 100644 include/boost/preprocessor/punctuation/detail/is_begin_parens.hpp create mode 100644 include/boost/preprocessor/punctuation/is_begin_parens.hpp create mode 100644 test/isempty.c create mode 100644 test/isempty.cpp create mode 100644 test/isempty.cxx create mode 100644 test/punctuation.c create mode 100644 test/punctuation.cpp create mode 100644 test/punctuation.cxx diff --git a/include/boost/preprocessor/facilities/detail/is_empty.hpp b/include/boost/preprocessor/facilities/detail/is_empty.hpp new file mode 100644 index 0000000..e044970 --- /dev/null +++ b/include/boost/preprocessor/facilities/detail/is_empty.hpp @@ -0,0 +1,55 @@ +# /* ************************************************************************** +# * * +# * (C) Copyright Edward Diener 2014. +# * 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_DETAIL_IS_EMPTY_HPP +#define BOOST_PREPROCESSOR_DETAIL_IS_EMPTY_HPP + +#include + +#if BOOST_PP_VARIADICS_MSVC + +# pragma warning(once:4002) + +#define BOOST_PP_DETAIL_IS_EMPTY_IIF_0(t, b) b +#define BOOST_PP_DETAIL_IS_EMPTY_IIF_1(t, b) t + +#else + +#define BOOST_PP_DETAIL_IS_EMPTY_IIF_0(t, ...) __VA_ARGS__ +#define BOOST_PP_DETAIL_IS_EMPTY_IIF_1(t, ...) t + +#endif + +#if BOOST_PP_VARIADICS_MSVC && _MSC_VER <= 1400 + +#define BOOST_PP_DETAIL_IS_EMPTY_PROCESS(param) \ + BOOST_PP_IS_BEGIN_PARENS \ + ( \ + BOOST_PP_DETAIL_IS_EMPTY_NON_FUNCTION_C param () \ + ) \ +/**/ + +#else + +#define BOOST_PP_DETAIL_IS_EMPTY_PROCESS(...) \ + BOOST_PP_IS_BEGIN_PARENS \ + ( \ + BOOST_PP_DETAIL_IS_EMPTY_NON_FUNCTION_C __VA_ARGS__ () \ + ) \ +/**/ + +#endif + +#define BOOST_PP_DETAIL_IS_EMPTY_PRIMITIVE_CAT(a, b) a ## b +#define BOOST_PP_DETAIL_IS_EMPTY_IIF(bit) BOOST_PP_DETAIL_IS_EMPTY_PRIMITIVE_CAT(BOOST_PP_DETAIL_IS_EMPTY_IIF_,bit) +#define BOOST_PP_DETAIL_IS_EMPTY_NON_FUNCTION_C(...) () + +#endif /* BOOST_PREPROCESSOR_DETAIL_IS_EMPTY_HPP */ diff --git a/include/boost/preprocessor/facilities/is_empty.hpp b/include/boost/preprocessor/facilities/is_empty.hpp index 638265c..b1094d8 100644 --- a/include/boost/preprocessor/facilities/is_empty.hpp +++ b/include/boost/preprocessor/facilities/is_empty.hpp @@ -1,6 +1,7 @@ # /* ************************************************************************** # * * # * (C) Copyright Paul Mensonides 2003. +# * (C) Copyright Edward Diener 2014. # * 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) @@ -13,6 +14,14 @@ # define BOOST_PREPROCESSOR_FACILITIES_IS_EMPTY_HPP # # include +# +# if BOOST_PP_VARIADICS +# +# include +# +# else +# +# include # include # include # include @@ -40,4 +49,6 @@ # define BOOST_PP_IS_EMPTY_DEF_BOOST_PP_IS_EMPTY_HELPER 0, BOOST_PP_NIL # endif # -# endif +# endif /* BOOST_PP_VARIADICS */ +# +# endif /* BOOST_PREPROCESSOR_FACILITIES_IS_EMPTY_HPP */ diff --git a/include/boost/preprocessor/facilities/is_empty_variadic.hpp b/include/boost/preprocessor/facilities/is_empty_variadic.hpp new file mode 100644 index 0000000..27b4ec0 --- /dev/null +++ b/include/boost/preprocessor/facilities/is_empty_variadic.hpp @@ -0,0 +1,56 @@ +# /* ************************************************************************** +# * * +# * (C) Copyright Edward Diener 2014. +# * 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_FACILITIES_IS_EMPTY_VARIADIC_HPP +# define BOOST_PREPROCESSOR_FACILITIES_IS_EMPTY_VARIADIC_HPP +# +# include +# +# if BOOST_PP_VARIADICS +# +# include +# include +# +#define BOOST_PP_IS_EMPTY_GEN_ZERO(...) 0 +#if BOOST_PP_VARIADICS_MSVC && _MSC_VER <= 1400 +# +#define BOOST_PP_IS_EMPTY(param) \ + BOOST_PP_DETAIL_IS_EMPTY_IIF \ + ( \ + BOOST_PP_IS_BEGIN_PARENS \ + ( \ + param \ + ) \ + ) \ + ( \ + BOOST_PP_IS_EMPTY_GEN_ZERO, \ + BOOST_PP_DETAIL_IS_EMPTY_PROCESS \ + ) \ + (param) \ +/**/ +# else +#define BOOST_PP_IS_EMPTY(...) \ + BOOST_PP_DETAIL_IS_EMPTY_IIF \ + ( \ + BOOST_PP_IS_BEGIN_PARENS \ + ( \ + __VA_ARGS__ \ + ) \ + ) \ + ( \ + BOOST_PP_IS_EMPTY_GEN_ZERO, \ + BOOST_PP_DETAIL_IS_EMPTY_PROCESS \ + ) \ + (__VA_ARGS__) \ +/**/ +# endif /* BOOST_PP_VARIADICS_MSVC && _MSC_VER <= 1400 */ +# endif /* BOOST_PP_VARIADICS */ +# endif /* BOOST_PREPROCESSOR_FACILITIES_IS_EMPTY_VARIADIC_HPP */ diff --git a/include/boost/preprocessor/punctuation.hpp b/include/boost/preprocessor/punctuation.hpp index 72da73e..a96bbff 100644 --- a/include/boost/preprocessor/punctuation.hpp +++ b/include/boost/preprocessor/punctuation.hpp @@ -14,6 +14,7 @@ # # include # include +# include # include # include # diff --git a/include/boost/preprocessor/punctuation/detail/is_begin_parens.hpp b/include/boost/preprocessor/punctuation/detail/is_begin_parens.hpp new file mode 100644 index 0000000..c94ccf3 --- /dev/null +++ b/include/boost/preprocessor/punctuation/detail/is_begin_parens.hpp @@ -0,0 +1,48 @@ +# /* ************************************************************************** +# * * +# * (C) Copyright Edward Diener 2014. +# * 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_DETAIL_IS_BEGIN_PARENS_HPP +#define BOOST_PREPROCESSOR_DETAIL_IS_BEGIN_PARENS_HPP + +#if BOOST_PP_VARIADICS_MSVC + +#include + +#define BOOST_PP_DETAIL_VD_IBP_CAT(a, b) BOOST_PP_DETAIL_VD_IBP_CAT_I(a, b) +#define BOOST_PP_DETAIL_VD_IBP_CAT_I(a, b) BOOST_PP_DETAIL_VD_IBP_CAT_II(a ## b) +#define BOOST_PP_DETAIL_VD_IBP_CAT_II(res) res + +#define BOOST_PP_DETAIL_IBP_SPLIT(i, ...) \ + BOOST_PP_DETAIL_VD_IBP_CAT(BOOST_PP_DETAIL_IBP_PRIMITIVE_CAT(BOOST_PP_DETAIL_IBP_SPLIT_,i)(__VA_ARGS__),BOOST_PP_EMPTY()) \ +/**/ + +#define BOOST_PP_DETAIL_IBP_IS_VARIADIC_C(...) 1 1 + +#else + +#define BOOST_PP_DETAIL_IBP_SPLIT(i, ...) \ + BOOST_PP_DETAIL_IBP_PRIMITIVE_CAT(BOOST_PP_DETAIL_IBP_SPLIT_,i)(__VA_ARGS__) \ +/**/ + +#define BOOST_PP_DETAIL_IBP_IS_VARIADIC_C(...) 1 + +#endif /* BOOST_PP_VARIADICS_MSVC */ + +#define BOOST_PP_DETAIL_IBP_SPLIT_0(a, ...) a +#define BOOST_PP_DETAIL_IBP_SPLIT_1(a, ...) __VA_ARGS__ + +#define BOOST_PP_DETAIL_IBP_CAT(a, ...) BOOST_PP_DETAIL_IBP_PRIMITIVE_CAT(a,__VA_ARGS__) +#define BOOST_PP_DETAIL_IBP_PRIMITIVE_CAT(a, ...) a ## __VA_ARGS__ + +#define BOOST_PP_DETAIL_IBP_IS_VARIADIC_R_1 1, +#define BOOST_PP_DETAIL_IBP_IS_VARIADIC_R_BOOST_PP_DETAIL_IBP_IS_VARIADIC_C 0, + +#endif /* BOOST_PREPROCESSOR_DETAIL_IS_BEGIN_PARENS_HPP */ diff --git a/include/boost/preprocessor/punctuation/is_begin_parens.hpp b/include/boost/preprocessor/punctuation/is_begin_parens.hpp new file mode 100644 index 0000000..20b32bc --- /dev/null +++ b/include/boost/preprocessor/punctuation/is_begin_parens.hpp @@ -0,0 +1,51 @@ +# /* ************************************************************************** +# * * +# * (C) Copyright Edward Diener 2014. +# * 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_IS_BEGIN_PARENS_HPP +# define BOOST_PREPROCESSOR_IS_BEGIN_PARENS_HPP + +# include + +#if BOOST_PP_VARIADICS + +#include + +#if BOOST_PP_VARIADICS_MSVC && _MSC_VER <= 1400 + +#define BOOST_PP_IS_BEGIN_PARENS(param) \ + BOOST_PP_DETAIL_IBP_SPLIT \ + ( \ + 0, \ + BOOST_PP_DETAIL_IBP_CAT \ + ( \ + BOOST_PP_DETAIL_IBP_IS_VARIADIC_R_, \ + BOOST_PP_DETAIL_IBP_IS_VARIADIC_C param \ + ) \ + ) \ +/**/ + +#else + +#define BOOST_PP_IS_BEGIN_PARENS(...) \ + BOOST_PP_DETAIL_IBP_SPLIT \ + ( \ + 0, \ + BOOST_PP_DETAIL_IBP_CAT \ + ( \ + BOOST_PP_DETAIL_IBP_IS_VARIADIC_R_, \ + BOOST_PP_DETAIL_IBP_IS_VARIADIC_C __VA_ARGS__ \ + ) \ + ) \ +/**/ + +#endif /* BOOST_PP_VARIADICS_MSVC && _MSC_VER <= 1400 */ +#endif /* BOOST_PP_VARIADICS */ +#endif /* BOOST_PREPROCESSOR_IS_BEGIN_PARENS_HPP */ diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index 92d1716..527fc22 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -25,9 +25,11 @@ test-suite preprocessor [ compile control.cpp ] [ compile debug.cpp ] [ compile facilities.cpp ] + [ compile isempty.cpp ] [ compile iteration.cpp ] [ compile list.cpp ] [ compile logical.cpp ] + [ compile punctuation.cpp ] [ compile repetition.cpp ] [ compile selection.cpp ] [ compile seq.cpp ] @@ -44,6 +46,7 @@ test-suite preprocessor_nvm [ compile control.cpp : BOOST_PP_VARIADICS=0 : control_nvm ] [ compile debug.cpp : BOOST_PP_VARIADICS=0 : debug_nvm ] [ compile facilities.cpp : BOOST_PP_VARIADICS=0 : facilities_nvm ] + [ compile isempty.cpp : BOOST_PP_VARIADICS=0 : isempty_nvm ] [ compile iteration.cpp : BOOST_PP_VARIADICS=0 : iteration_nvm ] [ compile list.cpp : BOOST_PP_VARIADICS=0 : list_nvm ] [ compile logical.cpp : BOOST_PP_VARIADICS=0 : logical_nvm ] @@ -80,6 +83,10 @@ test-suite preprocessor_c : gcc:-std=c99 : facilities_c ] + [ compile isempty.c + : gcc:-std=c99 + : isempty_c + ] [ compile list.c : gcc:-std=c99 : list_c @@ -88,6 +95,10 @@ test-suite preprocessor_c : gcc:-std=c99 : logical_c ] + [ compile punctuation.c + : gcc:-std=c99 + : punctuation_c + ] [ compile selection.c : gcc:-std=c99 : selection_c @@ -142,6 +153,11 @@ test-suite preprocessor_c_nvm gcc:-std=c99 : facilities_c_nvm ] + [ compile isempty.c + : BOOST_PP_VARIADICS=0 + gcc:-std=c99 + : isempty_c_nvm + ] [ compile list.c : BOOST_PP_VARIADICS=0 gcc:-std=c99 diff --git a/test/isempty.c b/test/isempty.c new file mode 100644 index 0000000..bd4c2c6 --- /dev/null +++ b/test/isempty.c @@ -0,0 +1,12 @@ +# /* ************************************************************************** +# * * +# * (C) Copyright Edward Diener 2014. +# * 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. */ +# +# include diff --git a/test/isempty.cpp b/test/isempty.cpp new file mode 100644 index 0000000..a038bf4 --- /dev/null +++ b/test/isempty.cpp @@ -0,0 +1,12 @@ +# /* ************************************************************************** +# * * +# * (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. */ +# +# include diff --git a/test/isempty.cxx b/test/isempty.cxx new file mode 100644 index 0000000..f2d7bc2 --- /dev/null +++ b/test/isempty.cxx @@ -0,0 +1,42 @@ +# /* ************************************************************************** +# * * +# * (C) Copyright Edward Diener 2014. +# * 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. */ +# +# include +# include +# include +# include +# include + +#if BOOST_PP_VARIADICS + +#define DATA +#define OBJECT OBJECT2 +#define OBJECT2 +#define FUNC(x) FUNC2(x) +#define FUNC2(x) +#define FUNC_GEN3() anything +#define FUNC_GEN4(x) anything + +#if defined(BOOST_PP_VARIADICS_MSVC) + +#else + +#endif + +BEGIN BOOST_PP_IS_EMPTY(BOOST_PP_EMPTY()) == 1 END +BEGIN BOOST_PP_IS_EMPTY(DATA BOOST_PP_EMPTY()) == 1 END +BEGIN BOOST_PP_IS_EMPTY(x BOOST_PP_EMPTY()) == 0 END +BEGIN BOOST_PP_IS_EMPTY(OBJECT BOOST_PP_EMPTY()) == 1 END +BEGIN BOOST_PP_IS_EMPTY(FUNC(z) BOOST_PP_EMPTY()) == 1 END +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN3) == 0 END +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN4) == 0 END + +#endif diff --git a/test/punctuation.c b/test/punctuation.c new file mode 100644 index 0000000..8fc5dfc --- /dev/null +++ b/test/punctuation.c @@ -0,0 +1,14 @@ +# /* ************************************************************************** +# * * +# * (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) +# * * +# ************************************************************************** */ +# +# /* Revised by Edward Diener (2011) */ +# +# /* See http://www.boost.org for most recent version. */ +# +# include diff --git a/test/punctuation.cpp b/test/punctuation.cpp new file mode 100644 index 0000000..8fc5dfc --- /dev/null +++ b/test/punctuation.cpp @@ -0,0 +1,14 @@ +# /* ************************************************************************** +# * * +# * (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) +# * * +# ************************************************************************** */ +# +# /* Revised by Edward Diener (2011) */ +# +# /* See http://www.boost.org for most recent version. */ +# +# include diff --git a/test/punctuation.cxx b/test/punctuation.cxx new file mode 100644 index 0000000..3eb364b --- /dev/null +++ b/test/punctuation.cxx @@ -0,0 +1,42 @@ +# /* ************************************************************************** +# * * +# * (C) Copyright Edward Diener 2014. +# * 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. */ +# +# if BOOST_PP_VARIADICS +# include +# include + +# define A_TUPLE (*,#,zz) +# define A_TUPLE2 (*,#,(zz,44,(e7))) +# define A_TUPLE_PLUS (mmf,34,^^,!) 456 +# define PLUS_ATUPLE yyt (j,ii%) +# define JDATA ggh +# define NOT_TUPLE y6() +# define NOT_TUPLE2 &(kkkgg,(e)) +# define A_SEQ (r)($)(#) +# define AN_ARRAY (4,(5,7,f,x)) +# define A_LIST (e,(g,(&,BOOST_PP_NIL))) + +// is_begin_parens + +BEGIN BOOST_PP_IS_BEGIN_PARENS() == 0 END +BEGIN BOOST_PP_IS_BEGIN_PARENS(A_TUPLE) == 1 END +BEGIN BOOST_PP_IS_BEGIN_PARENS(A_TUPLE2) == 1 END +BEGIN BOOST_PP_IS_BEGIN_PARENS(A_TUPLE_PLUS) == 1 END +BEGIN BOOST_PP_IS_BEGIN_PARENS(PLUS_ATUPLE) == 0 END +BEGIN BOOST_PP_IS_BEGIN_PARENS(JDATA) == 0 END +BEGIN BOOST_PP_IS_BEGIN_PARENS(NOT_TUPLE) == 0 END +BEGIN BOOST_PP_IS_BEGIN_PARENS(NOT_TUPLE2) == 0 END +BEGIN BOOST_PP_IS_BEGIN_PARENS(A_SEQ) == 1 END +BEGIN BOOST_PP_IS_BEGIN_PARENS(AN_ARRAY) == 1 END +BEGIN BOOST_PP_IS_BEGIN_PARENS(A_LIST) == 1 END +BEGIN BOOST_PP_IS_BEGIN_PARENS((y)2(x)) == 1 END + +#endif From 2c7cf9410ac858dcffdc9943fa0cff781c654624 Mon Sep 17 00:00:00 2001 From: Edward Diener Date: Mon, 28 Apr 2014 22:12:08 -0400 Subject: [PATCH 26/58] Added variadic version of BOOST_PP_EMPTY and added new is_empty tests. --- .../boost/preprocessor/facilities/empty.hpp | 7 ++++ .../facilities/is_empty_variadic.hpp | 6 +-- test/isempty.cxx | 40 ++++++++++++++++--- 3 files changed, 45 insertions(+), 8 deletions(-) diff --git a/include/boost/preprocessor/facilities/empty.hpp b/include/boost/preprocessor/facilities/empty.hpp index 46db190..99e1daa 100644 --- a/include/boost/preprocessor/facilities/empty.hpp +++ b/include/boost/preprocessor/facilities/empty.hpp @@ -8,14 +8,21 @@ # */ # # /* Revised by Paul Mensonides (2002) */ +# /* Revised by Edward Diener (2014) */ # # /* See http://www.boost.org for most recent version. */ # # ifndef BOOST_PREPROCESSOR_FACILITIES_EMPTY_HPP # define BOOST_PREPROCESSOR_FACILITIES_EMPTY_HPP # +# include +# # /* BOOST_PP_EMPTY */ # +# if BOOST_PP_VARIADICS +# define BOOST_PP_EMPTY(...) +# else # define BOOST_PP_EMPTY() +# endif # # endif diff --git a/include/boost/preprocessor/facilities/is_empty_variadic.hpp b/include/boost/preprocessor/facilities/is_empty_variadic.hpp index 27b4ec0..c2700fe 100644 --- a/include/boost/preprocessor/facilities/is_empty_variadic.hpp +++ b/include/boost/preprocessor/facilities/is_empty_variadic.hpp @@ -16,10 +16,10 @@ # # if BOOST_PP_VARIADICS # +# include # include # include # -#define BOOST_PP_IS_EMPTY_GEN_ZERO(...) 0 #if BOOST_PP_VARIADICS_MSVC && _MSC_VER <= 1400 # #define BOOST_PP_IS_EMPTY(param) \ @@ -31,7 +31,7 @@ ) \ ) \ ( \ - BOOST_PP_IS_EMPTY_GEN_ZERO, \ + 0 BOOST_PP_EMPTY, \ BOOST_PP_DETAIL_IS_EMPTY_PROCESS \ ) \ (param) \ @@ -46,7 +46,7 @@ ) \ ) \ ( \ - BOOST_PP_IS_EMPTY_GEN_ZERO, \ + 0 BOOST_PP_EMPTY, \ BOOST_PP_DETAIL_IS_EMPTY_PROCESS \ ) \ (__VA_ARGS__) \ diff --git a/test/isempty.cxx b/test/isempty.cxx index f2d7bc2..94be43a 100644 --- a/test/isempty.cxx +++ b/test/isempty.cxx @@ -22,13 +22,43 @@ #define OBJECT2 #define FUNC(x) FUNC2(x) #define FUNC2(x) -#define FUNC_GEN3() anything -#define FUNC_GEN4(x) anything - +#define FUNC_GEN() () +#define FUNC_GEN2(x) () +#define FUNC_GEN3() (&) +#define FUNC_GEN4(x) (y) +#define FUNC_GEN5() (y,z) +#define FUNC_GEN6() anything +#define FUNC_GEN7(x) anything + #if defined(BOOST_PP_VARIADICS_MSVC) +#define FUNC_GEN8(x,y) (1,2,3) +#define FUNC_GEN9(x,y,z) anything + +/* These next five produce the wrong result in VC++ */ + +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN) == 1 END +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN2) == 1 END +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN3) == 1 END +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN4) == 1 END +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN5) == 1 END + +/* This next should produce a compiler error but does not, and produces the incorrect result */ + +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN8) == 1 END + +/* This next should produce a compiler error but does not */ + +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN9) == 0 END + #else +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN) == 0 END +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN2) == 0 END +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN3) == 0 END +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN4) == 0 END +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN5) == 0 END + #endif BEGIN BOOST_PP_IS_EMPTY(BOOST_PP_EMPTY()) == 1 END @@ -36,7 +66,7 @@ BEGIN BOOST_PP_IS_EMPTY(DATA BOOST_PP_EMPTY()) == 1 END BEGIN BOOST_PP_IS_EMPTY(x BOOST_PP_EMPTY()) == 0 END BEGIN BOOST_PP_IS_EMPTY(OBJECT BOOST_PP_EMPTY()) == 1 END BEGIN BOOST_PP_IS_EMPTY(FUNC(z) BOOST_PP_EMPTY()) == 1 END -BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN3) == 0 END -BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN4) == 0 END +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN6) == 0 END +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN7) == 0 END #endif From 4ed6f6e07a081eff8a8396823427e77bfcd07b23 Mon Sep 17 00:00:00 2001 From: Edward Diener Date: Wed, 30 Apr 2014 16:06:49 -0400 Subject: [PATCH 27/58] Addition of is_empty tests and changes to rem processing as a workaround to VC++ problem. --- .../preprocessor/array/detail/get_data.hpp | 4 +- .../preprocessor/facilities/is_empty.hpp | 5 +- .../seq/detail/binary_transform.hpp | 14 ++- .../tuple/detail/is_single_return.hpp | 28 ++++++ include/boost/preprocessor/tuple/elem.hpp | 19 +--- include/boost/preprocessor/tuple/rem.hpp | 14 ++- .../variadic/detail/is_single_return.hpp | 28 ++++++ test/Jamfile.v2 | 92 ++++++++++++------ test/isempty.cpp | 2 +- test/isempty.cxx | 97 ++++++++++++++++--- test/isempty_failure.c | 12 +++ test/isempty_failure.cpp | 12 +++ test/isempty_failure.cxx | 25 +++++ test/isempty_failure2.c | 12 +++ test/isempty_failure2.cpp | 12 +++ test/isempty_failure2.cxx | 25 +++++ test/isempty_variadic_standard_failure.c | 12 +++ test/isempty_variadic_standard_failure.cpp | 12 +++ test/isempty_variadic_standard_failure.cxx | 25 +++++ test/isempty_variadic_standard_failure2.c | 12 +++ test/isempty_variadic_standard_failure2.cpp | 12 +++ test/isempty_variadic_standard_failure2.cxx | 25 +++++ test/tuple.cxx | 5 +- test/tuple_elem_bug_test.cxx | 38 ++++++++ 24 files changed, 476 insertions(+), 66 deletions(-) create mode 100644 include/boost/preprocessor/tuple/detail/is_single_return.hpp create mode 100644 include/boost/preprocessor/variadic/detail/is_single_return.hpp create mode 100644 test/isempty_failure.c create mode 100644 test/isempty_failure.cpp create mode 100644 test/isempty_failure.cxx create mode 100644 test/isempty_failure2.c create mode 100644 test/isempty_failure2.cpp create mode 100644 test/isempty_failure2.cxx create mode 100644 test/isempty_variadic_standard_failure.c create mode 100644 test/isempty_variadic_standard_failure.cpp create mode 100644 test/isempty_variadic_standard_failure.cxx create mode 100644 test/isempty_variadic_standard_failure2.c create mode 100644 test/isempty_variadic_standard_failure2.cpp create mode 100644 test/isempty_variadic_standard_failure2.cxx create mode 100644 test/tuple_elem_bug_test.cxx diff --git a/include/boost/preprocessor/array/detail/get_data.hpp b/include/boost/preprocessor/array/detail/get_data.hpp index d72547a..d978109 100644 --- a/include/boost/preprocessor/array/detail/get_data.hpp +++ b/include/boost/preprocessor/array/detail/get_data.hpp @@ -23,9 +23,7 @@ # # /* BOOST_PP_ARRAY_DETAIL_GET_DATA */ # -# define BOOST_PP_ARRAY_DETAIL_GET_DATA_REM(...) BOOST_PP_CAT(__VA_ARGS__,) -# define BOOST_PP_ARRAY_DETAIL_GET_DATA_TUPLE_REM(size) BOOST_PP_ARRAY_DETAIL_GET_DATA_REM -# define BOOST_PP_ARRAY_DETAIL_GET_DATA_SINGLE(size, data) BOOST_PP_ARRAY_DETAIL_GET_DATA_TUPLE_REM(size) data +# define BOOST_PP_ARRAY_DETAIL_GET_DATA_SINGLE(size, data) BOOST_PP_TUPLE_REM_CAT(size) data # define BOOST_PP_ARRAY_DETAIL_GET_DATA_ANY(size, data) BOOST_PP_TUPLE_REM(size) data # define BOOST_PP_ARRAY_DETAIL_GET_DATA_CHECK_ZERO(size, data) \ BOOST_PP_IF \ diff --git a/include/boost/preprocessor/facilities/is_empty.hpp b/include/boost/preprocessor/facilities/is_empty.hpp index b1094d8..e7f821f 100644 --- a/include/boost/preprocessor/facilities/is_empty.hpp +++ b/include/boost/preprocessor/facilities/is_empty.hpp @@ -22,10 +22,13 @@ # else # # include -# include +# if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MSVC() && ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MWCC() # include # include +# else +# include # include +# endif # # /* BOOST_PP_IS_EMPTY */ # diff --git a/include/boost/preprocessor/seq/detail/binary_transform.hpp b/include/boost/preprocessor/seq/detail/binary_transform.hpp index 373e8a5..1c381a7 100644 --- a/include/boost/preprocessor/seq/detail/binary_transform.hpp +++ b/include/boost/preprocessor/seq/detail/binary_transform.hpp @@ -16,6 +16,9 @@ # include # include # include +# if BOOST_PP_VARIADICS && BOOST_PP_VARIADICS_MSVC +# include +# endif # # /* BOOST_PP_SEQ_BINARY_TRANSFORM */ # @@ -28,8 +31,15 @@ # define BOOST_PP_SEQ_BINARY_TRANSFORM(seq) BOOST_PP_CAT(BOOST_PP_SEQ_BINARY_TRANSFORM_A seq, 0) # endif # if BOOST_PP_VARIADICS -# define BOOST_PP_SEQ_BINARY_TRANSFORM_A(...) (BOOST_PP_REM, __VA_ARGS__)() BOOST_PP_SEQ_BINARY_TRANSFORM_B -# define BOOST_PP_SEQ_BINARY_TRANSFORM_B(...) (BOOST_PP_REM, __VA_ARGS__)() BOOST_PP_SEQ_BINARY_TRANSFORM_A +# if BOOST_PP_VARIADICS_MSVC +# define BOOST_PP_SEQ_BINARY_TRANSFORM_GET_REM(...) \ + BOOST_PP_VARIADIC_IS_SINGLE_RETURN(BOOST_PP_REM_CAT,BOOST_PP_REM,__VA_ARGS__) \ + /**/ +# else +# define BOOST_PP_SEQ_BINARY_TRANSFORM_GET_REM(...) BOOST_PP_REM +# endif +# define BOOST_PP_SEQ_BINARY_TRANSFORM_A(...) (BOOST_PP_SEQ_BINARY_TRANSFORM_GET_REM(__VA_ARGS__), __VA_ARGS__)() BOOST_PP_SEQ_BINARY_TRANSFORM_B +# define BOOST_PP_SEQ_BINARY_TRANSFORM_B(...) (BOOST_PP_SEQ_BINARY_TRANSFORM_GET_REM(__VA_ARGS__), __VA_ARGS__)() BOOST_PP_SEQ_BINARY_TRANSFORM_A # else # define BOOST_PP_SEQ_BINARY_TRANSFORM_A(e) (BOOST_PP_REM, e)() BOOST_PP_SEQ_BINARY_TRANSFORM_B # define BOOST_PP_SEQ_BINARY_TRANSFORM_B(e) (BOOST_PP_REM, e)() BOOST_PP_SEQ_BINARY_TRANSFORM_A diff --git a/include/boost/preprocessor/tuple/detail/is_single_return.hpp b/include/boost/preprocessor/tuple/detail/is_single_return.hpp new file mode 100644 index 0000000..9ffa3cc --- /dev/null +++ b/include/boost/preprocessor/tuple/detail/is_single_return.hpp @@ -0,0 +1,28 @@ +# /* ************************************************************************** +# * * +# * (C) Copyright Edward Diener 2014. * +# * 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_TUPLE_DETAIL_IS_SINGLE_RETURN_HPP +# define BOOST_PREPROCESSOR_TUPLE_DETAIL_IS_SINGLE_RETURN_HPP +# +# include +# include +# include +# include +# +# /* BOOST_PP_TUPLE_IS_SINGLE_RETURN */ +# +# if BOOST_PP_VARIADICS && BOOST_PP_VARIADICS_MSVC +# define BOOST_PP_TUPLE_IS_SINGLE_RETURN(sr,nsr,tuple) \ + BOOST_PP_IIF(BOOST_PP_IS_1(BOOST_PP_TUPLE_SIZE(tuple)),sr,nsr) \ + /**/ +# endif /* BOOST_PP_VARIADICS && BOOST_PP_VARIADICS_MSVC */ +# +# endif /* BOOST_PREPROCESSOR_TUPLE_DETAIL_IS_SINGLE_RETURN_HPP */ diff --git a/include/boost/preprocessor/tuple/elem.hpp b/include/boost/preprocessor/tuple/elem.hpp index 762a171..ee8f0bd 100644 --- a/include/boost/preprocessor/tuple/elem.hpp +++ b/include/boost/preprocessor/tuple/elem.hpp @@ -22,9 +22,7 @@ # include # # if BOOST_PP_VARIADICS && BOOST_PP_VARIADICS_MSVC -# include -# include -# include +# include # endif # # if BOOST_PP_VARIADICS @@ -33,21 +31,12 @@ # define BOOST_PP_TUPLE_ELEM_I(m, args) BOOST_PP_TUPLE_ELEM_II(m, args) # define BOOST_PP_TUPLE_ELEM_II(m, args) BOOST_PP_CAT(m ## args,) /* - Use BOOST_PP_TUPLE_ELEM_O_2_CAT if it is a single element tuple ( which might be empty ) + Use BOOST_PP_REM_CAT if it is a single element tuple ( which might be empty ) else use BOOST_PP_REM. This fixes a VC++ problem with an empty tuple and BOOST_PP_TUPLE_ELEM - functionality. + functionality. See tuple_elem_bug_test.cxx. */ -# define BOOST_PP_TUPLE_ELEM_O_2_CAT(...) BOOST_PP_CAT(__VA_ARGS__,) -# define BOOST_PP_TUPLE_ELEM_O_2_SINGLE(n, tuple) BOOST_PP_VARIADIC_ELEM(n, BOOST_PP_TUPLE_ELEM_O_2_CAT tuple) -# define BOOST_PP_TUPLE_ELEM_O_2_ANY(n, tuple) BOOST_PP_VARIADIC_ELEM(n, BOOST_PP_REM tuple) # define BOOST_PP_TUPLE_ELEM_O_2(n, tuple) \ - BOOST_PP_IIF \ - ( \ - BOOST_PP_EQUAL(BOOST_PP_TUPLE_SIZE(tuple),1), \ - BOOST_PP_TUPLE_ELEM_O_2_SINGLE, \ - BOOST_PP_TUPLE_ELEM_O_2_ANY \ - ) \ - (n, tuple) \ + BOOST_PP_VARIADIC_ELEM(n, BOOST_PP_TUPLE_IS_SINGLE_RETURN(BOOST_PP_REM_CAT,BOOST_PP_REM,tuple) tuple) \ /**/ # else # define BOOST_PP_TUPLE_ELEM(...) BOOST_PP_OVERLOAD(BOOST_PP_TUPLE_ELEM_O_, __VA_ARGS__)(__VA_ARGS__) diff --git a/include/boost/preprocessor/tuple/rem.hpp b/include/boost/preprocessor/tuple/rem.hpp index 270c31a..136d282 100644 --- a/include/boost/preprocessor/tuple/rem.hpp +++ b/include/boost/preprocessor/tuple/rem.hpp @@ -16,10 +16,17 @@ # include # include # include +# if BOOST_PP_VARIADICS && BOOST_PP_VARIADICS_MSVC +# include +# endif # # /* BOOST_PP_REM */ # # if BOOST_PP_VARIADICS +# if BOOST_PP_VARIADICS_MSVC + /* To be used internally when __VA_ARGS__ is a single element */ +# define BOOST_PP_REM_CAT(...) BOOST_PP_CAT(__VA_ARGS__,) +# endif # define BOOST_PP_REM(...) __VA_ARGS__ # else # define BOOST_PP_REM(x) x @@ -31,6 +38,10 @@ VC++8.0 cannot handle the variadic version of BOOST_PP_TUPLE_REM(size) */ # if BOOST_PP_VARIADICS && !(BOOST_PP_VARIADICS_MSVC && _MSC_VER == 1400) +# if BOOST_PP_VARIADICS_MSVC + /* To be used internally when the size is 1 */ +# define BOOST_PP_TUPLE_REM_CAT(size) BOOST_PP_REM_CAT +# endif # define BOOST_PP_TUPLE_REM(size) BOOST_PP_REM # else # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MWCC() @@ -114,10 +125,11 @@ # define BOOST_PP_TUPLE_REM_CTOR(...) BOOST_PP_TUPLE_REM_CTOR_I(BOOST_PP_OVERLOAD(BOOST_PP_TUPLE_REM_CTOR_O_, __VA_ARGS__), (__VA_ARGS__)) # define BOOST_PP_TUPLE_REM_CTOR_I(m, args) BOOST_PP_TUPLE_REM_CTOR_II(m, args) # define BOOST_PP_TUPLE_REM_CTOR_II(m, args) BOOST_PP_CAT(m ## args,) +# define BOOST_PP_TUPLE_REM_CTOR_O_1(tuple) BOOST_PP_TUPLE_IS_SINGLE_RETURN(BOOST_PP_REM_CAT,BOOST_PP_REM,tuple) tuple # else # define BOOST_PP_TUPLE_REM_CTOR(...) BOOST_PP_OVERLOAD(BOOST_PP_TUPLE_REM_CTOR_O_, __VA_ARGS__)(__VA_ARGS__) +# define BOOST_PP_TUPLE_REM_CTOR_O_1(tuple) BOOST_PP_REM tuple # endif -# define BOOST_PP_TUPLE_REM_CTOR_O_1(tuple) BOOST_PP_REM tuple # define BOOST_PP_TUPLE_REM_CTOR_O_2(size, tuple) BOOST_PP_TUPLE_REM_CTOR_O_1(tuple) # else # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG() diff --git a/include/boost/preprocessor/variadic/detail/is_single_return.hpp b/include/boost/preprocessor/variadic/detail/is_single_return.hpp new file mode 100644 index 0000000..491e06b --- /dev/null +++ b/include/boost/preprocessor/variadic/detail/is_single_return.hpp @@ -0,0 +1,28 @@ +# /* ************************************************************************** +# * * +# * (C) Copyright Edward Diener 2014. * +# * 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_VARIADIC_DETAIL_IS_SINGLE_RETURN_HPP +# define BOOST_PREPROCESSOR_VARIADIC_DETAIL_IS_SINGLE_RETURN_HPP +# +# include +# include +# include +# include +# +# /* BOOST_PP_VARIADIC_IS_SINGLE_RETURN */ +# +# if BOOST_PP_VARIADICS && BOOST_PP_VARIADICS_MSVC +# define BOOST_PP_VARIADIC_IS_SINGLE_RETURN(sr,nsr,...) \ + BOOST_PP_IIF(BOOST_PP_IS_1(BOOST_PP_VARIADIC_SIZE(__VA_ARGS__)),sr,nsr) \ + /**/ +# endif /* BOOST_PP_VARIADICS && BOOST_PP_VARIADICS_MSVC */ +# +# endif /* BOOST_PREPROCESSOR_VARIADIC_DETAIL_IS_SINGLE_RETURN_HPP */ diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index 527fc22..ac61214 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -19,23 +19,22 @@ project preprocessor_tests : requirements on test-suite preprocessor : - [ compile arithmetic.cpp ] - [ compile array.cpp ] - [ compile comparison.cpp ] - [ compile control.cpp ] - [ compile debug.cpp ] - [ compile facilities.cpp ] - [ compile isempty.cpp ] - [ compile iteration.cpp ] - [ compile list.cpp ] - [ compile logical.cpp ] - [ compile punctuation.cpp ] - [ compile repetition.cpp ] - [ compile selection.cpp ] - [ compile seq.cpp ] - [ compile slot.cpp ] - [ compile tuple.cpp ] - [ compile variadic.cpp ] + [ compile arithmetic.cpp : gcc:-std=c++0x ] + [ compile array.cpp : gcc:-std=c++0x ] + [ compile comparison.cpp : gcc:-std=c++0x ] + [ compile control.cpp : gcc:-std=c++0x ] + [ compile debug.cpp : gcc:-std=c++0x ] + [ compile facilities.cpp : gcc:-std=c++0x ] + [ compile iteration.cpp : gcc:-std=c++0x ] + [ compile list.cpp : gcc:-std=c++0x ] + [ compile logical.cpp : gcc:-std=c++0x ] + [ compile punctuation.cpp : gcc:-std=c++0x ] + [ compile repetition.cpp : gcc:-std=c++0x ] + [ compile selection.cpp : gcc:-std=c++0x ] + [ compile seq.cpp : gcc:-std=c++0x ] + [ compile slot.cpp : gcc:-std=c++0x ] + [ compile tuple.cpp : gcc:-std=c++0x ] + [ compile variadic.cpp : gcc:-std=c++0x ] ; test-suite preprocessor_nvm @@ -46,7 +45,6 @@ test-suite preprocessor_nvm [ compile control.cpp : BOOST_PP_VARIADICS=0 : control_nvm ] [ compile debug.cpp : BOOST_PP_VARIADICS=0 : debug_nvm ] [ compile facilities.cpp : BOOST_PP_VARIADICS=0 : facilities_nvm ] - [ compile isempty.cpp : BOOST_PP_VARIADICS=0 : isempty_nvm ] [ compile iteration.cpp : BOOST_PP_VARIADICS=0 : iteration_nvm ] [ compile list.cpp : BOOST_PP_VARIADICS=0 : list_nvm ] [ compile logical.cpp : BOOST_PP_VARIADICS=0 : logical_nvm ] @@ -83,10 +81,6 @@ test-suite preprocessor_c : gcc:-std=c99 : facilities_c ] - [ compile isempty.c - : gcc:-std=c99 - : isempty_c - ] [ compile list.c : gcc:-std=c99 : list_c @@ -153,11 +147,6 @@ test-suite preprocessor_c_nvm gcc:-std=c99 : facilities_c_nvm ] - [ compile isempty.c - : BOOST_PP_VARIADICS=0 - gcc:-std=c99 - : isempty_c_nvm - ] [ compile list.c : BOOST_PP_VARIADICS=0 gcc:-std=c99 @@ -189,3 +178,52 @@ test-suite preprocessor_c_nvm : tuple_c_nvm ] ; + +# test-suite preprocessor_isempty +# : +# [ compile isempty.cpp : gcc:-std=c++0x ] +# [ compile-fail isempty_variadic_standard_failure.cpp : gcc:-std=c++0x ] +# [ compile-fail isempty_variadic_standard_failure2.cpp : gcc:-std=c++0x ] +# ; + +test-suite preprocessor_isempty_nvm + : + [ compile isempty.cpp : BOOST_PP_VARIADICS=0 : isempty_nvm ] + [ compile-fail isempty_failure.cpp : BOOST_PP_VARIADICS=0 : isempty_failure_nvm ] + [ compile-fail isempty_failure2.cpp : BOOST_PP_VARIADICS=0 : isempty_failure2_nvm ] + ; + +# test-suite preprocessor_isempty_c +# : +# [ compile isempty.c +# : gcc:-std=c99 +# : isempty_c +# ] +# [ compile-fail isempty_variadic_standard_failure.c +# : gcc:-std=c99 +# : isempty_variadic_standard_failure_c +# ] +# [ compile-fail isempty_variadic_standard_failure2.c +# : gcc:-std=c99 +# : isempty_variadic_standard_failure2_c +# ] +# ; + +test-suite preprocessor_isempty_c_nvm + : + [ compile isempty.c + : BOOST_PP_VARIADICS=0 + gcc:-std=c99 + : isempty_c_nvm + ] + [ compile-fail isempty_failure.c + : BOOST_PP_VARIADICS=0 + gcc:-std=c99 + : isempty_failure_c_nvm + ] + [ compile-fail isempty_failure2.c + : BOOST_PP_VARIADICS=0 + gcc:-std=c99 + : isempty_failure2_c_nvm + ] + ; diff --git a/test/isempty.cpp b/test/isempty.cpp index a038bf4..bd4c2c6 100644 --- a/test/isempty.cpp +++ b/test/isempty.cpp @@ -1,6 +1,6 @@ # /* ************************************************************************** # * * -# * (C) Copyright Paul Mensonides 2002. +# * (C) Copyright Edward Diener 2014. # * 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) diff --git a/test/isempty.cxx b/test/isempty.cxx index 94be43a..cf2660f 100644 --- a/test/isempty.cxx +++ b/test/isempty.cxx @@ -11,12 +11,8 @@ # # include # include -# include -# include # include -#if BOOST_PP_VARIADICS - #define DATA #define OBJECT OBJECT2 #define OBJECT2 @@ -29,38 +25,53 @@ #define FUNC_GEN5() (y,z) #define FUNC_GEN6() anything #define FUNC_GEN7(x) anything - -#if defined(BOOST_PP_VARIADICS_MSVC) - #define FUNC_GEN8(x,y) (1,2,3) #define FUNC_GEN9(x,y,z) anything - -/* These next five produce the wrong result in VC++ */ +#define FUNC_GEN10(x) (y) data +#define NAME &name +#define ATUPLE (atuple) +#define ATUPLE_PLUS (atuple) data + +#if BOOST_PP_VARIADICS + +#if defined(BOOST_PP_VARIADICS_MSVC) /* Testing the VC++ variadic version */ + +/* INCORRECT */ BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN) == 1 END BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN2) == 1 END BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN3) == 1 END BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN4) == 1 END BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN5) == 1 END - -/* This next should produce a compiler error but does not, and produces the incorrect result */ - BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN8) == 1 END +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN10) == 1 END -/* This next should produce a compiler error but does not */ +/* CORRECT */ BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN9) == 0 END -#else +#else /* Testing the non-VC++ variadic version */ + +/* CORRECT */ BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN) == 0 END BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN2) == 0 END BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN3) == 0 END BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN4) == 0 END BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN5) == 0 END +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN10) == 0 END + +/* COMPILER ERROR */ + +// BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN8) == 0 END +// BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN9) == 0 END #endif +/* Testing the variadic version */ + +/* CORRECT */ + BEGIN BOOST_PP_IS_EMPTY(BOOST_PP_EMPTY()) == 1 END BEGIN BOOST_PP_IS_EMPTY(DATA BOOST_PP_EMPTY()) == 1 END BEGIN BOOST_PP_IS_EMPTY(x BOOST_PP_EMPTY()) == 0 END @@ -68,5 +79,61 @@ BEGIN BOOST_PP_IS_EMPTY(OBJECT BOOST_PP_EMPTY()) == 1 END BEGIN BOOST_PP_IS_EMPTY(FUNC(z) BOOST_PP_EMPTY()) == 1 END BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN6) == 0 END BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN7) == 0 END - +BEGIN BOOST_PP_IS_EMPTY(NAME) == 0 END +BEGIN BOOST_PP_IS_EMPTY(ATUPLE) == 0 END +BEGIN BOOST_PP_IS_EMPTY(ATUPLE_PLUS) == 0 END + +#else + +#if BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MSVC() /* Testing the VC++ non-variadic version */ + +/* INCORRECT */ + +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN) == 1 END +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN2) == 1 END +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN3) == 1 END +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN4) == 1 END +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN5) == 1 END +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN8) == 1 END +BEGIN BOOST_PP_IS_EMPTY(ATUPLE) == 1 END +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN10) == 1 END +BEGIN BOOST_PP_IS_EMPTY(ATUPLE_PLUS) == 1 END + +/* CORRECT */ + +BEGIN BOOST_PP_IS_EMPTY(NAME) == 0 END + +#else /* Testing the non-VC++ non-variadic version */ + +/* CORRECT */ + +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN) == 0 END +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN2) == 0 END +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN3) == 0 END +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN4) == 0 END +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN5) == 0 END +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN8) == 0 END +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN10) == 0 END + +/* COMPILER ERROR */ + +// BEGIN BOOST_PP_IS_EMPTY(ATUPLE) == 0 END +// BEGIN BOOST_PP_IS_EMPTY(ATUPLE_PLUS) == 1 END +// BEGIN BOOST_PP_IS_EMPTY(NAME) == 0 END + +#endif + +/* Testing the non-variadic version */ + +/* CORRECT */ + +BEGIN BOOST_PP_IS_EMPTY(BOOST_PP_EMPTY()) == 1 END +BEGIN BOOST_PP_IS_EMPTY(DATA BOOST_PP_EMPTY()) == 1 END +BEGIN BOOST_PP_IS_EMPTY(x BOOST_PP_EMPTY()) == 0 END +BEGIN BOOST_PP_IS_EMPTY(OBJECT BOOST_PP_EMPTY()) == 1 END +BEGIN BOOST_PP_IS_EMPTY(FUNC(z) BOOST_PP_EMPTY()) == 1 END +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN6) == 0 END +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN7) == 0 END +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN9) == 0 END + #endif diff --git a/test/isempty_failure.c b/test/isempty_failure.c new file mode 100644 index 0000000..db891ba --- /dev/null +++ b/test/isempty_failure.c @@ -0,0 +1,12 @@ +# /* ************************************************************************** +# * * +# * (C) Copyright Edward Diener 2014. +# * 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. */ +# +# include diff --git a/test/isempty_failure.cpp b/test/isempty_failure.cpp new file mode 100644 index 0000000..db891ba --- /dev/null +++ b/test/isempty_failure.cpp @@ -0,0 +1,12 @@ +# /* ************************************************************************** +# * * +# * (C) Copyright Edward Diener 2014. +# * 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. */ +# +# include diff --git a/test/isempty_failure.cxx b/test/isempty_failure.cxx new file mode 100644 index 0000000..f6a4179 --- /dev/null +++ b/test/isempty_failure.cxx @@ -0,0 +1,25 @@ +# /* ************************************************************************** +# * * +# * (C) Copyright Edward Diener 2014. +# * 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. */ +# +# include +# include + +#if !BOOST_PP_VARIADICS && (~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MSVC()) && (~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MWCC()) + +#define NAME &name + +BEGIN BOOST_PP_IS_EMPTY(NAME) == 0 END + +#else + +BEGIN 1 == 0 END + +#endif diff --git a/test/isempty_failure2.c b/test/isempty_failure2.c new file mode 100644 index 0000000..cb5aa2e --- /dev/null +++ b/test/isempty_failure2.c @@ -0,0 +1,12 @@ +# /* ************************************************************************** +# * * +# * (C) Copyright Edward Diener 2014. +# * 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. */ +# +# include diff --git a/test/isempty_failure2.cpp b/test/isempty_failure2.cpp new file mode 100644 index 0000000..cb5aa2e --- /dev/null +++ b/test/isempty_failure2.cpp @@ -0,0 +1,12 @@ +# /* ************************************************************************** +# * * +# * (C) Copyright Edward Diener 2014. +# * 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. */ +# +# include diff --git a/test/isempty_failure2.cxx b/test/isempty_failure2.cxx new file mode 100644 index 0000000..397774b --- /dev/null +++ b/test/isempty_failure2.cxx @@ -0,0 +1,25 @@ +# /* ************************************************************************** +# * * +# * (C) Copyright Edward Diener 2014. +# * 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. */ +# +# include +# include + +#if !BOOST_PP_VARIADICS && (~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MSVC()) && (~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MWCC()) + +#define ATUPLE_PLUS (atuple) data + +BEGIN BOOST_PP_IS_EMPTY(ATUPLE_PLUS) == 0 END + +#else + +BEGIN 1 == 0 END + +#endif diff --git a/test/isempty_variadic_standard_failure.c b/test/isempty_variadic_standard_failure.c new file mode 100644 index 0000000..36f6ff7 --- /dev/null +++ b/test/isempty_variadic_standard_failure.c @@ -0,0 +1,12 @@ +# /* ************************************************************************** +# * * +# * (C) Copyright Edward Diener 2014. +# * 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. */ +# +# include diff --git a/test/isempty_variadic_standard_failure.cpp b/test/isempty_variadic_standard_failure.cpp new file mode 100644 index 0000000..36f6ff7 --- /dev/null +++ b/test/isempty_variadic_standard_failure.cpp @@ -0,0 +1,12 @@ +# /* ************************************************************************** +# * * +# * (C) Copyright Edward Diener 2014. +# * 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. */ +# +# include diff --git a/test/isempty_variadic_standard_failure.cxx b/test/isempty_variadic_standard_failure.cxx new file mode 100644 index 0000000..d4403bf --- /dev/null +++ b/test/isempty_variadic_standard_failure.cxx @@ -0,0 +1,25 @@ +# /* ************************************************************************** +# * * +# * (C) Copyright Edward Diener 2014. +# * 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. */ +# +# include +# include + +#if BOOST_PP_VARIADICS && !defined(BOOST_PP_VARIADICS_MSVC) + +#define FUNC_GEN8(x,y) (1,2,3) + +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN8) == 0 END + +#else + +BEGIN 1 == 0 END + +#endif diff --git a/test/isempty_variadic_standard_failure2.c b/test/isempty_variadic_standard_failure2.c new file mode 100644 index 0000000..a2aa690 --- /dev/null +++ b/test/isempty_variadic_standard_failure2.c @@ -0,0 +1,12 @@ +# /* ************************************************************************** +# * * +# * (C) Copyright Edward Diener 2014. +# * 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. */ +# +# include diff --git a/test/isempty_variadic_standard_failure2.cpp b/test/isempty_variadic_standard_failure2.cpp new file mode 100644 index 0000000..a2aa690 --- /dev/null +++ b/test/isempty_variadic_standard_failure2.cpp @@ -0,0 +1,12 @@ +# /* ************************************************************************** +# * * +# * (C) Copyright Edward Diener 2014. +# * 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. */ +# +# include diff --git a/test/isempty_variadic_standard_failure2.cxx b/test/isempty_variadic_standard_failure2.cxx new file mode 100644 index 0000000..38a6600 --- /dev/null +++ b/test/isempty_variadic_standard_failure2.cxx @@ -0,0 +1,25 @@ +# /* ************************************************************************** +# * * +# * (C) Copyright Edward Diener 2014. +# * 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. */ +# +# include +# include + +#if BOOST_PP_VARIADICS && !defined(BOOST_PP_VARIADICS_MSVC) + +#define FUNC_GEN9(x,y,z) anything + +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN9) == 0 END + +#else + +BEGIN 1 == 0 END + +#endif diff --git a/test/tuple.cxx b/test/tuple.cxx index d5d941a..c315509 100644 --- a/test/tuple.cxx +++ b/test/tuple.cxx @@ -7,10 +7,12 @@ # * * # ************************************************************************** */ # -# /* Revised by Edward Diener (2011) */ +# /* Revised by Edward Diener (2011,2014) */ # # /* See http://www.boost.org for most recent version. */ # +# include +# include # include # include # include @@ -20,6 +22,7 @@ # include # endif # include +# include # define TUPLE (0, 1, 2, 3, 4, 5) # define TUPLE_LARGE (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32) diff --git a/test/tuple_elem_bug_test.cxx b/test/tuple_elem_bug_test.cxx new file mode 100644 index 0000000..56e36a6 --- /dev/null +++ b/test/tuple_elem_bug_test.cxx @@ -0,0 +1,38 @@ +# /* ************************************************************************** +# * * +# * (C) Copyright Edward Diener 2014. +# * 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. */ +# +# include +# include +# include +# include + +#define TN_GEN_ONE(p) (1) +#define TN_GEN_ZERO(p) (0) +#define TN_TEST_ONE_MORE(parameter,ens) \ + BOOST_PP_IF \ + ( \ + BOOST_PP_CAT(BOOST_PP_TUPLE_ELEM(1,0,ens),0), \ + TN_GEN_ONE, \ + TN_GEN_ZERO \ + ) \ + (parameter) \ +/**/ +#define TN_TEST_ONE(parameter,ens) \ + BOOST_PP_TUPLE_ELEM \ + ( \ + 1, \ + 0, \ + TN_TEST_ONE_MORE(parameter,ens) \ + ) \ +/**/ + +BEGIN TN_TEST_ONE(A,(1)) == 1 END +BEGIN TN_TEST_ONE(A,()) == 0 END From ea91a3defa767b5b4d871c05d4a7b463c11f42f4 Mon Sep 17 00:00:00 2001 From: Edward Diener Date: Wed, 30 Apr 2014 16:15:57 -0400 Subject: [PATCH 28/58] Added variadic is_empty tests. --- test/Jamfile.v2 | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index ac61214..533e400 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -179,12 +179,12 @@ test-suite preprocessor_c_nvm ] ; -# test-suite preprocessor_isempty -# : -# [ compile isempty.cpp : gcc:-std=c++0x ] -# [ compile-fail isempty_variadic_standard_failure.cpp : gcc:-std=c++0x ] -# [ compile-fail isempty_variadic_standard_failure2.cpp : gcc:-std=c++0x ] -# ; +test-suite preprocessor_isempty + : + [ compile isempty.cpp : gcc:-std=c++0x ] + [ compile-fail isempty_variadic_standard_failure.cpp : gcc:-std=c++0x ] + [ compile-fail isempty_variadic_standard_failure2.cpp : gcc:-std=c++0x ] + ; test-suite preprocessor_isempty_nvm : @@ -193,21 +193,21 @@ test-suite preprocessor_isempty_nvm [ compile-fail isempty_failure2.cpp : BOOST_PP_VARIADICS=0 : isempty_failure2_nvm ] ; -# test-suite preprocessor_isempty_c -# : -# [ compile isempty.c -# : gcc:-std=c99 -# : isempty_c -# ] -# [ compile-fail isempty_variadic_standard_failure.c -# : gcc:-std=c99 -# : isempty_variadic_standard_failure_c -# ] -# [ compile-fail isempty_variadic_standard_failure2.c -# : gcc:-std=c99 -# : isempty_variadic_standard_failure2_c -# ] -# ; +test-suite preprocessor_isempty_c + : + [ compile isempty.c + : gcc:-std=c99 + : isempty_c + ] + [ compile-fail isempty_variadic_standard_failure.c + : gcc:-std=c99 + : isempty_variadic_standard_failure_c + ] + [ compile-fail isempty_variadic_standard_failure2.c + : gcc:-std=c99 + : isempty_variadic_standard_failure2_c + ] + ; test-suite preprocessor_isempty_c_nvm : From b3b9e80f86642866fe90ba8a528e01447d428039 Mon Sep 17 00:00:00 2001 From: Edward Diener Date: Thu, 1 May 2014 01:20:12 -0400 Subject: [PATCH 29/58] Updated tests for strict compilers or VC++ --- test/isempty.cxx | 6 ++++++ test/isempty_failure.cxx | 2 +- test/isempty_failure2.cxx | 2 +- test/isempty_variadic_standard_failure.cxx | 2 +- test/isempty_variadic_standard_failure2.cxx | 2 +- 5 files changed, 10 insertions(+), 4 deletions(-) diff --git a/test/isempty.cxx b/test/isempty.cxx index cf2660f..bcf5b48 100644 --- a/test/isempty.cxx +++ b/test/isempty.cxx @@ -9,6 +9,10 @@ # # /* See http://www.boost.org for most recent version. */ # +# include +# +#if (BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_STRICT()) || (BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MSVC()) + # include # include # include @@ -137,3 +141,5 @@ BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN7) == 0 END BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN9) == 0 END #endif + +#endif diff --git a/test/isempty_failure.cxx b/test/isempty_failure.cxx index f6a4179..72fbac3 100644 --- a/test/isempty_failure.cxx +++ b/test/isempty_failure.cxx @@ -12,7 +12,7 @@ # include # include -#if !BOOST_PP_VARIADICS && (~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MSVC()) && (~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MWCC()) +#if !BOOST_PP_VARIADICS && (BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_STRICT()) && (~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MSVC()) && (~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MWCC()) #define NAME &name diff --git a/test/isempty_failure2.cxx b/test/isempty_failure2.cxx index 397774b..eded627 100644 --- a/test/isempty_failure2.cxx +++ b/test/isempty_failure2.cxx @@ -12,7 +12,7 @@ # include # include -#if !BOOST_PP_VARIADICS && (~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MSVC()) && (~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MWCC()) +#if !BOOST_PP_VARIADICS && (BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_STRICT()) && (~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MSVC()) && (~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MWCC()) #define ATUPLE_PLUS (atuple) data diff --git a/test/isempty_variadic_standard_failure.cxx b/test/isempty_variadic_standard_failure.cxx index d4403bf..bfbbc9d 100644 --- a/test/isempty_variadic_standard_failure.cxx +++ b/test/isempty_variadic_standard_failure.cxx @@ -12,7 +12,7 @@ # include # include -#if BOOST_PP_VARIADICS && !defined(BOOST_PP_VARIADICS_MSVC) +#if BOOST_PP_VARIADICS && (BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_STRICT()) && !defined(BOOST_PP_VARIADICS_MSVC) #define FUNC_GEN8(x,y) (1,2,3) diff --git a/test/isempty_variadic_standard_failure2.cxx b/test/isempty_variadic_standard_failure2.cxx index 38a6600..d730626 100644 --- a/test/isempty_variadic_standard_failure2.cxx +++ b/test/isempty_variadic_standard_failure2.cxx @@ -12,7 +12,7 @@ # include # include -#if BOOST_PP_VARIADICS && !defined(BOOST_PP_VARIADICS_MSVC) +#if BOOST_PP_VARIADICS && (BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_STRICT()) && !defined(BOOST_PP_VARIADICS_MSVC) #define FUNC_GEN9(x,y,z) anything From 6c091d7f990b3bac3fb9845cc774a67b1c71dd3c Mon Sep 17 00:00:00 2001 From: Edward Diener Date: Thu, 1 May 2014 23:21:05 -0400 Subject: [PATCH 30/58] Removed tests which involve undefined behavior. --- test/Jamfile.v2 | 12 ------------ test/isempty.cxx | 2 +- test/isempty_failure.c | 12 ------------ test/isempty_failure.cpp | 12 ------------ test/isempty_failure.cxx | 25 ------------------------- test/isempty_failure2.c | 12 ------------ test/isempty_failure2.cpp | 12 ------------ test/isempty_failure2.cxx | 25 ------------------------- 8 files changed, 1 insertion(+), 111 deletions(-) delete mode 100644 test/isempty_failure.c delete mode 100644 test/isempty_failure.cpp delete mode 100644 test/isempty_failure.cxx delete mode 100644 test/isempty_failure2.c delete mode 100644 test/isempty_failure2.cpp delete mode 100644 test/isempty_failure2.cxx diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index 533e400..5e91c86 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -189,8 +189,6 @@ test-suite preprocessor_isempty test-suite preprocessor_isempty_nvm : [ compile isempty.cpp : BOOST_PP_VARIADICS=0 : isempty_nvm ] - [ compile-fail isempty_failure.cpp : BOOST_PP_VARIADICS=0 : isempty_failure_nvm ] - [ compile-fail isempty_failure2.cpp : BOOST_PP_VARIADICS=0 : isempty_failure2_nvm ] ; test-suite preprocessor_isempty_c @@ -216,14 +214,4 @@ test-suite preprocessor_isempty_c_nvm gcc:-std=c99 : isempty_c_nvm ] - [ compile-fail isempty_failure.c - : BOOST_PP_VARIADICS=0 - gcc:-std=c99 - : isempty_failure_c_nvm - ] - [ compile-fail isempty_failure2.c - : BOOST_PP_VARIADICS=0 - gcc:-std=c99 - : isempty_failure2_c_nvm - ] ; diff --git a/test/isempty.cxx b/test/isempty.cxx index bcf5b48..d0c3776 100644 --- a/test/isempty.cxx +++ b/test/isempty.cxx @@ -119,7 +119,7 @@ BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN5) == 0 END BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN8) == 0 END BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN10) == 0 END -/* COMPILER ERROR */ +/* UNDEFINED BEHAVIOR */ // BEGIN BOOST_PP_IS_EMPTY(ATUPLE) == 0 END // BEGIN BOOST_PP_IS_EMPTY(ATUPLE_PLUS) == 1 END diff --git a/test/isempty_failure.c b/test/isempty_failure.c deleted file mode 100644 index db891ba..0000000 --- a/test/isempty_failure.c +++ /dev/null @@ -1,12 +0,0 @@ -# /* ************************************************************************** -# * * -# * (C) Copyright Edward Diener 2014. -# * 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. */ -# -# include diff --git a/test/isempty_failure.cpp b/test/isempty_failure.cpp deleted file mode 100644 index db891ba..0000000 --- a/test/isempty_failure.cpp +++ /dev/null @@ -1,12 +0,0 @@ -# /* ************************************************************************** -# * * -# * (C) Copyright Edward Diener 2014. -# * 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. */ -# -# include diff --git a/test/isempty_failure.cxx b/test/isempty_failure.cxx deleted file mode 100644 index 72fbac3..0000000 --- a/test/isempty_failure.cxx +++ /dev/null @@ -1,25 +0,0 @@ -# /* ************************************************************************** -# * * -# * (C) Copyright Edward Diener 2014. -# * 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. */ -# -# include -# include - -#if !BOOST_PP_VARIADICS && (BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_STRICT()) && (~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MSVC()) && (~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MWCC()) - -#define NAME &name - -BEGIN BOOST_PP_IS_EMPTY(NAME) == 0 END - -#else - -BEGIN 1 == 0 END - -#endif diff --git a/test/isempty_failure2.c b/test/isempty_failure2.c deleted file mode 100644 index cb5aa2e..0000000 --- a/test/isempty_failure2.c +++ /dev/null @@ -1,12 +0,0 @@ -# /* ************************************************************************** -# * * -# * (C) Copyright Edward Diener 2014. -# * 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. */ -# -# include diff --git a/test/isempty_failure2.cpp b/test/isempty_failure2.cpp deleted file mode 100644 index cb5aa2e..0000000 --- a/test/isempty_failure2.cpp +++ /dev/null @@ -1,12 +0,0 @@ -# /* ************************************************************************** -# * * -# * (C) Copyright Edward Diener 2014. -# * 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. */ -# -# include diff --git a/test/isempty_failure2.cxx b/test/isempty_failure2.cxx deleted file mode 100644 index eded627..0000000 --- a/test/isempty_failure2.cxx +++ /dev/null @@ -1,25 +0,0 @@ -# /* ************************************************************************** -# * * -# * (C) Copyright Edward Diener 2014. -# * 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. */ -# -# include -# include - -#if !BOOST_PP_VARIADICS && (BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_STRICT()) && (~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MSVC()) && (~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MWCC()) - -#define ATUPLE_PLUS (atuple) data - -BEGIN BOOST_PP_IS_EMPTY(ATUPLE_PLUS) == 0 END - -#else - -BEGIN 1 == 0 END - -#endif From ec93b32f82c7464452f4c62a2c039208d65bbbb3 Mon Sep 17 00:00:00 2001 From: Edward Diener Date: Fri, 2 May 2014 02:59:10 -0400 Subject: [PATCH 31/58] Corrected calculation _msc_ver number. --- include/boost/preprocessor/array/detail/get_data.hpp | 4 ++-- include/boost/preprocessor/tuple/rem.hpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/boost/preprocessor/array/detail/get_data.hpp b/include/boost/preprocessor/array/detail/get_data.hpp index d978109..fafa498 100644 --- a/include/boost/preprocessor/array/detail/get_data.hpp +++ b/include/boost/preprocessor/array/detail/get_data.hpp @@ -15,7 +15,7 @@ # include # include # -# if BOOST_PP_VARIADICS && BOOST_PP_VARIADICS_MSVC && _MSC_VER != 1400 +# if BOOST_PP_VARIADICS && BOOST_PP_VARIADICS_MSVC && _MSC_VER > 1400 # include # include # include @@ -45,6 +45,6 @@ /**/ # else # define BOOST_PP_ARRAY_DETAIL_GET_DATA(size, data) BOOST_PP_TUPLE_REM(size) data -# endif /* BOOST_PP_VARIADICS && BOOST_PP_VARIADICS_MSVC && _MSC_VER != 1400 */ +# endif /* BOOST_PP_VARIADICS && BOOST_PP_VARIADICS_MSVC && _MSC_VER > 1400 */ # # endif /* BOOST_PREPROCESSOR_ARRAY_DETAIL_GET_DATA_HPP */ diff --git a/include/boost/preprocessor/tuple/rem.hpp b/include/boost/preprocessor/tuple/rem.hpp index 136d282..78e47fe 100644 --- a/include/boost/preprocessor/tuple/rem.hpp +++ b/include/boost/preprocessor/tuple/rem.hpp @@ -37,7 +37,7 @@ /* VC++8.0 cannot handle the variadic version of BOOST_PP_TUPLE_REM(size) */ -# if BOOST_PP_VARIADICS && !(BOOST_PP_VARIADICS_MSVC && _MSC_VER == 1400) +# if BOOST_PP_VARIADICS && !(BOOST_PP_VARIADICS_MSVC && _MSC_VER <= 1400) # if BOOST_PP_VARIADICS_MSVC /* To be used internally when the size is 1 */ # define BOOST_PP_TUPLE_REM_CAT(size) BOOST_PP_REM_CAT From 6590e41581b0474ddb18dc6a8abf846c46a2eb48 Mon Sep 17 00:00:00 2001 From: Edward Diener Date: Fri, 2 May 2014 20:17:08 -0400 Subject: [PATCH 32/58] Further tests of changes involving empty data. --- test/array.cxx | 5 +++++ test/list.cxx | 2 ++ test/seq.cxx | 3 +++ test/tuple.cxx | 13 ++++++++++++- 4 files changed, 22 insertions(+), 1 deletion(-) diff --git a/test/array.cxx b/test/array.cxx index ae3a275..a764077 100644 --- a/test/array.cxx +++ b/test/array.cxx @@ -21,6 +21,7 @@ # include # endif +# define ARRAY_EMPTY (0, ()) # define ARRAY (3, (0, 1, 2)) # define ARRAY_LARGE (33, (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32)) # define ARRAY_VERY_LARGE (64, (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63)) @@ -124,15 +125,19 @@ BEGIN BOOST_PP_ARRAY_ELEM(55, BOOST_PP_ARRAY_POP_FRONT(ARRAY_VERY_LARGE)) == 56 BEGIN BOOST_PP_ARRAY_SIZE(BOOST_PP_ARRAY_PUSH_BACK(ARRAY, 3)) == 4 END BEGIN BOOST_PP_ARRAY_SIZE(BOOST_PP_ARRAY_PUSH_BACK(ARRAY_LARGE, 33)) == 34 END +BEGIN BOOST_PP_ARRAY_SIZE(BOOST_PP_ARRAY_PUSH_BACK(ARRAY_EMPTY, 10)) == 1 END BEGIN BOOST_PP_ARRAY_ELEM(0, BOOST_PP_ARRAY_PUSH_BACK(ARRAY, 3)) == 0 END BEGIN BOOST_PP_ARRAY_ELEM(33, BOOST_PP_ARRAY_PUSH_BACK(ARRAY_LARGE, 33)) == 33 END +BEGIN BOOST_PP_ARRAY_ELEM(0, BOOST_PP_ARRAY_PUSH_BACK(ARRAY_EMPTY, 136)) == 136 END // push_front BEGIN BOOST_PP_ARRAY_SIZE(BOOST_PP_ARRAY_PUSH_FRONT(ARRAY, 555)) == 4 END BEGIN BOOST_PP_ARRAY_SIZE(BOOST_PP_ARRAY_PUSH_FRONT(ARRAY_LARGE, 666)) == 34 END +BEGIN BOOST_PP_ARRAY_SIZE(BOOST_PP_ARRAY_PUSH_FRONT(ARRAY_EMPTY, 10)) == 1 END BEGIN BOOST_PP_ARRAY_ELEM(0, BOOST_PP_ARRAY_PUSH_FRONT(ARRAY, 555)) == 555 END BEGIN BOOST_PP_ARRAY_ELEM(33, BOOST_PP_ARRAY_PUSH_FRONT(ARRAY_LARGE, 33)) == 32 END +BEGIN BOOST_PP_ARRAY_ELEM(0, BOOST_PP_ARRAY_PUSH_FRONT(ARRAY_EMPTY, 136)) == 136 END // remove diff --git a/test/list.cxx b/test/list.cxx index db6c432..2f16086 100644 --- a/test/list.cxx +++ b/test/list.cxx @@ -19,6 +19,7 @@ # include # include # include +# include # include # include # include @@ -77,4 +78,5 @@ BEGIN BOOST_PP_LIST_FOR_EACH_PRODUCT(F2, 2, ( (1, (0, BOOST_PP_NIL)), (2, (3, BO BEGIN BOOST_PP_LIST_CAT(BOOST_PP_LIST_FOLD_LEFT(BOOST_PP_LIST_APPEND_D, BOOST_PP_NIL, LL)) == 0x0a1b2c3d END BEGIN BOOST_PP_ARRAY_ELEM(2, BOOST_PP_LIST_TO_ARRAY(LIST)) == 5 END +BEGIN BOOST_PP_ARRAY_SIZE(BOOST_PP_LIST_TO_ARRAY(LISTNIL)) == 0 END BEGIN BOOST_PP_SEQ_ELEM(3, BOOST_PP_LIST_TO_SEQ(LIST)) == 2 END diff --git a/test/seq.cxx b/test/seq.cxx index c64085d..b73ea99 100644 --- a/test/seq.cxx +++ b/test/seq.cxx @@ -16,6 +16,7 @@ # include # include # include +# include # include # include # include @@ -23,6 +24,7 @@ # include # include +# define SEQ_NONE () # define SEQ (4)(1)(5)(2) # define SEQVAR (4,5,8,3,61)(1,0)(5,22,43)(2)(17,45,33) @@ -98,6 +100,7 @@ BEGIN BOOST_PP_SEQ_CAT(BOOST_PP_SEQ_TAIL(BOOST_PP_SEQ_FOLD_LEFT(SEQ_APPEND, (~), BEGIN BOOST_PP_SEQ_SIZE(BOOST_PP_SEQ_TAIL(BOOST_PP_SEQ_FOLD_LEFT(SEQ_APPEND, (~), LL))) == 9 END BEGIN BOOST_PP_LIST_AT(BOOST_PP_SEQ_TO_LIST(SEQ), 2) == 5 END +BEGIN BOOST_PP_IS_EMPTY(BOOST_PP_LIST_AT(BOOST_PP_SEQ_TO_LIST(SEQ_NONE),0)) == 1 END #if BOOST_PP_VARIADICS diff --git a/test/tuple.cxx b/test/tuple.cxx index c315509..9187ff5 100644 --- a/test/tuple.cxx +++ b/test/tuple.cxx @@ -17,6 +17,7 @@ # include # include # include +# include # if BOOST_PP_VARIADICS # include # include @@ -25,6 +26,7 @@ # include # define TUPLE (0, 1, 2, 3, 4, 5) +# define TUPLE_NONE () # define TUPLE_LARGE (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32) # define TUPLE_VERY_LARGE (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63) # define T2 (+3, /2, +6) @@ -47,6 +49,7 @@ // elem +BEGIN BOOST_PP_IS_EMPTY(BOOST_PP_TUPLE_ELEM(1, 0, TUPLE_NONE)) == 1 END BEGIN BOOST_PP_TUPLE_ELEM(6, 3, TUPLE) == 3 END BEGIN BOOST_PP_TUPLE_ELEM(6, 5, TUPLE) == 5 END BEGIN BOOST_PP_TUPLE_ELEM(33, 15, TUPLE_LARGE) == 15 END @@ -92,6 +95,7 @@ BEGIN BOOST_PP_SEQ_ELEM(55,BOOST_PP_TUPLE_TO_SEQ(64,TUPLE_VERY_LARGE)) == 55 END // elem +BEGIN BOOST_PP_IS_EMPTY(BOOST_PP_TUPLE_ELEM(0, TUPLE_NONE)) == 1 END BEGIN BOOST_PP_TUPLE_ELEM(3, TUPLE) == 3 END BEGIN BOOST_PP_TUPLE_ELEM(5, TUPLE) == 5 END BEGIN BOOST_PP_TUPLE_ELEM(15, TUPLE_LARGE) == 15 END @@ -161,7 +165,7 @@ BEGIN BOOST_PP_TUPLE_ELEM(33, BOOST_PP_TUPLE_PUSH_FRONT(TUPLE_LARGE, 33)) == 32 // rem -#if BOOST_PP_VARIADICS_MSVC && _MSC_VER == 1400 +#if BOOST_PP_VARIADICS_MSVC && _MSC_VER <= 1400 BEGIN BOOST_PP_VARIADIC_SIZE(BOOST_PP_TUPLE_REM(6)(0, 1, 2, 3, 4, 5)) == 6 END BEGIN BOOST_PP_VARIADIC_SIZE(BOOST_PP_TUPLE_REM(33)(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32)) == 33 END @@ -169,6 +173,12 @@ BEGIN BOOST_PP_VARIADIC_SIZE(BOOST_PP_TUPLE_REM(64)(0, 1, 2, 3, 4, 5, 6, 7, 8, 9 #else +#if BOOST_PP_VARIADICS_MSVC +BEGIN BOOST_PP_IS_EMPTY(BOOST_PP_TUPLE_REM_CAT() TUPLE_NONE) == 1 END +#else +BEGIN BOOST_PP_IS_EMPTY(BOOST_PP_TUPLE_REM() TUPLE_NONE) == 1 END +#endif + BEGIN BOOST_PP_VARIADIC_SIZE(BOOST_PP_TUPLE_REM()(0, 1, 2, 3, 4, 5)) == 6 END BEGIN BOOST_PP_VARIADIC_SIZE(BOOST_PP_TUPLE_REM()(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32)) == 33 END BEGIN BOOST_PP_VARIADIC_SIZE(BOOST_PP_TUPLE_REM()(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63)) == 64 END @@ -177,6 +187,7 @@ BEGIN BOOST_PP_VARIADIC_SIZE(BOOST_PP_TUPLE_REM()(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, // rem_ctor +BEGIN BOOST_PP_VARIADIC_SIZE(BOOST_PP_TUPLE_REM_CTOR(TUPLE_NONE)) == 1 END BEGIN BOOST_PP_VARIADIC_SIZE(BOOST_PP_TUPLE_REM_CTOR(TUPLE)) == 6 END BEGIN BOOST_PP_VARIADIC_SIZE(BOOST_PP_TUPLE_REM_CTOR(TUPLE_LARGE)) == 33 END BEGIN BOOST_PP_VARIADIC_SIZE(BOOST_PP_TUPLE_REM_CTOR(TUPLE_VERY_LARGE)) == 64 END From 9dfce3363c7ddb3157be843e28f77ed01b5b19aa Mon Sep 17 00:00:00 2001 From: Edward Diener Date: Sat, 3 May 2014 02:15:47 -0400 Subject: [PATCH 33/58] Added remove_parens and tests. --- include/boost/preprocessor/punctuation.hpp | 1 + .../punctuation/remove_parens.hpp | 39 +++++++++++++++++++ test/punctuation.cxx | 12 ++++++ 3 files changed, 52 insertions(+) create mode 100644 include/boost/preprocessor/punctuation/remove_parens.hpp diff --git a/include/boost/preprocessor/punctuation.hpp b/include/boost/preprocessor/punctuation.hpp index a96bbff..56dd064 100644 --- a/include/boost/preprocessor/punctuation.hpp +++ b/include/boost/preprocessor/punctuation.hpp @@ -17,5 +17,6 @@ # include # include # include +# include # # endif diff --git a/include/boost/preprocessor/punctuation/remove_parens.hpp b/include/boost/preprocessor/punctuation/remove_parens.hpp new file mode 100644 index 0000000..4700936 --- /dev/null +++ b/include/boost/preprocessor/punctuation/remove_parens.hpp @@ -0,0 +1,39 @@ +# /* ************************************************************************** +# * * +# * (C) Copyright Edward Diener 2014. +# * 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_REMOVE_PARENS_HPP +#define BOOST_PREPROCESSOR_REMOVE_PARENS_HPP + +#include + +#if BOOST_PP_VARIADICS + +#include +#include +#include +#include + +#define BOOST_PP_REMOVE_PARENS(param) \ + BOOST_PP_IIF \ + ( \ + BOOST_PP_IS_BEGIN_PARENS(param), \ + BOOST_PP_REMOVE_PARENS_DO, \ + BOOST_PP_IDENTITY \ + ) \ + (param)() \ +/**/ + +#define BOOST_PP_REMOVE_PARENS_DO(param) \ + BOOST_PP_IDENTITY(BOOST_PP_TUPLE_ENUM(param)) \ +/**/ + +#endif /* BOOST_PP_VARIADICS */ +#endif /* BOOST_PREPROCESSOR_REMOVE_PARENS_HPP */ diff --git a/test/punctuation.cxx b/test/punctuation.cxx index 3eb364b..8e60e9a 100644 --- a/test/punctuation.cxx +++ b/test/punctuation.cxx @@ -23,6 +23,11 @@ # define A_SEQ (r)($)(#) # define AN_ARRAY (4,(5,7,f,x)) # define A_LIST (e,(g,(&,BOOST_PP_NIL))) +# define DATA (5 + 3) * 4 +# define DATA2 4 * (5 + 3) +# define DATA3 4 * (5 + 3) * (2 + 1) +# define DATA4 (5 + 3) * (2 + 1) * 4 + // is_begin_parens @@ -39,4 +44,11 @@ BEGIN BOOST_PP_IS_BEGIN_PARENS(AN_ARRAY) == 1 END BEGIN BOOST_PP_IS_BEGIN_PARENS(A_LIST) == 1 END BEGIN BOOST_PP_IS_BEGIN_PARENS((y)2(x)) == 1 END +// remove_parens + +BEGIN BOOST_PP_REMOVE_PARENS(DATA) == 17 END +BEGIN BOOST_PP_REMOVE_PARENS(DATA2)== 32 END +BEGIN BOOST_PP_REMOVE_PARENS(DATA3)== 96 END +BEGIN BOOST_PP_REMOVE_PARENS(DATA4)== 41 END + #endif From fb732aaab5d70720a9bc75affb91f8e8d0a129f9 Mon Sep 17 00:00:00 2001 From: Edward Diener Date: Sun, 4 May 2014 03:07:00 -0400 Subject: [PATCH 34/58] Fixes for empty conversions and tests for empty conversions. --- include/boost/preprocessor/array/to_list.hpp | 20 +++++++++++-- include/boost/preprocessor/list/to_array.hpp | 17 +++++++++++ include/boost/preprocessor/tuple/to_seq.hpp | 3 ++ test/array.cxx | 10 +++++++ test/list.cxx | 30 +++++++++++++------- test/seq.cxx | 15 ++++++++++ test/tuple.cxx | 15 ++++++++++ 7 files changed, 96 insertions(+), 14 deletions(-) diff --git a/include/boost/preprocessor/array/to_list.hpp b/include/boost/preprocessor/array/to_list.hpp index 9198561..4cb45b6 100644 --- a/include/boost/preprocessor/array/to_list.hpp +++ b/include/boost/preprocessor/array/to_list.hpp @@ -15,19 +15,33 @@ # # include # include +# include +# include # include # # /* BOOST_PP_ARRAY_TO_LIST */ # +# define BOOST_PP_ARRAY_TO_LIST(array) \ + BOOST_PP_IF \ + ( \ + BOOST_PP_ARRAY_SIZE(array), \ + BOOST_PP_ARRAY_TO_LIST_DO, \ + BOOST_PP_ARRAY_TO_LIST_EMPTY \ + ) \ + (array) \ +/**/ +# +# define BOOST_PP_ARRAY_TO_LIST_EMPTY(array) BOOST_PP_NIL +# # if BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MSVC() -# define BOOST_PP_ARRAY_TO_LIST(array) BOOST_PP_ARRAY_TO_LIST_I(BOOST_PP_TUPLE_TO_LIST, array) +# define BOOST_PP_ARRAY_TO_LIST_DO(array) BOOST_PP_ARRAY_TO_LIST_I(BOOST_PP_TUPLE_TO_LIST, array) # define BOOST_PP_ARRAY_TO_LIST_I(m, args) BOOST_PP_ARRAY_TO_LIST_II(m, args) # define BOOST_PP_ARRAY_TO_LIST_II(m, args) BOOST_PP_CAT(m ## args,) # elif BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MWCC() -# define BOOST_PP_ARRAY_TO_LIST(array) BOOST_PP_ARRAY_TO_LIST_I(array) +# define BOOST_PP_ARRAY_TO_LIST_DO(array) BOOST_PP_ARRAY_TO_LIST_I(array) # define BOOST_PP_ARRAY_TO_LIST_I(array) BOOST_PP_TUPLE_TO_LIST ## array # else -# define BOOST_PP_ARRAY_TO_LIST(array) BOOST_PP_TUPLE_TO_LIST array +# define BOOST_PP_ARRAY_TO_LIST_DO(array) BOOST_PP_TUPLE_TO_LIST array # endif # # endif diff --git a/include/boost/preprocessor/list/to_array.hpp b/include/boost/preprocessor/list/to_array.hpp index 5a0433d..3711d4c 100644 --- a/include/boost/preprocessor/list/to_array.hpp +++ b/include/boost/preprocessor/list/to_array.hpp @@ -21,10 +21,27 @@ # include # include # include +# if BOOST_PP_VARIADICS && BOOST_PP_VARIADICS_MSVC && (_MSC_VER <= 1400) +# include +# endif # # /* BOOST_PP_LIST_TO_ARRAY */ # +# if BOOST_PP_VARIADICS && BOOST_PP_VARIADICS_MSVC && (_MSC_VER <= 1400) +# define BOOST_PP_LIST_TO_ARRAY(list) \ + BOOST_PP_IIF \ + ( \ + BOOST_PP_LIST_IS_NIL(list), \ + BOOST_PP_LIST_TO_ARRAY_VC8ORLESS_EMPTY, \ + BOOST_PP_LIST_TO_ARRAY_VC8ORLESS_DO \ + ) \ + (list) \ +/**/ +# define BOOST_PP_LIST_TO_ARRAY_VC8ORLESS_EMPTY(list) (0,()) +# define BOOST_PP_LIST_TO_ARRAY_VC8ORLESS_DO(list) BOOST_PP_LIST_TO_ARRAY_I(BOOST_PP_WHILE, list) +# else # define BOOST_PP_LIST_TO_ARRAY(list) BOOST_PP_LIST_TO_ARRAY_I(BOOST_PP_WHILE, list) +# endif # if BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MSVC() # define BOOST_PP_LIST_TO_ARRAY_I(w, list) \ diff --git a/include/boost/preprocessor/tuple/to_seq.hpp b/include/boost/preprocessor/tuple/to_seq.hpp index 8bd8485..a53f5a0 100644 --- a/include/boost/preprocessor/tuple/to_seq.hpp +++ b/include/boost/preprocessor/tuple/to_seq.hpp @@ -48,6 +48,9 @@ # endif # endif # +/* An empty array can be passed */ +# define BOOST_PP_TUPLE_TO_SEQ_0() () +# # define BOOST_PP_TUPLE_TO_SEQ_1(e0) (e0) # define BOOST_PP_TUPLE_TO_SEQ_2(e0, e1) (e0)(e1) # define BOOST_PP_TUPLE_TO_SEQ_3(e0, e1, e2) (e0)(e1)(e2) diff --git a/test/array.cxx b/test/array.cxx index a764077..fd189c7 100644 --- a/test/array.cxx +++ b/test/array.cxx @@ -13,9 +13,13 @@ # # include # include +# include # include +# include # include +# include # include +# include # if BOOST_PP_VARIADICS # include # include @@ -67,6 +71,7 @@ BEGIN BOOST_PP_LIST_AT(BOOST_PP_ARRAY_TO_LIST(ARRAY), 1) == 1 END BEGIN BOOST_PP_LIST_AT(BOOST_PP_ARRAY_TO_LIST((5, (0, 1, 2, 3, 4))), 4) == 4 END BEGIN BOOST_PP_LIST_AT(BOOST_PP_ARRAY_TO_LIST((33, (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32))), 26) == 26 END BEGIN BOOST_PP_LIST_AT(BOOST_PP_ARRAY_TO_LIST(ARRAY_VERY_LARGE), 60) == 60 END +BEGIN BOOST_PP_LIST_SIZE(BOOST_PP_ARRAY_TO_LIST(ARRAY_EMPTY)) == 0 END // to_seq @@ -74,6 +79,8 @@ BEGIN BOOST_PP_SEQ_ELEM(0, BOOST_PP_ARRAY_TO_SEQ(ARRAY)) == 0 END BEGIN BOOST_PP_SEQ_ELEM(3, BOOST_PP_ARRAY_TO_SEQ((5, (0, 1, 2, 3, 4)))) == 3 END BEGIN BOOST_PP_SEQ_ELEM(17, BOOST_PP_ARRAY_TO_SEQ(ARRAY_LARGE)) == 17 END BEGIN BOOST_PP_SEQ_ELEM(42, BOOST_PP_ARRAY_TO_SEQ((64, (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63)))) == 42 END +BEGIN BOOST_PP_IS_EMPTY(BOOST_PP_SEQ_ELEM(0,BOOST_PP_ARRAY_TO_SEQ(ARRAY_EMPTY))) == 1 END +BEGIN BOOST_PP_SEQ_SIZE(BOOST_PP_ARRAY_TO_SEQ(ARRAY_EMPTY)) == 1 END // to_tuple @@ -83,6 +90,8 @@ BEGIN BOOST_PP_TUPLE_ELEM(2, BOOST_PP_ARRAY_TO_TUPLE(ARRAY)) == 2 END BEGIN BOOST_PP_TUPLE_ELEM(1, BOOST_PP_ARRAY_TO_TUPLE((5, (0, 1, 2, 3, 4)))) == 1 END BEGIN BOOST_PP_TUPLE_ELEM(26, BOOST_PP_ARRAY_TO_TUPLE(ARRAY_LARGE)) == 26 END BEGIN BOOST_PP_TUPLE_ELEM(37, BOOST_PP_ARRAY_TO_TUPLE((64, (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63)))) == 37 END +BEGIN BOOST_PP_TUPLE_SIZE(BOOST_PP_ARRAY_TO_TUPLE(ARRAY_EMPTY)) == 1 END +BEGIN BOOST_PP_IS_EMPTY(BOOST_PP_TUPLE_ELEM(0, BOOST_PP_ARRAY_TO_TUPLE(ARRAY_EMPTY))) == 1 END # else @@ -90,6 +99,7 @@ BEGIN BOOST_PP_TUPLE_ELEM(3, 2, BOOST_PP_ARRAY_TO_TUPLE(ARRAY)) == 2 END BEGIN BOOST_PP_TUPLE_ELEM(5, 1, BOOST_PP_ARRAY_TO_TUPLE((5, (0, 1, 2, 3, 4)))) == 1 END BEGIN BOOST_PP_TUPLE_ELEM(33, 26, BOOST_PP_ARRAY_TO_TUPLE(ARRAY_LARGE)) == 26 END BEGIN BOOST_PP_TUPLE_ELEM(64, 37, BOOST_PP_ARRAY_TO_TUPLE((64, (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63)))) == 37 END +BEGIN BOOST_PP_IS_EMPTY(BOOST_PP_TUPLE_ELEM(1, 0, BOOST_PP_ARRAY_TO_TUPLE(ARRAY_EMPTY))) == 1 END # endif diff --git a/test/list.cxx b/test/list.cxx index 2f16086..1e33274 100644 --- a/test/list.cxx +++ b/test/list.cxx @@ -16,18 +16,27 @@ # include # include # include +# include # include # include +# include # include # include # include +# include # include # include # define LISTNIL BOOST_PP_NIL # define LIST (4, (1, (5, (2, BOOST_PP_NIL)))) - # define REVERSAL(d, x, y) BOOST_PP_SUB_D(d, y, x) +# define F1(r, state, x) + x + state +# define FI2(r, state, i, x) BOOST_PP_IIF(BOOST_PP_EQUAL(i,1),+ x + x + state,+ x + state) +# define F2(r, x) + BOOST_PP_TUPLE_ELEM(2, 0, x) + 2 - BOOST_PP_TUPLE_ELEM(2, 1, x) +# define L1 (0, (x, BOOST_PP_NIL)) +# define L2 (a, (1, (b, (2, BOOST_PP_NIL)))) +# define L3 (c, (3, (d, BOOST_PP_NIL))) +# define LL (L1, (L2, (L3, BOOST_PP_NIL))) BEGIN BOOST_PP_LIST_FIRST(LIST) == 4 END BEGIN BOOST_PP_LIST_IS_CONS(LIST) == 1 END @@ -52,31 +61,30 @@ BEGIN BOOST_PP_LIST_CAT(BOOST_PP_LIST_FIRST_N(2, LIST)) == 41 END BEGIN BOOST_PP_LIST_AT(LIST, 2) == 5 END BEGIN BOOST_PP_LIST_SIZE(LIST) == 4 END +BEGIN BOOST_PP_LIST_SIZE(LISTNIL) == 0 END BEGIN BOOST_PP_LIST_CAT(BOOST_PP_LIST_TRANSFORM(BOOST_PP_ADD_D, 2, LIST)) == 6374 END BEGIN BOOST_PP_LIST_CAT(BOOST_PP_LIST_APPEND(BOOST_PP_LIST_REST(LIST), LIST)) == 1524152 END -# define F1(r, state, x) + x + state -# define FI2(r, state, i, x) BOOST_PP_IIF(BOOST_PP_EQUAL(i,1),+ x + x + state,+ x + state) - BEGIN BOOST_PP_LIST_FOR_EACH(F1, 1, LIST) == 16 END BEGIN BOOST_PP_LIST_FOR_EACH_I(FI2, 1, LIST) == 17 END BEGIN BOOST_PP_TUPLE_ELEM(4, 3, BOOST_PP_LIST_TO_TUPLE(LIST)) == 2 END +BEGIN BOOST_PP_IS_EMPTY(BOOST_PP_TUPLE_ELEM(1, 0, BOOST_PP_LIST_TO_TUPLE(LISTNIL))) == 1 END + +#if BOOST_PP_VARIADICS + +BEGIN BOOST_PP_TUPLE_SIZE(BOOST_PP_LIST_TO_TUPLE(LISTNIL)) == 1 END + +#endif BEGIN BOOST_PP_LIST_CAT(BOOST_PP_LIST_FILTER(BOOST_PP_LESS_D, 3, LIST)) == 45 END -# define F2(r, x) + BOOST_PP_TUPLE_ELEM(2, 0, x) + 2 - BOOST_PP_TUPLE_ELEM(2, 1, x) BEGIN BOOST_PP_LIST_FOR_EACH_PRODUCT(F2, 2, ( (1, (0, BOOST_PP_NIL)), (2, (3, BOOST_PP_NIL)) )) == 0 END -# define L1 (0, (x, BOOST_PP_NIL)) -# define L2 (a, (1, (b, (2, BOOST_PP_NIL)))) -# define L3 (c, (3, (d, BOOST_PP_NIL))) - -# define LL (L1, (L2, (L3, BOOST_PP_NIL))) - BEGIN BOOST_PP_LIST_CAT(BOOST_PP_LIST_FOLD_LEFT(BOOST_PP_LIST_APPEND_D, BOOST_PP_NIL, LL)) == 0x0a1b2c3d END BEGIN BOOST_PP_ARRAY_ELEM(2, BOOST_PP_LIST_TO_ARRAY(LIST)) == 5 END BEGIN BOOST_PP_ARRAY_SIZE(BOOST_PP_LIST_TO_ARRAY(LISTNIL)) == 0 END BEGIN BOOST_PP_SEQ_ELEM(3, BOOST_PP_LIST_TO_SEQ(LIST)) == 2 END +BEGIN BOOST_PP_IS_EMPTY(BOOST_PP_LIST_TO_SEQ(LISTNIL)) == 1 END diff --git a/test/seq.cxx b/test/seq.cxx index b73ea99..ae37291 100644 --- a/test/seq.cxx +++ b/test/seq.cxx @@ -19,8 +19,11 @@ # include # include # include +# include # include +# include # include +# include # include # include @@ -55,8 +58,19 @@ BEGIN BOOST_PP_SEQ_FOR_EACH(F1, 1, SEQ) == 16 END BEGIN BOOST_PP_SEQ_FOR_EACH_I(FI2, 1, SEQ) == 21 END BEGIN BOOST_PP_TUPLE_ELEM(4, 3, BOOST_PP_SEQ_TO_TUPLE(SEQ)) == 2 END +BEGIN BOOST_PP_IS_EMPTY(BOOST_PP_TUPLE_ELEM(1, 0, BOOST_PP_SEQ_TO_TUPLE(SEQ_NONE))) == 1 END + +#if BOOST_PP_VARIADICS + +BEGIN BOOST_PP_TUPLE_SIZE(BOOST_PP_SEQ_TO_TUPLE(SEQ_NONE)) == 1 END + +#endif + BEGIN BOOST_PP_ARRAY_ELEM(3, BOOST_PP_SEQ_TO_ARRAY(SEQ)) == 2 END +BEGIN BOOST_PP_IS_EMPTY(BOOST_PP_ARRAY_ELEM(0, BOOST_PP_SEQ_TO_ARRAY(SEQ_NONE))) == 1 END +BEGIN BOOST_PP_ARRAY_SIZE(BOOST_PP_SEQ_TO_ARRAY(SEQ_NONE)) == 1 END + # define LESS_S(s, x, y) BOOST_PP_LESS(x, y) BEGIN BOOST_PP_SEQ_CAT(BOOST_PP_SEQ_FILTER(LESS_S, 3, SEQ)) == 45 END @@ -101,6 +115,7 @@ BEGIN BOOST_PP_SEQ_SIZE(BOOST_PP_SEQ_TAIL(BOOST_PP_SEQ_FOLD_LEFT(SEQ_APPEND, (~) BEGIN BOOST_PP_LIST_AT(BOOST_PP_SEQ_TO_LIST(SEQ), 2) == 5 END BEGIN BOOST_PP_IS_EMPTY(BOOST_PP_LIST_AT(BOOST_PP_SEQ_TO_LIST(SEQ_NONE),0)) == 1 END +BEGIN BOOST_PP_LIST_SIZE(BOOST_PP_SEQ_TO_LIST(SEQ_NONE)) == 1 END #if BOOST_PP_VARIADICS diff --git a/test/tuple.cxx b/test/tuple.cxx index 9187ff5..68d7209 100644 --- a/test/tuple.cxx +++ b/test/tuple.cxx @@ -15,8 +15,11 @@ # include # include # include +# include # include +# include # include +# include # include # if BOOST_PP_VARIADICS # include @@ -78,18 +81,24 @@ BEGIN TEST_EAT_VERY_LARGE == 8 END BEGIN BOOST_PP_ARRAY_ELEM(3,BOOST_PP_TUPLE_TO_ARRAY(6,TUPLE)) == 3 END BEGIN BOOST_PP_ARRAY_ELEM(29,BOOST_PP_TUPLE_TO_ARRAY(33,TUPLE_LARGE)) == 29 END BEGIN BOOST_PP_ARRAY_ELEM(61,BOOST_PP_TUPLE_TO_ARRAY(64,TUPLE_VERY_LARGE)) == 61 END +BEGIN BOOST_PP_IS_EMPTY(BOOST_PP_ARRAY_ELEM(0,BOOST_PP_TUPLE_TO_ARRAY(1,TUPLE_NONE))) == 1 END +BEGIN BOOST_PP_ARRAY_SIZE(BOOST_PP_TUPLE_TO_ARRAY(1,TUPLE_NONE)) == 1 END // to_list BEGIN BOOST_PP_LIST_AT(BOOST_PP_TUPLE_TO_LIST(6,TUPLE), 2) == 2 END BEGIN BOOST_PP_LIST_AT(BOOST_PP_TUPLE_TO_LIST(33,TUPLE_LARGE), 19) == 19 END BEGIN BOOST_PP_LIST_AT(BOOST_PP_TUPLE_TO_LIST(64,TUPLE_VERY_LARGE), 62) == 62 END +BEGIN BOOST_PP_IS_EMPTY(BOOST_PP_LIST_AT(BOOST_PP_TUPLE_TO_LIST(1,TUPLE_NONE), 0)) == 1 END +BEGIN BOOST_PP_LIST_SIZE(BOOST_PP_TUPLE_TO_LIST(1,TUPLE_NONE)) == 1 END // to_seq BEGIN BOOST_PP_SEQ_ELEM(4,BOOST_PP_TUPLE_TO_SEQ(6,TUPLE)) == 4 END BEGIN BOOST_PP_SEQ_ELEM(31,BOOST_PP_TUPLE_TO_SEQ(33,TUPLE_LARGE)) == 31 END BEGIN BOOST_PP_SEQ_ELEM(55,BOOST_PP_TUPLE_TO_SEQ(64,TUPLE_VERY_LARGE)) == 55 END +BEGIN BOOST_PP_IS_EMPTY(BOOST_PP_SEQ_ELEM(0,BOOST_PP_TUPLE_TO_SEQ(1,TUPLE_NONE))) == 1 END +BEGIN BOOST_PP_SEQ_SIZE(BOOST_PP_TUPLE_TO_SEQ(1,TUPLE_NONE)) == 1 END #if BOOST_PP_VARIADICS @@ -220,17 +229,23 @@ BEGIN BOOST_PP_TUPLE_SIZE(TUPLE_VERY_LARGE) == 64 END BEGIN BOOST_PP_ARRAY_ELEM(3,BOOST_PP_TUPLE_TO_ARRAY(TUPLE)) == 3 END BEGIN BOOST_PP_ARRAY_ELEM(29,BOOST_PP_TUPLE_TO_ARRAY(TUPLE_LARGE)) == 29 END BEGIN BOOST_PP_ARRAY_ELEM(61,BOOST_PP_TUPLE_TO_ARRAY(TUPLE_VERY_LARGE)) == 61 END +BEGIN BOOST_PP_IS_EMPTY(BOOST_PP_ARRAY_ELEM(0,BOOST_PP_TUPLE_TO_ARRAY(TUPLE_NONE))) == 1 END +BEGIN BOOST_PP_ARRAY_SIZE(BOOST_PP_TUPLE_TO_ARRAY(TUPLE_NONE)) == 1 END // to_tuple BEGIN BOOST_PP_LIST_AT(BOOST_PP_TUPLE_TO_LIST(TUPLE), 2) == 2 END BEGIN BOOST_PP_LIST_AT(BOOST_PP_TUPLE_TO_LIST(TUPLE_LARGE), 19) == 19 END BEGIN BOOST_PP_LIST_AT(BOOST_PP_TUPLE_TO_LIST(TUPLE_VERY_LARGE), 62) == 62 END +BEGIN BOOST_PP_IS_EMPTY(BOOST_PP_LIST_AT(BOOST_PP_TUPLE_TO_LIST(TUPLE_NONE), 0)) == 1 END +BEGIN BOOST_PP_LIST_SIZE(BOOST_PP_TUPLE_TO_LIST(TUPLE_NONE)) == 1 END // to_seq BEGIN BOOST_PP_SEQ_ELEM(4,BOOST_PP_TUPLE_TO_SEQ(TUPLE)) == 4 END BEGIN BOOST_PP_SEQ_ELEM(31,BOOST_PP_TUPLE_TO_SEQ(TUPLE_LARGE)) == 31 END BEGIN BOOST_PP_SEQ_ELEM(55,BOOST_PP_TUPLE_TO_SEQ(TUPLE_VERY_LARGE)) == 55 END +BEGIN BOOST_PP_IS_EMPTY(BOOST_PP_SEQ_ELEM(0,BOOST_PP_TUPLE_TO_SEQ(TUPLE_NONE))) == 1 END +BEGIN BOOST_PP_SEQ_SIZE(BOOST_PP_TUPLE_TO_SEQ(TUPLE_NONE)) == 1 END #endif From df165d9fc60c095d8d71b0ab2263d965510248c8 Mon Sep 17 00:00:00 2001 From: Edward Diener Date: Sun, 4 May 2014 23:55:53 -0400 Subject: [PATCH 35/58] Added further tests for empty lists and arrays. --- test/array.cxx | 6 ++++++ test/list.cxx | 9 +++++++++ 2 files changed, 15 insertions(+) diff --git a/test/array.cxx b/test/array.cxx index fd189c7..975aaa3 100644 --- a/test/array.cxx +++ b/test/array.cxx @@ -47,6 +47,7 @@ BEGIN BOOST_PP_ARRAY_SIZE(ARRAY_LARGE) == 33 END BEGIN BOOST_PP_ARRAY_SIZE((33, (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32))) == 33 END BEGIN BOOST_PP_ARRAY_SIZE(ARRAY_VERY_LARGE) == 64 END BEGIN BOOST_PP_ARRAY_SIZE((64, (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63))) == 64 END +BEGIN BOOST_PP_ARRAY_SIZE(ARRAY_EMPTY) == 0 END // enum @@ -62,6 +63,7 @@ BEGIN BOOST_PP_VARIADIC_SIZE(BOOST_PP_ARRAY_ENUM((5, (0, 1, 2, 3, 4)))) == 5 END BEGIN BOOST_PP_VARIADIC_SIZE(BOOST_PP_ARRAY_ENUM(ARRAY_LARGE)) == 33 END BEGIN BOOST_PP_VARIADIC_SIZE(BOOST_PP_ARRAY_ENUM(ARRAY_VERY_LARGE)) == 64 END BEGIN BOOST_PP_VARIADIC_SIZE(BOOST_PP_ARRAY_ENUM((64, (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63)))) == 64 END +BEGIN BOOST_PP_VARIADIC_SIZE(BOOST_PP_ARRAY_ENUM(ARRAY_EMPTY)) == 1 END # endif @@ -115,6 +117,9 @@ BEGIN BOOST_PP_ARRAY_ELEM(22, BOOST_PP_ARRAY_INSERT(ARRAY_LARGE,22,1000)) == 100 BEGIN BOOST_PP_ARRAY_ELEM(26, BOOST_PP_ARRAY_INSERT(ARRAY_LARGE,22,1000)) == 25 END BEGIN BOOST_PP_ARRAY_SIZE(BOOST_PP_ARRAY_INSERT(ARRAY_LARGE,22,1000)) == 34 END +BEGIN BOOST_PP_ARRAY_ELEM(0, BOOST_PP_ARRAY_INSERT(ARRAY_EMPTY,0,25)) == 25 END +BEGIN BOOST_PP_ARRAY_SIZE(BOOST_PP_ARRAY_INSERT(ARRAY_EMPTY,0,1000)) == 1 END + // pop_back BEGIN BOOST_PP_ARRAY_SIZE(BOOST_PP_ARRAY_POP_BACK(ARRAY)) == 2 END @@ -172,3 +177,4 @@ BEGIN BOOST_PP_ARRAY_SIZE(BOOST_PP_ARRAY_REVERSE(ARRAY_VERY_LARGE)) == 64 END BEGIN BOOST_PP_ARRAY_ELEM(0, BOOST_PP_ARRAY_REVERSE(ARRAY)) == 2 END BEGIN BOOST_PP_ARRAY_ELEM(29, BOOST_PP_ARRAY_REVERSE(ARRAY_LARGE)) == 3 END BEGIN BOOST_PP_ARRAY_ELEM(38, BOOST_PP_ARRAY_REVERSE(ARRAY_VERY_LARGE)) == 25 END +BEGIN BOOST_PP_ARRAY_SIZE(BOOST_PP_ARRAY_REVERSE(ARRAY_EMPTY)) == 0 END diff --git a/test/list.cxx b/test/list.cxx index 1e33274..187787b 100644 --- a/test/list.cxx +++ b/test/list.cxx @@ -51,12 +51,16 @@ BEGIN BOOST_PP_VARIADIC_ELEM(2,BOOST_PP_LIST_ENUM(LIST)) == 5 END #endif BEGIN BOOST_PP_LIST_FOLD_LEFT(BOOST_PP_SUB_D, 22, LIST) == 10 END +BEGIN BOOST_PP_LIST_FOLD_LEFT(BOOST_PP_SUB_D, 22, LISTNIL) == 22 END BEGIN BOOST_PP_LIST_FOLD_RIGHT(BOOST_PP_ADD_D, 0, LIST) == 12 END +BEGIN BOOST_PP_LIST_FOLD_RIGHT(BOOST_PP_ADD_D, 0, LISTNIL) == 0 END BEGIN BOOST_PP_LIST_FOLD_RIGHT(REVERSAL, 0, LIST) == 4 END BEGIN BOOST_PP_LIST_CAT(BOOST_PP_LIST_REVERSE(LIST)) == 2514 END +BEGIN BOOST_PP_LIST_IS_NIL(BOOST_PP_LIST_REVERSE(LISTNIL)) == 1 END BEGIN BOOST_PP_LIST_CAT(BOOST_PP_LIST_REST_N(2, LIST)) == 52 END +BEGIN BOOST_PP_LIST_IS_NIL(BOOST_PP_LIST_REST_N(0, LISTNIL)) == 1 END BEGIN BOOST_PP_LIST_CAT(BOOST_PP_LIST_FIRST_N(2, LIST)) == 41 END BEGIN BOOST_PP_LIST_AT(LIST, 2) == 5 END @@ -64,7 +68,11 @@ BEGIN BOOST_PP_LIST_SIZE(LIST) == 4 END BEGIN BOOST_PP_LIST_SIZE(LISTNIL) == 0 END BEGIN BOOST_PP_LIST_CAT(BOOST_PP_LIST_TRANSFORM(BOOST_PP_ADD_D, 2, LIST)) == 6374 END +BEGIN BOOST_PP_LIST_IS_NIL(BOOST_PP_LIST_TRANSFORM(BOOST_PP_ADD_D, 2, LISTNIL)) == 1 END BEGIN BOOST_PP_LIST_CAT(BOOST_PP_LIST_APPEND(BOOST_PP_LIST_REST(LIST), LIST)) == 1524152 END +BEGIN BOOST_PP_LIST_CAT(BOOST_PP_LIST_APPEND(LIST,LISTNIL)) == 4152 END +BEGIN BOOST_PP_LIST_CAT(BOOST_PP_LIST_APPEND(LISTNIL,LIST)) == 4152 END +BEGIN BOOST_PP_LIST_IS_NIL(BOOST_PP_LIST_APPEND(LISTNIL,LISTNIL)) == 1 END BEGIN BOOST_PP_LIST_FOR_EACH(F1, 1, LIST) == 16 END BEGIN BOOST_PP_LIST_FOR_EACH_I(FI2, 1, LIST) == 17 END @@ -79,6 +87,7 @@ BEGIN BOOST_PP_TUPLE_SIZE(BOOST_PP_LIST_TO_TUPLE(LISTNIL)) == 1 END #endif BEGIN BOOST_PP_LIST_CAT(BOOST_PP_LIST_FILTER(BOOST_PP_LESS_D, 3, LIST)) == 45 END +BEGIN BOOST_PP_LIST_IS_NIL(BOOST_PP_LIST_FILTER(BOOST_PP_LESS_D, 3, LISTNIL)) == 1 END BEGIN BOOST_PP_LIST_FOR_EACH_PRODUCT(F2, 2, ( (1, (0, BOOST_PP_NIL)), (2, (3, BOOST_PP_NIL)) )) == 0 END From f61bb8a80f9433f467a433d74f407521680f4a41 Mon Sep 17 00:00:00 2001 From: Edward Diener Date: Mon, 5 May 2014 20:49:20 -0400 Subject: [PATCH 36/58] Changed functionality so empty arrays/lists when converted to a seq or a tuple expand to nothing. --- include/boost/preprocessor/array/to_seq.hpp | 19 ++++++++++-- include/boost/preprocessor/array/to_tuple.hpp | 13 +++++++- include/boost/preprocessor/list/to_array.hpp | 14 +++++++++ include/boost/preprocessor/list/to_tuple.hpp | 30 ++++++++++++++++--- test/array.cxx | 5 ---- test/list.cxx | 8 ----- 6 files changed, 68 insertions(+), 21 deletions(-) diff --git a/include/boost/preprocessor/array/to_seq.hpp b/include/boost/preprocessor/array/to_seq.hpp index ebcae53..3534d9c 100644 --- a/include/boost/preprocessor/array/to_seq.hpp +++ b/include/boost/preprocessor/array/to_seq.hpp @@ -15,19 +15,32 @@ # # include # include +# include +# include +# include # include # # /* BOOST_PP_ARRAY_TO_SEQ */ # +# define BOOST_PP_ARRAY_TO_SEQ(array) \ + BOOST_PP_IF \ + ( \ + BOOST_PP_ARRAY_SIZE(array), \ + BOOST_PP_ARRAY_TO_SEQ_DO, \ + BOOST_PP_EMPTY \ + ) \ + (array) \ +/**/ +# # if BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MSVC() -# define BOOST_PP_ARRAY_TO_SEQ(array) BOOST_PP_ARRAY_TO_SEQ_I(BOOST_PP_TUPLE_TO_SEQ, array) +# define BOOST_PP_ARRAY_TO_SEQ_DO(array) BOOST_PP_ARRAY_TO_SEQ_I(BOOST_PP_TUPLE_TO_SEQ, array) # define BOOST_PP_ARRAY_TO_SEQ_I(m, args) BOOST_PP_ARRAY_TO_SEQ_II(m, args) # define BOOST_PP_ARRAY_TO_SEQ_II(m, args) BOOST_PP_CAT(m ## args,) # elif BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MWCC() -# define BOOST_PP_ARRAY_TO_SEQ(array) BOOST_PP_ARRAY_TO_SEQ_I(array) +# define BOOST_PP_ARRAY_TO_SEQ_DO(array) BOOST_PP_ARRAY_TO_SEQ_I(array) # define BOOST_PP_ARRAY_TO_SEQ_I(array) BOOST_PP_TUPLE_TO_SEQ ## array # else -# define BOOST_PP_ARRAY_TO_SEQ(array) BOOST_PP_TUPLE_TO_SEQ array +# define BOOST_PP_ARRAY_TO_SEQ_DO(array) BOOST_PP_TUPLE_TO_SEQ array # endif # # endif diff --git a/include/boost/preprocessor/array/to_tuple.hpp b/include/boost/preprocessor/array/to_tuple.hpp index eb83274..b513e22 100644 --- a/include/boost/preprocessor/array/to_tuple.hpp +++ b/include/boost/preprocessor/array/to_tuple.hpp @@ -14,9 +14,20 @@ # define BOOST_PREPROCESSOR_ARRAY_TO_TUPLE_HPP # # include +# include +# include +# include # # /* BOOST_PP_ARRAY_TO_TUPLE */ # -# define BOOST_PP_ARRAY_TO_TUPLE BOOST_PP_ARRAY_DATA +# define BOOST_PP_ARRAY_TO_TUPLE(array) \ + BOOST_PP_IF \ + ( \ + BOOST_PP_ARRAY_SIZE(array), \ + BOOST_PP_ARRAY_DATA, \ + BOOST_PP_EMPTY \ + ) \ + (array) \ +/**/ # # endif diff --git a/include/boost/preprocessor/list/to_array.hpp b/include/boost/preprocessor/list/to_array.hpp index 3711d4c..bd44d68 100644 --- a/include/boost/preprocessor/list/to_array.hpp +++ b/include/boost/preprocessor/list/to_array.hpp @@ -137,6 +137,20 @@ # # /* BOOST_PP_LIST_TO_ARRAY_D */ # +# if BOOST_PP_VARIADICS && BOOST_PP_VARIADICS_MSVC && (_MSC_VER <= 1400) +# define BOOST_PP_LIST_TO_ARRAY_D(d, list) \ + BOOST_PP_IIF \ + ( \ + BOOST_PP_LIST_IS_NIL(list), \ + BOOST_PP_LIST_TO_ARRAY_D_VC8ORLESS_EMPTY, \ + BOOST_PP_LIST_TO_ARRAY_D_VC8ORLESS_DO \ + ) \ + (d, list) \ +/**/ +# define BOOST_PP_LIST_TO_ARRAY_D_VC8ORLESS_EMPTY(d, list) (0,()) +# define BOOST_PP_LIST_TO_ARRAY_D_VC8ORLESS_DO(d, list) BOOST_PP_LIST_TO_ARRAY_I(BOOST_PP_WHILE_ ## d, list) +# else # define BOOST_PP_LIST_TO_ARRAY_D(d, list) BOOST_PP_LIST_TO_ARRAY_I(BOOST_PP_WHILE_ ## d, list) +# endif # # endif /* BOOST_PREPROCESSOR_LIST_TO_ARRAY_HPP */ diff --git a/include/boost/preprocessor/list/to_tuple.hpp b/include/boost/preprocessor/list/to_tuple.hpp index 557de36..d693b91 100644 --- a/include/boost/preprocessor/list/to_tuple.hpp +++ b/include/boost/preprocessor/list/to_tuple.hpp @@ -16,22 +16,44 @@ # # include # include +# include +# include # # /* BOOST_PP_LIST_TO_TUPLE */ # +# define BOOST_PP_LIST_TO_TUPLE(list) \ + BOOST_PP_IIF \ + ( \ + BOOST_PP_LIST_IS_NIL(list), \ + BOOST_PP_EMPTY, \ + BOOST_PP_LIST_TO_TUPLE_DO \ + ) \ + (list) \ +/**/ +# # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG() -# define BOOST_PP_LIST_TO_TUPLE(list) (BOOST_PP_LIST_ENUM(list)) +# define BOOST_PP_LIST_TO_TUPLE_DO(list) (BOOST_PP_LIST_ENUM(list)) # else -# define BOOST_PP_LIST_TO_TUPLE(list) BOOST_PP_LIST_TO_TUPLE_I(list) +# define BOOST_PP_LIST_TO_TUPLE_DO(list) BOOST_PP_LIST_TO_TUPLE_I(list) # define BOOST_PP_LIST_TO_TUPLE_I(list) (BOOST_PP_LIST_ENUM(list)) # endif # # /* BOOST_PP_LIST_TO_TUPLE_R */ # +# define BOOST_PP_LIST_TO_TUPLE_R(r, list) \ + BOOST_PP_IIF \ + ( \ + BOOST_PP_LIST_IS_NIL(list), \ + BOOST_PP_EMPTY, \ + BOOST_PP_LIST_TO_TUPLE_R_DO \ + ) \ + (r, list) \ +/**/ +# # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG() -# define BOOST_PP_LIST_TO_TUPLE_R(r, list) (BOOST_PP_LIST_ENUM_R(r, list)) +# define BOOST_PP_LIST_TO_TUPLE_R_DO(r, list) (BOOST_PP_LIST_ENUM_R(r, list)) # else -# define BOOST_PP_LIST_TO_TUPLE_R(r, list) BOOST_PP_LIST_TO_TUPLE_R_I(r, list) +# define BOOST_PP_LIST_TO_TUPLE_R_DO(r, list) BOOST_PP_LIST_TO_TUPLE_R_I(r, list) # define BOOST_PP_LIST_TO_TUPLE_R_I(r, list) (BOOST_PP_LIST_ENUM_R(r, list)) # endif # diff --git a/test/array.cxx b/test/array.cxx index 975aaa3..745581d 100644 --- a/test/array.cxx +++ b/test/array.cxx @@ -81,8 +81,6 @@ BEGIN BOOST_PP_SEQ_ELEM(0, BOOST_PP_ARRAY_TO_SEQ(ARRAY)) == 0 END BEGIN BOOST_PP_SEQ_ELEM(3, BOOST_PP_ARRAY_TO_SEQ((5, (0, 1, 2, 3, 4)))) == 3 END BEGIN BOOST_PP_SEQ_ELEM(17, BOOST_PP_ARRAY_TO_SEQ(ARRAY_LARGE)) == 17 END BEGIN BOOST_PP_SEQ_ELEM(42, BOOST_PP_ARRAY_TO_SEQ((64, (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63)))) == 42 END -BEGIN BOOST_PP_IS_EMPTY(BOOST_PP_SEQ_ELEM(0,BOOST_PP_ARRAY_TO_SEQ(ARRAY_EMPTY))) == 1 END -BEGIN BOOST_PP_SEQ_SIZE(BOOST_PP_ARRAY_TO_SEQ(ARRAY_EMPTY)) == 1 END // to_tuple @@ -92,8 +90,6 @@ BEGIN BOOST_PP_TUPLE_ELEM(2, BOOST_PP_ARRAY_TO_TUPLE(ARRAY)) == 2 END BEGIN BOOST_PP_TUPLE_ELEM(1, BOOST_PP_ARRAY_TO_TUPLE((5, (0, 1, 2, 3, 4)))) == 1 END BEGIN BOOST_PP_TUPLE_ELEM(26, BOOST_PP_ARRAY_TO_TUPLE(ARRAY_LARGE)) == 26 END BEGIN BOOST_PP_TUPLE_ELEM(37, BOOST_PP_ARRAY_TO_TUPLE((64, (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63)))) == 37 END -BEGIN BOOST_PP_TUPLE_SIZE(BOOST_PP_ARRAY_TO_TUPLE(ARRAY_EMPTY)) == 1 END -BEGIN BOOST_PP_IS_EMPTY(BOOST_PP_TUPLE_ELEM(0, BOOST_PP_ARRAY_TO_TUPLE(ARRAY_EMPTY))) == 1 END # else @@ -101,7 +97,6 @@ BEGIN BOOST_PP_TUPLE_ELEM(3, 2, BOOST_PP_ARRAY_TO_TUPLE(ARRAY)) == 2 END BEGIN BOOST_PP_TUPLE_ELEM(5, 1, BOOST_PP_ARRAY_TO_TUPLE((5, (0, 1, 2, 3, 4)))) == 1 END BEGIN BOOST_PP_TUPLE_ELEM(33, 26, BOOST_PP_ARRAY_TO_TUPLE(ARRAY_LARGE)) == 26 END BEGIN BOOST_PP_TUPLE_ELEM(64, 37, BOOST_PP_ARRAY_TO_TUPLE((64, (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63)))) == 37 END -BEGIN BOOST_PP_IS_EMPTY(BOOST_PP_TUPLE_ELEM(1, 0, BOOST_PP_ARRAY_TO_TUPLE(ARRAY_EMPTY))) == 1 END # endif diff --git a/test/list.cxx b/test/list.cxx index 187787b..7c99d70 100644 --- a/test/list.cxx +++ b/test/list.cxx @@ -78,13 +78,6 @@ BEGIN BOOST_PP_LIST_FOR_EACH(F1, 1, LIST) == 16 END BEGIN BOOST_PP_LIST_FOR_EACH_I(FI2, 1, LIST) == 17 END BEGIN BOOST_PP_TUPLE_ELEM(4, 3, BOOST_PP_LIST_TO_TUPLE(LIST)) == 2 END -BEGIN BOOST_PP_IS_EMPTY(BOOST_PP_TUPLE_ELEM(1, 0, BOOST_PP_LIST_TO_TUPLE(LISTNIL))) == 1 END - -#if BOOST_PP_VARIADICS - -BEGIN BOOST_PP_TUPLE_SIZE(BOOST_PP_LIST_TO_TUPLE(LISTNIL)) == 1 END - -#endif BEGIN BOOST_PP_LIST_CAT(BOOST_PP_LIST_FILTER(BOOST_PP_LESS_D, 3, LIST)) == 45 END BEGIN BOOST_PP_LIST_IS_NIL(BOOST_PP_LIST_FILTER(BOOST_PP_LESS_D, 3, LISTNIL)) == 1 END @@ -96,4 +89,3 @@ BEGIN BOOST_PP_LIST_CAT(BOOST_PP_LIST_FOLD_LEFT(BOOST_PP_LIST_APPEND_D, BOOST_PP BEGIN BOOST_PP_ARRAY_ELEM(2, BOOST_PP_LIST_TO_ARRAY(LIST)) == 5 END BEGIN BOOST_PP_ARRAY_SIZE(BOOST_PP_LIST_TO_ARRAY(LISTNIL)) == 0 END BEGIN BOOST_PP_SEQ_ELEM(3, BOOST_PP_LIST_TO_SEQ(LIST)) == 2 END -BEGIN BOOST_PP_IS_EMPTY(BOOST_PP_LIST_TO_SEQ(LISTNIL)) == 1 END From 8ac31eb612844ab4b66c15f5b2ae8552a95433c7 Mon Sep 17 00:00:00 2001 From: Edward Diener Date: Fri, 23 May 2014 10:23:40 -0400 Subject: [PATCH 37/58] Changed BOOST_PP_EMPTY to only use the variadic version when not VC++. Corrected others to use local version of EMPTY. --- include/boost/preprocessor/array/to_seq.hpp | 4 ++-- include/boost/preprocessor/array/to_tuple.hpp | 4 ++-- include/boost/preprocessor/facilities/empty.hpp | 6 +++++- .../boost/preprocessor/facilities/is_empty_variadic.hpp | 7 ++++--- include/boost/preprocessor/list/to_tuple.hpp | 7 ++++--- 5 files changed, 17 insertions(+), 11 deletions(-) diff --git a/include/boost/preprocessor/array/to_seq.hpp b/include/boost/preprocessor/array/to_seq.hpp index 3534d9c..7303f34 100644 --- a/include/boost/preprocessor/array/to_seq.hpp +++ b/include/boost/preprocessor/array/to_seq.hpp @@ -17,7 +17,6 @@ # include # include # include -# include # include # # /* BOOST_PP_ARRAY_TO_SEQ */ @@ -27,10 +26,11 @@ ( \ BOOST_PP_ARRAY_SIZE(array), \ BOOST_PP_ARRAY_TO_SEQ_DO, \ - BOOST_PP_EMPTY \ + BOOST_PP_ARRAY_TO_SEQ_EMPTY \ ) \ (array) \ /**/ +# define BOOST_PP_ARRAY_TO_SEQ_EMPTY(array) # # if BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MSVC() # define BOOST_PP_ARRAY_TO_SEQ_DO(array) BOOST_PP_ARRAY_TO_SEQ_I(BOOST_PP_TUPLE_TO_SEQ, array) diff --git a/include/boost/preprocessor/array/to_tuple.hpp b/include/boost/preprocessor/array/to_tuple.hpp index b513e22..0d8defa 100644 --- a/include/boost/preprocessor/array/to_tuple.hpp +++ b/include/boost/preprocessor/array/to_tuple.hpp @@ -16,7 +16,6 @@ # include # include # include -# include # # /* BOOST_PP_ARRAY_TO_TUPLE */ # @@ -25,9 +24,10 @@ ( \ BOOST_PP_ARRAY_SIZE(array), \ BOOST_PP_ARRAY_DATA, \ - BOOST_PP_EMPTY \ + BOOST_PP_ARRAY_TO_TUPLE_EMPTY \ ) \ (array) \ /**/ +# define BOOST_PP_ARRAY_TO_TUPLE_EMPTY(array) # # endif diff --git a/include/boost/preprocessor/facilities/empty.hpp b/include/boost/preprocessor/facilities/empty.hpp index 99e1daa..0829a13 100644 --- a/include/boost/preprocessor/facilities/empty.hpp +++ b/include/boost/preprocessor/facilities/empty.hpp @@ -19,10 +19,14 @@ # # /* BOOST_PP_EMPTY */ # -# if BOOST_PP_VARIADICS +# if BOOST_PP_VARIADICS && !BOOST_PP_VARIADICS_MSVC # define BOOST_PP_EMPTY(...) # else # define BOOST_PP_EMPTY() # endif # +# if BOOST_PP_VARIADICS +# define BOOST_PP_VARIADIC_EMPTY(...) +# endif +# # endif diff --git a/include/boost/preprocessor/facilities/is_empty_variadic.hpp b/include/boost/preprocessor/facilities/is_empty_variadic.hpp index c2700fe..eee4062 100644 --- a/include/boost/preprocessor/facilities/is_empty_variadic.hpp +++ b/include/boost/preprocessor/facilities/is_empty_variadic.hpp @@ -16,7 +16,6 @@ # # if BOOST_PP_VARIADICS # -# include # include # include # @@ -31,11 +30,12 @@ ) \ ) \ ( \ - 0 BOOST_PP_EMPTY, \ + BOOST_PP_IS_EMPTY_ZERO, \ BOOST_PP_DETAIL_IS_EMPTY_PROCESS \ ) \ (param) \ /**/ +#define BOOST_PP_IS_EMPTY_ZERO(param) 0 # else #define BOOST_PP_IS_EMPTY(...) \ BOOST_PP_DETAIL_IS_EMPTY_IIF \ @@ -46,11 +46,12 @@ ) \ ) \ ( \ - 0 BOOST_PP_EMPTY, \ + BOOST_PP_IS_EMPTY_ZERO, \ BOOST_PP_DETAIL_IS_EMPTY_PROCESS \ ) \ (__VA_ARGS__) \ /**/ +#define BOOST_PP_IS_EMPTY_ZERO(...) 0 # endif /* BOOST_PP_VARIADICS_MSVC && _MSC_VER <= 1400 */ # endif /* BOOST_PP_VARIADICS */ # endif /* BOOST_PREPROCESSOR_FACILITIES_IS_EMPTY_VARIADIC_HPP */ diff --git a/include/boost/preprocessor/list/to_tuple.hpp b/include/boost/preprocessor/list/to_tuple.hpp index d693b91..c7b3da8 100644 --- a/include/boost/preprocessor/list/to_tuple.hpp +++ b/include/boost/preprocessor/list/to_tuple.hpp @@ -17,7 +17,6 @@ # include # include # include -# include # # /* BOOST_PP_LIST_TO_TUPLE */ # @@ -25,11 +24,12 @@ BOOST_PP_IIF \ ( \ BOOST_PP_LIST_IS_NIL(list), \ - BOOST_PP_EMPTY, \ + BOOST_PP_LIST_TO_TUPLE_EMPTY, \ BOOST_PP_LIST_TO_TUPLE_DO \ ) \ (list) \ /**/ +# define BOOST_PP_LIST_TO_TUPLE_EMPTY(list) # # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG() # define BOOST_PP_LIST_TO_TUPLE_DO(list) (BOOST_PP_LIST_ENUM(list)) @@ -44,11 +44,12 @@ BOOST_PP_IIF \ ( \ BOOST_PP_LIST_IS_NIL(list), \ - BOOST_PP_EMPTY, \ + BOOST_PP_LIST_TO_TUPLE_R_EMPTY, \ BOOST_PP_LIST_TO_TUPLE_R_DO \ ) \ (r, list) \ /**/ +# define BOOST_PP_LIST_TO_TUPLE_R_EMPTY(r,list) # # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG() # define BOOST_PP_LIST_TO_TUPLE_R_DO(r, list) (BOOST_PP_LIST_ENUM_R(r, list)) From 56525c76cce147991b326a44c4f052a48c496a48 Mon Sep 17 00:00:00 2001 From: Edward Diener Date: Sun, 25 May 2014 07:53:44 -0400 Subject: [PATCH 38/58] Change back to original implementation. --- include/boost/preprocessor/facilities/empty.hpp | 9 --------- 1 file changed, 9 deletions(-) diff --git a/include/boost/preprocessor/facilities/empty.hpp b/include/boost/preprocessor/facilities/empty.hpp index 0829a13..6f215dc 100644 --- a/include/boost/preprocessor/facilities/empty.hpp +++ b/include/boost/preprocessor/facilities/empty.hpp @@ -8,7 +8,6 @@ # */ # # /* Revised by Paul Mensonides (2002) */ -# /* Revised by Edward Diener (2014) */ # # /* See http://www.boost.org for most recent version. */ # @@ -19,14 +18,6 @@ # # /* BOOST_PP_EMPTY */ # -# if BOOST_PP_VARIADICS && !BOOST_PP_VARIADICS_MSVC -# define BOOST_PP_EMPTY(...) -# else # define BOOST_PP_EMPTY() -# endif -# -# if BOOST_PP_VARIADICS -# define BOOST_PP_VARIADIC_EMPTY(...) -# endif # # endif From b70598c3578e1c58d29e9e84005fc746e291929e Mon Sep 17 00:00:00 2001 From: Edward Diener Date: Mon, 26 May 2014 16:36:30 -0400 Subject: [PATCH 39/58] Using BOOST_PP_IDENTITY makes code clearer. --- include/boost/preprocessor/facilities/is_empty.hpp | 4 ++-- include/boost/preprocessor/facilities/is_empty_or_1.hpp | 3 ++- include/boost/preprocessor/seq/rest_n.hpp | 6 +++--- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/include/boost/preprocessor/facilities/is_empty.hpp b/include/boost/preprocessor/facilities/is_empty.hpp index e7f821f..d0403a9 100644 --- a/include/boost/preprocessor/facilities/is_empty.hpp +++ b/include/boost/preprocessor/facilities/is_empty.hpp @@ -24,7 +24,7 @@ # include # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MSVC() && ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MWCC() # include -# include +# include # else # include # include @@ -35,7 +35,7 @@ # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MSVC() && ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MWCC() # define BOOST_PP_IS_EMPTY(x) BOOST_PP_IS_EMPTY_I(x BOOST_PP_IS_EMPTY_HELPER) # define BOOST_PP_IS_EMPTY_I(contents) BOOST_PP_TUPLE_ELEM(2, 1, (BOOST_PP_IS_EMPTY_DEF_ ## contents())) -# define BOOST_PP_IS_EMPTY_DEF_BOOST_PP_IS_EMPTY_HELPER 1, 1 BOOST_PP_EMPTY +# define BOOST_PP_IS_EMPTY_DEF_BOOST_PP_IS_EMPTY_HELPER 1, BOOST_PP_IDENTITY(1) # define BOOST_PP_IS_EMPTY_HELPER() , 0 # else # if BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MSVC() diff --git a/include/boost/preprocessor/facilities/is_empty_or_1.hpp b/include/boost/preprocessor/facilities/is_empty_or_1.hpp index baa5da9..815666f 100644 --- a/include/boost/preprocessor/facilities/is_empty_or_1.hpp +++ b/include/boost/preprocessor/facilities/is_empty_or_1.hpp @@ -14,6 +14,7 @@ # # include # include +# include # include # include # @@ -22,7 +23,7 @@ # define BOOST_PP_IS_EMPTY_OR_1(x) \ BOOST_PP_IIF( \ BOOST_PP_IS_EMPTY(x BOOST_PP_EMPTY()), \ - 1 BOOST_PP_EMPTY, \ + BOOST_PP_IDENTITY(1), \ BOOST_PP_IS_1 \ )(x) \ /**/ diff --git a/include/boost/preprocessor/seq/rest_n.hpp b/include/boost/preprocessor/seq/rest_n.hpp index 7e589cc..6423376 100644 --- a/include/boost/preprocessor/seq/rest_n.hpp +++ b/include/boost/preprocessor/seq/rest_n.hpp @@ -14,17 +14,17 @@ # # include # include -# include +# include # include # include # # /* 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), (nil) seq BOOST_PP_EMPTY))() +# 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 )))() # 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), (nil) seq BOOST_PP_EMPTY))() +# 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 )))() # endif # # endif From 4063b1564b394ddaf1d460b947d9b16ff9fa523d Mon Sep 17 00:00:00 2001 From: Edward Diener Date: Wed, 4 Jun 2014 06:50:33 -0400 Subject: [PATCH 40/58] Updated doc for empty array and/or list when converted to other data type. --- doc/ref/array_to_list.html | 70 +++++++++++++----------- doc/ref/array_to_seq.html | 64 ++++++++++++---------- doc/ref/array_to_tuple.html | 66 ++++++++++++---------- doc/ref/list_to_array.html | 82 +++++++++++++++------------- doc/ref/list_to_array_d.html | 57 ++++++++++--------- doc/ref/list_to_seq.html | 80 ++++++++++++++------------- doc/ref/list_to_seq_r.html | 55 ++++++++++--------- doc/ref/list_to_tuple.html | 103 ++++++++++++++++------------------- doc/ref/list_to_tuple_r.html | 103 ++++++++++++++++------------------- 9 files changed, 356 insertions(+), 324 deletions(-) diff --git a/doc/ref/array_to_list.html b/doc/ref/array_to_list.html index 607b205..8ea7133 100644 --- a/doc/ref/array_to_list.html +++ b/doc/ref/array_to_list.html @@ -1,33 +1,41 @@ - - BOOST_PP_ARRAY_TO_LIST - - - -
    The BOOST_PP_ARRAY_TO_LIST -macro converts an array to a list.
    -

    Usage

    -
    BOOST_PP_ARRAY_TO_LIST(array) -
    -

    Arguments

    -
    array
    -
    The array to be converted.
    -
    -
      -
    -

    Requirements

    - -

    Sample Code

    -
    -
    #include <boost/preprocessor/array/to_list.hpp>

    BOOST_PP_ARRAY_TO_LIST((3, (x, y, z)))
    // expands to (x, (y, (z, BOOST_PP_NIL)))
    -
    -
    -
    © Copyright Edward Diener 2011
    -
    -

    Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt -or copy at www.boost.org/LICENSE_1_0.txt)

    -
    - + + + BOOST_PP_ARRAY_TO_LIST + + + +
    The BOOST_PP_ARRAY_TO_LIST macro + converts an array to a list.
    +

    Usage

    +
    BOOST_PP_ARRAY_TO_LIST(array)
    +

    Arguments

    +
    +
    array
    +
    The array to be converted.
    +
    +
      +
    +

    Remarks

    +

        If the array to be converted is empty, as + represented by '( 0, () )', the resulting list is empty, as + represented by 'BOOST_PP_NIL'.

    +

    Requirements

    + +

    Sample Code

    +
    +
    #include <boost/preprocessor/array/to_list.hpp>

    BOOST_PP_ARRAY_TO_LIST((3, (x, y, z)))
    // expands to (x, (y, (z, BOOST_PP_NIL)))
    +
    +
    +
    © Copyright Edward Diener 2011
    +
    +

    Distributed under the Boost Software License, Version 1.0. (See + accompanying file LICENSE_1_0.txt + or copy at www.boost.org/LICENSE_1_0.txt)

    +
    + s + diff --git a/doc/ref/array_to_seq.html b/doc/ref/array_to_seq.html index 308b364..7140176 100644 --- a/doc/ref/array_to_seq.html +++ b/doc/ref/array_to_seq.html @@ -1,31 +1,37 @@ - - BOOST_PP_ARRAY_TO_SEQ - - - -
    The BOOST_PP_ARRAY_TO_SEQ macro -converts an array to a seq.
    -

    Usage

    -
    BOOST_PP_ARRAY_TO_SEQ(array) -
    -

    Arguments

    -
    array
    -
    The array to be converted.
    -
    -

    Requirements

    - -

    Sample Code

    -
    -
    #include <boost/preprocessor/array/to_seq.hpp>

    BOOST_PP_ARRAY_TO_SEQ((3, (a, b, c))) // expands to (a)(b)(c)
    -
    -
    -
    © Copyright Edward Diener 2011
    -
    -

    Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt -or copy at www.boost.org/LICENSE_1_0.txt)

    -
    - + + + BOOST_PP_ARRAY_TO_SEQ + + + +
    The BOOST_PP_ARRAY_TO_SEQ macro + converts an array to a seq.
    +

    Usage

    +
    BOOST_PP_ARRAY_TO_SEQ(array)
    +

    Arguments

    +
    +
    array
    +
    The array to be converted.
    +
    +

    Remarks

    +

        If the array to be converted is empty, as + represented by '( 0, () )', the resulting seq is undefined since a + seq cannot be empty.

    +

    Requirements

    + +

    Sample Code

    +
    +
    #include <boost/preprocessor/array/to_seq.hpp>

    BOOST_PP_ARRAY_TO_SEQ((3, (a, b, c))) // expands to (a)(b)(c)
    +
    +
    +
    © Copyright Edward Diener 2011
    +
    +

    Distributed under the Boost Software License, Version 1.0. (See + accompanying file LICENSE_1_0.txt + or copy at www.boost.org/LICENSE_1_0.txt)

    +
    + diff --git a/doc/ref/array_to_tuple.html b/doc/ref/array_to_tuple.html index 085dd39..8f9c958 100644 --- a/doc/ref/array_to_tuple.html +++ b/doc/ref/array_to_tuple.html @@ -1,31 +1,39 @@ - - BOOST_PP_ARRAY_TO_TUPLE - - - -
    The BOOST_PP_ARRAY_TO_TUPLE macro -converts an array to an tuple.
    -

    Usage

    -
    BOOST_PP_ARRAY_TO_TUPLE(array)
    -

    Arguments

    -
    -
    array
    -
    The array to be converted.
    -
    -

    Requirements

    - -

    Sample Code

    -
    -
    #include <boost/preprocessor/array/to_tuple.hpp>

    #define ARRAY (3,(a, b, c))

    BOOST_PP_ARRAY_TO_TUPLE(ARRAY) // expands to (a, b, c)
    -
    -
    -
    © Copyright Edward Diener 2011
    -
    -

    Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt -or copy at www.boost.org/LICENSE_1_0.txt)

    -
    - + + + BOOST_PP_ARRAY_TO_TUPLE + + + +
    The BOOST_PP_ARRAY_TO_TUPLE macro + converts an array to an tuple.
    +

    Usage

    +
    BOOST_PP_ARRAY_TO_TUPLE(array)
    +

    Arguments

    +
    +
    array
    +
    The array to be converted.
    +
    +

    Remarks

    +

        If the array to be converted is empty, as + represented by '( 0, () )', the resulting tuple is undefined + since a tuple cannot be empty.

    +

    Requirements

    + +

    Sample Code

    +
    +
    #include <boost/preprocessor/array/to_tuple.hpp>

    #define ARRAY (3,(a, b, c))

    BOOST_PP_ARRAY_TO_TUPLE(ARRAY) // expands to (a, b, c)
    +
    +
    +
    © Copyright Edward Diener 2011 +
    +
    +

    Distributed under the Boost Software License, Version 1.0. (See + accompanying file LICENSE_1_0.txt + or copy at www.boost.org/LICENSE_1_0.txt)

    +
    + diff --git a/doc/ref/list_to_array.html b/doc/ref/list_to_array.html index b691b34..46154c9 100644 --- a/doc/ref/list_to_array.html +++ b/doc/ref/list_to_array.html @@ -1,39 +1,47 @@ - - BOOST_PP_LIST_TO_ARRAY - - -
    The BOOST_PP_LIST_TO_ARRAY macro -converts a list to an array.
    -

    Usage

    -
    BOOST_PP_LIST_TO_ARRAY(list)
    -

    Arguments

    -
    -
    list
    -
    The list to be converted.
    -
    -

    Remarks

    -
    - This macro uses BOOST_PP_WHILE. - Within BOOST_PP_WHILE, it is more efficient to use BOOST_PP_LIST_TO_ARRAY_D. -
    -

    See Also

    - -

    Requirements

    - -

    Sample Code

    -
    -
    #include <boost/preprocessor/list/to_array.hpp>

    #define LIST (a, (b, (c, BOOST_PP_NIL)))

    BOOST_PP_LIST_TO_ARRAY(LIST) // expands to (3, (a, b, c))
    -
    -
    -
    © Copyright Edward Diener 2011
    -
    -

    Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt -or copy at www.boost.org/LICENSE_1_0.txt)

    -
    - + + + BOOST_PP_LIST_TO_ARRAY + + + +
    The BOOST_PP_LIST_TO_ARRAY macro + converts a list to an array.
    +

    Usage

    +
    BOOST_PP_LIST_TO_ARRAY(list)
    +

    Arguments

    +
    +
    list
    +
    The list to be converted.
    +
    +
    +

    Remarks

    +
    This macro uses BOOST_PP_WHILE. Within BOOST_PP_WHILE, + it is more efficient to use BOOST_PP_LIST_TO_ARRAY_D.
    +
    + If the list to be converted is empty, as represented by + 'BOOST_PP_NIL', the resulting array is empty, as represented by '( 0, () + )'.
    +

    See Also

    + +

    Requirements

    + +

    Sample Code

    +
    +
    #include <boost/preprocessor/list/to_array.hpp>

    #define LIST (a, (b, (c, BOOST_PP_NIL)))

    BOOST_PP_LIST_TO_ARRAY(LIST) // expands to (3, (a, b, c))
    +
    +
    +
    © Copyright Edward Diener 2011 +
    +
    +

    Distributed under the Boost Software License, Version 1.0. (See + accompanying file LICENSE_1_0.txt + or copy at www.boost.org/LICENSE_1_0.txt)

    +
    + diff --git a/doc/ref/list_to_array_d.html b/doc/ref/list_to_array_d.html index 8d93328..835d9e2 100644 --- a/doc/ref/list_to_array_d.html +++ b/doc/ref/list_to_array_d.html @@ -1,27 +1,34 @@ - - BOOST_PP_LIST_TO_ARRAY_D - - -
    -The BOOST_PP_LIST_TO_ARRAY_D macro converts a list to an array. -It reenters BOOST_PP_WHILE with maximum efficiency. -
    -

    Usage

    -
    BOOST_PP_LIST_TO_ARRAY_D(d, list)
    -

    Arguments

    -
    -
    d
    -
    The next available BOOST_PP_WHILE iteration.
    -
    list
    -
    The list to be converted.
    -
    -

    See Also

    - -

    Requirements

    - - + + + BOOST_PP_LIST_TO_ARRAY_D + + + +
    The BOOST_PP_LIST_TO_ARRAY_D macro + converts a list to an array. It reenters BOOST_PP_WHILE + with maximum efficiency.
    +

    Usage

    +
    BOOST_PP_LIST_TO_ARRAY_D(d, list) +
    +

    Arguments

    +
    +
    d
    +
    The next available BOOST_PP_WHILE iteration.
    +
    list
    +
    The list to be converted.
    +
    +

    Remarks

    +

        If the list to be converted is empty, as + represented by 'BOOST_PP_NIL', the resulting array is empty, as + represented by '( 0, () )'.

    +

    See Also

    +

    See Also

    + +

    Requirements

    + + diff --git a/doc/ref/list_to_seq.html b/doc/ref/list_to_seq.html index 2f77cf1..b023546 100644 --- a/doc/ref/list_to_seq.html +++ b/doc/ref/list_to_seq.html @@ -1,40 +1,44 @@ - - BOOST_PP_LIST_TO_SEQ - - - -
    The BOOST_PP_LIST_TO_SEQ macro -converts a list to a seq.
    -

    Usage

    -
    BOOST_PP_LIST_TO_SEQ(list) -
    -

    Arguments

    -
    list
    -
    The list to be converted.
    -
    -

    Remarks

    -
    - This macro uses BOOST_PP_FOR. - Within BOOST_PP_FOR, it is more efficient to use BOOST_PP_LIST_TO_SEQ_R. -
    -

    See Also

    - -

    Requirements

    - -

    Sample Code

    -
    -
    #include <boost/preprocessor/list/to_seq.hpp>

    BOOST_PP_LIST_TO_SEQ((a, (b, (c, BOOST_PP_NIL)))) // expands to (a)(b)(c)
    -
    -
    -
    © Copyright Edward Diener 2011
    -
    -

    Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt -or copy at www.boost.org/LICENSE_1_0.txt)

    -
    - + + + BOOST_PP_LIST_TO_SEQ + + + +
    The BOOST_PP_LIST_TO_SEQ macro + converts a list to a seq.
    +

    Usage

    +
    BOOST_PP_LIST_TO_SEQ(list)
    +

    Arguments

    +
    +
    list
    +
    The list to be converted.
    +
    +

    Remarks

    +
    This macro uses BOOST_PP_FOR. Within BOOST_PP_FOR, it + is more efficient to use BOOST_PP_LIST_TO_SEQ_R.
    +
    + If the list to be converted is empty, as represented by + 'BOOST_PP_NIL', the resulting seq is undefined since a seq + cannot be empty.
    +

    See Also

    + +

    Requirements

    + +

    Sample Code

    +
    +
    #include <boost/preprocessor/list/to_seq.hpp>

    BOOST_PP_LIST_TO_SEQ((a, (b, (c, BOOST_PP_NIL)))) // expands to (a)(b)(c)
    +
    +
    +
    © Copyright Edward Diener 2011
    +
    +

    Distributed under the Boost Software License, Version 1.0. (See + accompanying file LICENSE_1_0.txt + or copy at www.boost.org/LICENSE_1_0.txt)

    +
    + diff --git a/doc/ref/list_to_seq_r.html b/doc/ref/list_to_seq_r.html index 2c2bb37..cc7a854 100644 --- a/doc/ref/list_to_seq_r.html +++ b/doc/ref/list_to_seq_r.html @@ -1,27 +1,32 @@ - - BOOST_PP_LIST_TO_SEQ_R - - -
    -The BOOST_PP_LIST_TO_SEQ_R macro converts a list to an seq. -It reenters BOOST_PP_FOR with maximum efficiency. -
    -

    Usage

    -
    BOOST_PP_LIST_TO_SEQ_R(r, list)
    -

    Arguments

    -
    -
    d
    -
    The next available BOOST_PP_FOR repetition.
    -
    list
    -
    The list to be converted.
    -
    -

    See Also

    - -

    Requirements

    - - + + + BOOST_PP_LIST_TO_SEQ_R + + + +
    The BOOST_PP_LIST_TO_SEQ_R macro + converts a list to a seq. It reenters BOOST_PP_FOR + with maximum efficiency.
    +

    Usage

    +
    BOOST_PP_LIST_TO_SEQ_R(r, list)
    +

    Arguments

    +
    +
    d
    +
    The next available BOOST_PP_FOR repetition.
    +
    list
    +
    The list to be converted.
    +
    +

    Remarks

    +

        If the list to be converted is empty, as + represented by 'BOOST_PP_NIL', the resulting seq is undefined + since a seq cannot be empty.

    +

    See Also

    + +

    Requirements

    + + diff --git a/doc/ref/list_to_tuple.html b/doc/ref/list_to_tuple.html index 37e7311..d022c2b 100644 --- a/doc/ref/list_to_tuple.html +++ b/doc/ref/list_to_tuple.html @@ -1,62 +1,55 @@ - - BOOST_PP_LIST_TO_TUPLE - - - -
    - The BOOST_PP_LIST_TO_TUPLE macro converts a list to a tuple. -
    -

    Usage

    -
    - BOOST_PP_LIST_TO_TUPLE(list) -
    -

    Arguments

    -
    -
    list
    -
    - The list to be converted. -
    -
    -

    Remarks

    -
    - If list is, for example, (a, (b, (c, BOOST_PP_NIL))), - this macro will produce: -
    - (a, b, c) -
    -
    -
    - Previously, this macro could not be used inside BOOST_PP_FOR.  - There is no longer any such restriction.  - It is more efficient, however, to use BOOST_PP_LIST_TO_TUPLE_R in such a situation. -
    -

    See Also

    - -

    Requirements

    - -

    Sample Code

    -
    -#include <boost/preprocessor/list/to_tuple.hpp>
    +  
    +    
    +    BOOST_PP_LIST_TO_TUPLE
    +    
    +  
    +  
    +    
    The BOOST_PP_LIST_TO_TUPLE macro + converts a list to a tuple.
    +

    Usage

    +
    BOOST_PP_LIST_TO_TUPLE(list)
    +

    Arguments

    +
    +
    list
    +
    The list to be converted.
    +
    +

    Remarks

    +
    If list is, for example, (a, (b, (c, BOOST_PP_NIL))), + this macro will produce: +
    (a, b, c)
    +
    +
    Previously, this macro could not be used inside BOOST_PP_FOR.  + There is no longer any such restriction.  It is more efficient, + however, to use BOOST_PP_LIST_TO_TUPLE_R in such a situation.
    +
    + If the list to be converted is empty, as represented by 'BOOST_PP_NIL', + the resulting tuple is undefined since a tuple cannot be + empty.
    +

    See Also

    + +

    Requirements

    + +

    Sample Code

    +
    +
    #include <boost/preprocessor/list/to_tuple.hpp>
     
     #define LIST (w, (x, (y, (z, BOOST_PP_NIL))))
     
     BOOST_PP_LIST_TO_TUPLE(LIST) // expands to (w, x, y, z)
     
    -
    -
    - © Copyright Housemarque Oy 2002 -
    © Copyright Paul Mensonides 2002 -
    -
    -

    Distributed under the Boost Software License, Version 1.0. (See - accompanying file LICENSE_1_0.txt or - copy at www.boost.org/LICENSE_1_0.txt)

    -
    - +
    +
    © Copyright Housemarque Oy 2002
    + © Copyright Paul Mensonides 2002
    +
    +

    Distributed under the Boost Software License, Version 1.0. (See + accompanying file LICENSE_1_0.txt + or copy at www.boost.org/LICENSE_1_0.txt)

    +
    + diff --git a/doc/ref/list_to_tuple_r.html b/doc/ref/list_to_tuple_r.html index 1ba51a0..a72c4de 100644 --- a/doc/ref/list_to_tuple_r.html +++ b/doc/ref/list_to_tuple_r.html @@ -1,47 +1,42 @@ - - BOOST_PP_LIST_TO_TUPLE_R - - - -
    - The BOOST_PP_LIST_TO_TUPLE_R macro converts a list to a tuple.  - It reenters BOOST_PP_FOR with maximum efficiency. -
    -

    Usage

    -
    - BOOST_PP_LIST_TO_TUPLE_R(r, list) -
    -

    Arguments

    -
    -
    r
    -
    - The next available BOOST_PP_FOR repetition. -
    -
    list
    -
    - The list to be converted. -
    -
    -

    Remarks

    -
    - If list is, for example, (a, (b, (c, BOOST_PP_NIL))), - this macro will produce: -
    - (a, b, c) -
    -
    -

    See Also

    - -

    Requirements

    - -

    Sample Code

    -
    -#include <boost/preprocessor/list/adt.hpp>
    +  
    +    
    +    BOOST_PP_LIST_TO_TUPLE_R
    +    
    +  
    +  
    +    
    The BOOST_PP_LIST_TO_TUPLE_R macro + converts a list to a tuple.  It reenters BOOST_PP_FOR + with maximum efficiency.
    +

    Usage

    +
    BOOST_PP_LIST_TO_TUPLE_R(r, list) +
    +

    Arguments

    +
    +
    r
    +
    The next available BOOST_PP_FOR repetition.
    +
    list
    +
    The list to be converted.
    +
    +

    Remarks

    +

       If list is, for example, (a, (b, (c, + BOOST_PP_NIL))), this macro will produce:

    +
    +
    (a, b, c)  
    +
    +

       If the list to + be converted is empty, as represented by 'BOOST_PP_NIL', the resulting tuple + is undefined since a tuple cannot be empty.

    +

    See Also

    + +

    Requirements

    + +

    Sample Code

    +
    +
    #include <boost/preprocessor/list/adt.hpp>
     #include <boost/preprocessor/list/to_tuple.hpp>
     #include <boost/preprocessor/repetition/for.hpp>
     
    @@ -54,16 +49,14 @@
     BOOST_PP_FOR(LIST, PRED, OP, MACRO)
        // expands to (x, y, z) (y, z) (z)
     
    -
    -
    - © Copyright Housemarque Oy 2002 -
    © Copyright Paul Mensonides 2002 -
    -
    -

    Distributed under the Boost Software License, Version 1.0. (See - accompanying file LICENSE_1_0.txt or - copy at www.boost.org/LICENSE_1_0.txt)

    -
    - +
    +
    © Copyright Housemarque Oy 2002
    + © Copyright Paul Mensonides 2002
    +
    +

    Distributed under the Boost Software License, Version 1.0. (See + accompanying file LICENSE_1_0.txt + or copy at www.boost.org/LICENSE_1_0.txt)

    +
    + From 3a472c20843dff5ed2a91086c5363e6ad28d5bdd Mon Sep 17 00:00:00 2001 From: Edward Diener Date: Thu, 3 Jul 2014 16:56:40 -0400 Subject: [PATCH 41/58] Updated docs --- doc/ref/array_to_list.html | 4 ++-- doc/ref/array_to_seq.html | 2 +- doc/ref/list_to_seq.html | 2 +- doc/ref/list_to_tuple_r.html | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/doc/ref/array_to_list.html b/doc/ref/array_to_list.html index 8ea7133..2fdd247 100644 --- a/doc/ref/array_to_list.html +++ b/doc/ref/array_to_list.html @@ -25,8 +25,8 @@

    Sample Code

    -
    #include <boost/preprocessor/array/to_list.hpp>

    BOOST_PP_ARRAY_TO_LIST((3, (x, y, z)))
    // expands to (x, (y, (z, #include <boost/preprocessor/array/to_list.hpp>

    BOOST_PP_ARRAY_TO_LIST((3, (x, y, z)))
    // expands to (x, (y, (z, BOOST_PP_NIL)))

    diff --git a/doc/ref/array_to_seq.html b/doc/ref/array_to_seq.html index 7140176..bf3518e 100644 --- a/doc/ref/array_to_seq.html +++ b/doc/ref/array_to_seq.html @@ -23,7 +23,7 @@

    Sample Code


    diff --git a/doc/ref/list_to_seq.html b/doc/ref/list_to_seq.html index b023546..3efc7e1 100644 --- a/doc/ref/list_to_seq.html +++ b/doc/ref/list_to_seq.html @@ -30,7 +30,7 @@

    Sample Code


    diff --git a/doc/ref/list_to_tuple_r.html b/doc/ref/list_to_tuple_r.html index a72c4de..0227d38 100644 --- a/doc/ref/list_to_tuple_r.html +++ b/doc/ref/list_to_tuple_r.html @@ -50,7 +50,7 @@ // expands to (x, y, z) (y, z) (z)
    -
    © Copyright © Copyright Housemarque Oy 2002
    © Copyright Paul Mensonides 2002
    From 08c50b219dd3e3c6575ab515aa9251aba59ba787 Mon Sep 17 00:00:00 2001 From: Edward Diener Date: Sun, 8 Jun 2014 02:00:24 -0400 Subject: [PATCH 42/58] Added documentation for is_begin_parens and remove_parens. --- doc/headers.html | 2 + doc/headers/punctuation/is_begin_parens.html | 26 +++++++++++ doc/headers/punctuation/remove_parens.html | 26 +++++++++++ doc/ref.html | 2 + doc/ref/is_begin_parens.html | 47 ++++++++++++++++++++ doc/ref/remove_parens.html | 44 ++++++++++++++++++ 6 files changed, 147 insertions(+) create mode 100644 doc/headers/punctuation/is_begin_parens.html create mode 100644 doc/headers/punctuation/remove_parens.html create mode 100644 doc/ref/is_begin_parens.html create mode 100644 doc/ref/remove_parens.html diff --git a/doc/headers.html b/doc/headers.html index 90b59fd..e96b25e 100644 --- a/doc/headers.html +++ b/doc/headers.html @@ -138,8 +138,10 @@
  • punctuation/
  • comma.hpp
  • comma_if.hpp
  • +
  • is_begin_parens.hpp (v)
  • paren.hpp
  • paren_if.hpp
  • +
  • remove_parens.hpp (v)
  • repeat.hpp*
  • repeat_2nd.hpp*
  • repeat_3rd.hpp*
  • diff --git a/doc/headers/punctuation/is_begin_parens.html b/doc/headers/punctuation/is_begin_parens.html new file mode 100644 index 0000000..4897623 --- /dev/null +++ b/doc/headers/punctuation/is_begin_parens.html @@ -0,0 +1,26 @@ + + + + punctuation/is_begin_parens.hpp + + + +
    The punctuation/is_begin_parens.hpp + header defines a macro that determines if variadic data begins with a + parenthesis.
    +

    Usage

    +
    #include <boost/preprocessor/punctuation/is_begin_parens.hpp> +
    +

    Contents

    + +
    +
    © Copyright Edward Diener 2014
    +
    +

    Distributed under the Boost Software License, Version 1.0. (See + accompanying file LICENSE_1_0.txt + or copy at www.boost.org/LICENSE_1_0.txt)

    +
    + + diff --git a/doc/headers/punctuation/remove_parens.html b/doc/headers/punctuation/remove_parens.html new file mode 100644 index 0000000..f2b6e46 --- /dev/null +++ b/doc/headers/punctuation/remove_parens.html @@ -0,0 +1,26 @@ + + + + punctuation/remove_parens.hpp + + + +
    The punctuation/remove_parens.hpp + header defines a macro that removes the beginning parenthesis from its + input if it exists.
    +

    Usage

    +
    #include <boost/preprocessor/punctuation/remove_parens.hpp> +
    +

    Contents

    + +
    +
    © Copyright Edward Diener 2014
    +
    +

    Distributed under the Boost Software License, Version 1.0. (See + accompanying file LICENSE_1_0.txt + or copy at www.boost.org/LICENSE_1_0.txt)

    +
    + + diff --git a/doc/ref.html b/doc/ref.html index 82c2905..4d2081f 100644 --- a/doc/ref.html +++ b/doc/ref.html @@ -105,6 +105,7 @@
  • INCLUDE_SELF
  • INDIRECT_SELF
  • INTERCEPT
  • +
  • IS_BEGIN_PARENS (v)
  • IS_ITERATING
  • IS_SELFISH
  • ITERATE
  • @@ -209,6 +210,7 @@
  • RELATIVE_FLAGS
  • RELATIVE_ITERATION
  • RELATIVE_START
  • +
  • REMOVE_PARENS (v)
  • REPEAT
  • REPEAT_1ST*
  • REPEAT_2ND*
  • diff --git a/doc/ref/is_begin_parens.html b/doc/ref/is_begin_parens.html new file mode 100644 index 0000000..0e0b39c --- /dev/null +++ b/doc/ref/is_begin_parens.html @@ -0,0 +1,47 @@ + + + + BOOST_PP_IS_BEGIN_PARENS + + + +
    The BOOST_PP_IS_BEGIN_PARENS + determines whether the input starts with a set of parenthesis.
    +

    Usage

    +
    BOOST_PP_IS_BEGIN_PARENS(...) (v)
    +

    Arguments

    +

        ...        +     The input as variadic data.

    +

    Remarks

    +
    If the input input begins with a parenthesis, with any data within + that parenthesis, the macro returns 1, otherwise it returns 0. Data may + follow the beginning parenthesis and the macro still will return 1.
    +
    + For Visual Studio 2005 ( VC8 ) the input data must be a single parameter + else a compilation error will occur.
    +

    See Also

    + +

    Requirements

    + +

    Sample Code

    +
    +
    #include <boost/preprocessor/punctuation/is_begin_parens.hpp>
    +
    +#define VARDATA more_data , more_params
    #define VARDATAP ( data ) more_data , more_params
    #define DATA data
    #define DATAP ( data ) more_data
    +BOOST_PP_IS_BEGIN_PARENS(VARDATA) // expands to 0, compiler error with VC8 +BOOST_PP_IS_BEGIN_PARENS(VARDATAP) // expands to 1, compiler error with VC8

    BOOST_PP_IS_BEGIN_PARENS(DATA) // expands to 0 +BOOST_PP_IS_BEGIN_PARENS(DATAP) // expands to 1

    BOOST_PP_IS_BEGIN_PARENS() // expands to 0
    +
    +
    +
    © Copyright Edward Diener 2014
    +
    +

    Distributed under the Boost Software License, Version 1.0. (See + accompanying file LICENSE_1_0.txt + or copy at www.boost.org/LICENSE_1_0.txt)

    +
    + + diff --git a/doc/ref/remove_parens.html b/doc/ref/remove_parens.html new file mode 100644 index 0000000..72312dd --- /dev/null +++ b/doc/ref/remove_parens.html @@ -0,0 +1,44 @@ + + + + BOOST_PP_REMOVE_PARENS + + + +
    The BOOST_PP_REMOVE_PARENS macro + removes the beginning parenthesis, if it exists, from the input data and + expands to the result
    +

    Usage

    +
    BOOST_PP_REMOVE_PARENS(param) (v)
    +

    Arguments    

    +

        param   +         + The input data.

    +

    Remarks

    +
    If the input begins with a parenthesis, with any data within that + parenthesis, the macro removes the parenthesis and expands to the result. + If the input does not begin with a parenthesis the macro expands to the + input.
    +
    +

    See Also

    + +

    Requirements

    + +

    Sample Code

    +
    +
    #include <boost/preprocessor/punctuation/remove_parens.hpp>

    #define DATA data
    #define DATAP ( data ) more_data

    BOOST_PP_REMOVE_PARENS(DATA) // expands to 'data' +BOOST_PP_REMOVE_PARENS(DATAP) // expands to 'data more_data'
    +
    +
    +
    © Copyright Edward Diener 2014
    +
    +

    Distributed under the Boost Software License, Version 1.0. (See + accompanying file LICENSE_1_0.txt + or copy at www.boost.org/LICENSE_1_0.txt)

    +
    + + From 4fc958a89ddb25065e39a47fb4b27210437dcdb9 Mon Sep 17 00:00:00 2001 From: Edward Diener Date: Fri, 20 Jun 2014 19:14:23 -0400 Subject: [PATCH 43/58] Remove special processing for REM_CTOR wsing VC++. --- include/boost/preprocessor/tuple/rem.hpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/include/boost/preprocessor/tuple/rem.hpp b/include/boost/preprocessor/tuple/rem.hpp index 78e47fe..aa1018f 100644 --- a/include/boost/preprocessor/tuple/rem.hpp +++ b/include/boost/preprocessor/tuple/rem.hpp @@ -16,9 +16,6 @@ # include # include # include -# if BOOST_PP_VARIADICS && BOOST_PP_VARIADICS_MSVC -# include -# endif # # /* BOOST_PP_REM */ # @@ -125,11 +122,10 @@ # define BOOST_PP_TUPLE_REM_CTOR(...) BOOST_PP_TUPLE_REM_CTOR_I(BOOST_PP_OVERLOAD(BOOST_PP_TUPLE_REM_CTOR_O_, __VA_ARGS__), (__VA_ARGS__)) # define BOOST_PP_TUPLE_REM_CTOR_I(m, args) BOOST_PP_TUPLE_REM_CTOR_II(m, args) # define BOOST_PP_TUPLE_REM_CTOR_II(m, args) BOOST_PP_CAT(m ## args,) -# define BOOST_PP_TUPLE_REM_CTOR_O_1(tuple) BOOST_PP_TUPLE_IS_SINGLE_RETURN(BOOST_PP_REM_CAT,BOOST_PP_REM,tuple) tuple # else # define BOOST_PP_TUPLE_REM_CTOR(...) BOOST_PP_OVERLOAD(BOOST_PP_TUPLE_REM_CTOR_O_, __VA_ARGS__)(__VA_ARGS__) -# define BOOST_PP_TUPLE_REM_CTOR_O_1(tuple) BOOST_PP_REM tuple # endif +# define BOOST_PP_TUPLE_REM_CTOR_O_1(tuple) BOOST_PP_REM tuple # define BOOST_PP_TUPLE_REM_CTOR_O_2(size, tuple) BOOST_PP_TUPLE_REM_CTOR_O_1(tuple) # else # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG() From 2cea910cd88cbc452313d2423e67da1548531bed Mon Sep 17 00:00:00 2001 From: Edward Diener Date: Sat, 21 Jun 2014 15:10:11 -0400 Subject: [PATCH 44/58] Simplify get_data. --- .../preprocessor/array/detail/get_data.hpp | 23 +++---------------- include/boost/preprocessor/tuple/rem.hpp | 4 ++-- 2 files changed, 5 insertions(+), 22 deletions(-) diff --git a/include/boost/preprocessor/array/detail/get_data.hpp b/include/boost/preprocessor/array/detail/get_data.hpp index fafa498..86f4049 100644 --- a/include/boost/preprocessor/array/detail/get_data.hpp +++ b/include/boost/preprocessor/array/detail/get_data.hpp @@ -14,37 +14,20 @@ # # include # include -# -# if BOOST_PP_VARIADICS && BOOST_PP_VARIADICS_MSVC && _MSC_VER > 1400 -# include # include -# include -# include # # /* BOOST_PP_ARRAY_DETAIL_GET_DATA */ # -# define BOOST_PP_ARRAY_DETAIL_GET_DATA_SINGLE(size, data) BOOST_PP_TUPLE_REM_CAT(size) data +# define BOOST_PP_ARRAY_DETAIL_GET_DATA_NONE(size, data) # define BOOST_PP_ARRAY_DETAIL_GET_DATA_ANY(size, data) BOOST_PP_TUPLE_REM(size) data -# define BOOST_PP_ARRAY_DETAIL_GET_DATA_CHECK_ZERO(size, data) \ +# define BOOST_PP_ARRAY_DETAIL_GET_DATA(size, data) \ BOOST_PP_IF \ ( \ size, \ BOOST_PP_ARRAY_DETAIL_GET_DATA_ANY, \ - BOOST_PP_ARRAY_DETAIL_GET_DATA_SINGLE \ + BOOST_PP_ARRAY_DETAIL_GET_DATA_NONE \ ) \ (size,data) \ /**/ -# define BOOST_PP_ARRAY_DETAIL_GET_DATA(size, data) \ - BOOST_PP_IIF \ - ( \ - BOOST_PP_IS_1(size), \ - BOOST_PP_ARRAY_DETAIL_GET_DATA_SINGLE, \ - BOOST_PP_ARRAY_DETAIL_GET_DATA_CHECK_ZERO \ - ) \ - (size,data) \ -/**/ -# else -# define BOOST_PP_ARRAY_DETAIL_GET_DATA(size, data) BOOST_PP_TUPLE_REM(size) data -# endif /* BOOST_PP_VARIADICS && BOOST_PP_VARIADICS_MSVC && _MSC_VER > 1400 */ # # endif /* BOOST_PREPROCESSOR_ARRAY_DETAIL_GET_DATA_HPP */ diff --git a/include/boost/preprocessor/tuple/rem.hpp b/include/boost/preprocessor/tuple/rem.hpp index aa1018f..808cab9 100644 --- a/include/boost/preprocessor/tuple/rem.hpp +++ b/include/boost/preprocessor/tuple/rem.hpp @@ -21,7 +21,7 @@ # # if BOOST_PP_VARIADICS # if BOOST_PP_VARIADICS_MSVC - /* To be used internally when __VA_ARGS__ is a single element */ + /* To be used internally when __VA_ARGS__ could be empty ( or is a single element ) */ # define BOOST_PP_REM_CAT(...) BOOST_PP_CAT(__VA_ARGS__,) # endif # define BOOST_PP_REM(...) __VA_ARGS__ @@ -36,7 +36,7 @@ */ # if BOOST_PP_VARIADICS && !(BOOST_PP_VARIADICS_MSVC && _MSC_VER <= 1400) # if BOOST_PP_VARIADICS_MSVC - /* To be used internally when the size is 1 */ + /* To be used internally when the size could be 0 ( or 1 ) */ # define BOOST_PP_TUPLE_REM_CAT(size) BOOST_PP_REM_CAT # endif # define BOOST_PP_TUPLE_REM(size) BOOST_PP_REM From c4bf80ee1daf7a17d2f400af4e8317152c599e66 Mon Sep 17 00:00:00 2001 From: Edward Diener Date: Sun, 22 Jun 2014 21:32:47 -0400 Subject: [PATCH 45/58] Cleaner inclusion if is_single_return functionality. --- include/boost/preprocessor/seq/detail/binary_transform.hpp | 2 -- .../boost/preprocessor/tuple/detail/is_single_return.hpp | 6 +++--- include/boost/preprocessor/tuple/elem.hpp | 3 --- .../boost/preprocessor/variadic/detail/is_single_return.hpp | 6 +++--- 4 files changed, 6 insertions(+), 11 deletions(-) diff --git a/include/boost/preprocessor/seq/detail/binary_transform.hpp b/include/boost/preprocessor/seq/detail/binary_transform.hpp index 1c381a7..70897b0 100644 --- a/include/boost/preprocessor/seq/detail/binary_transform.hpp +++ b/include/boost/preprocessor/seq/detail/binary_transform.hpp @@ -16,9 +16,7 @@ # include # include # include -# if BOOST_PP_VARIADICS && BOOST_PP_VARIADICS_MSVC # include -# endif # # /* BOOST_PP_SEQ_BINARY_TRANSFORM */ # diff --git a/include/boost/preprocessor/tuple/detail/is_single_return.hpp b/include/boost/preprocessor/tuple/detail/is_single_return.hpp index 9ffa3cc..02a4fb2 100644 --- a/include/boost/preprocessor/tuple/detail/is_single_return.hpp +++ b/include/boost/preprocessor/tuple/detail/is_single_return.hpp @@ -13,13 +13,13 @@ # define BOOST_PREPROCESSOR_TUPLE_DETAIL_IS_SINGLE_RETURN_HPP # # include -# include -# include -# include # # /* BOOST_PP_TUPLE_IS_SINGLE_RETURN */ # # if BOOST_PP_VARIADICS && BOOST_PP_VARIADICS_MSVC +# include +# include +# include # define BOOST_PP_TUPLE_IS_SINGLE_RETURN(sr,nsr,tuple) \ BOOST_PP_IIF(BOOST_PP_IS_1(BOOST_PP_TUPLE_SIZE(tuple)),sr,nsr) \ /**/ diff --git a/include/boost/preprocessor/tuple/elem.hpp b/include/boost/preprocessor/tuple/elem.hpp index ee8f0bd..99d0d45 100644 --- a/include/boost/preprocessor/tuple/elem.hpp +++ b/include/boost/preprocessor/tuple/elem.hpp @@ -20,10 +20,7 @@ # include # include # include -# -# if BOOST_PP_VARIADICS && BOOST_PP_VARIADICS_MSVC # include -# endif # # if BOOST_PP_VARIADICS # if BOOST_PP_VARIADICS_MSVC diff --git a/include/boost/preprocessor/variadic/detail/is_single_return.hpp b/include/boost/preprocessor/variadic/detail/is_single_return.hpp index 491e06b..5c95029 100644 --- a/include/boost/preprocessor/variadic/detail/is_single_return.hpp +++ b/include/boost/preprocessor/variadic/detail/is_single_return.hpp @@ -13,13 +13,13 @@ # define BOOST_PREPROCESSOR_VARIADIC_DETAIL_IS_SINGLE_RETURN_HPP # # include -# include -# include -# include # # /* BOOST_PP_VARIADIC_IS_SINGLE_RETURN */ # # if BOOST_PP_VARIADICS && BOOST_PP_VARIADICS_MSVC +# include +# include +# include # define BOOST_PP_VARIADIC_IS_SINGLE_RETURN(sr,nsr,...) \ BOOST_PP_IIF(BOOST_PP_IS_1(BOOST_PP_VARIADIC_SIZE(__VA_ARGS__)),sr,nsr) \ /**/ From fd36e236bca816b8d4878bb648513100fd84ec43 Mon Sep 17 00:00:00 2001 From: Edward Diener Date: Tue, 24 Jun 2014 15:01:16 -0400 Subject: [PATCH 46/58] get_data not needed. --- include/boost/preprocessor/list/to_array.hpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/include/boost/preprocessor/list/to_array.hpp b/include/boost/preprocessor/list/to_array.hpp index bd44d68..20829b9 100644 --- a/include/boost/preprocessor/list/to_array.hpp +++ b/include/boost/preprocessor/list/to_array.hpp @@ -20,7 +20,6 @@ # include # include # include -# include # if BOOST_PP_VARIADICS && BOOST_PP_VARIADICS_MSVC && (_MSC_VER <= 1400) # include # endif @@ -133,7 +132,7 @@ # endif # define BOOST_PP_LIST_TO_ARRAY_P(d, state) BOOST_PP_LIST_IS_CONS(BOOST_PP_TUPLE_ELEM(3, 0, state)) # define BOOST_PP_LIST_TO_ARRAY_O(d, state) BOOST_PP_LIST_TO_ARRAY_O_I state -# define BOOST_PP_LIST_TO_ARRAY_O_I(list, size, tuple) (BOOST_PP_LIST_REST(list), BOOST_PP_INC(size), (BOOST_PP_ARRAY_DETAIL_GET_DATA(size,tuple), BOOST_PP_LIST_FIRST(list))) +# define BOOST_PP_LIST_TO_ARRAY_O_I(list, size, tuple) (BOOST_PP_LIST_REST(list), BOOST_PP_INC(size), (BOOST_PP_TUPLE_REM(size) tuple, BOOST_PP_LIST_FIRST(list))) # # /* BOOST_PP_LIST_TO_ARRAY_D */ # From 542bd2653d5f395fbcfea4e6f19a2d2d51dd10c9 Mon Sep 17 00:00:00 2001 From: Edward Diener Date: Tue, 24 Jun 2014 15:01:39 -0400 Subject: [PATCH 47/58] Use expand to fix VC++ problem. --- include/boost/preprocessor/tuple/elem.hpp | 3 ++- include/boost/preprocessor/tuple/rem.hpp | 7 +++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/include/boost/preprocessor/tuple/elem.hpp b/include/boost/preprocessor/tuple/elem.hpp index 99d0d45..0ee8a3f 100644 --- a/include/boost/preprocessor/tuple/elem.hpp +++ b/include/boost/preprocessor/tuple/elem.hpp @@ -17,6 +17,7 @@ # # include # include +# include # include # include # include @@ -26,7 +27,7 @@ # if BOOST_PP_VARIADICS_MSVC # define BOOST_PP_TUPLE_ELEM(...) BOOST_PP_TUPLE_ELEM_I(BOOST_PP_OVERLOAD(BOOST_PP_TUPLE_ELEM_O_, __VA_ARGS__), (__VA_ARGS__)) # define BOOST_PP_TUPLE_ELEM_I(m, args) BOOST_PP_TUPLE_ELEM_II(m, args) -# define BOOST_PP_TUPLE_ELEM_II(m, args) BOOST_PP_CAT(m ## args,) +# define BOOST_PP_TUPLE_ELEM_II(m, args) BOOST_PP_CAT(BOOST_PP_EXPAND(m ## args),) /* Use BOOST_PP_REM_CAT if it is a single element tuple ( which might be empty ) else use BOOST_PP_REM. This fixes a VC++ problem with an empty tuple and BOOST_PP_TUPLE_ELEM diff --git a/include/boost/preprocessor/tuple/rem.hpp b/include/boost/preprocessor/tuple/rem.hpp index 808cab9..fe8a7d2 100644 --- a/include/boost/preprocessor/tuple/rem.hpp +++ b/include/boost/preprocessor/tuple/rem.hpp @@ -15,7 +15,9 @@ # # include # include +# include # include +# include # # /* BOOST_PP_REM */ # @@ -121,11 +123,12 @@ # if BOOST_PP_VARIADICS_MSVC # define BOOST_PP_TUPLE_REM_CTOR(...) BOOST_PP_TUPLE_REM_CTOR_I(BOOST_PP_OVERLOAD(BOOST_PP_TUPLE_REM_CTOR_O_, __VA_ARGS__), (__VA_ARGS__)) # define BOOST_PP_TUPLE_REM_CTOR_I(m, args) BOOST_PP_TUPLE_REM_CTOR_II(m, args) -# define BOOST_PP_TUPLE_REM_CTOR_II(m, args) BOOST_PP_CAT(m ## args,) +# define BOOST_PP_TUPLE_REM_CTOR_II(m, args) BOOST_PP_CAT(BOOST_PP_EXPAND(m ## args),) +# define BOOST_PP_TUPLE_REM_CTOR_O_1(tuple) BOOST_PP_TUPLE_IS_SINGLE_RETURN(BOOST_PP_REM_CAT,BOOST_PP_REM,tuple) tuple # else # define BOOST_PP_TUPLE_REM_CTOR(...) BOOST_PP_OVERLOAD(BOOST_PP_TUPLE_REM_CTOR_O_, __VA_ARGS__)(__VA_ARGS__) +# define BOOST_PP_TUPLE_REM_CTOR_O_1(tuple) BOOST_PP_REM tuple # endif -# define BOOST_PP_TUPLE_REM_CTOR_O_1(tuple) BOOST_PP_REM tuple # define BOOST_PP_TUPLE_REM_CTOR_O_2(size, tuple) BOOST_PP_TUPLE_REM_CTOR_O_1(tuple) # else # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG() From 00d05d4f042c46b564df4d6f43ac78b28b2f9db1 Mon Sep 17 00:00:00 2001 From: Edward Diener Date: Thu, 27 Feb 2014 17:06:00 -0500 Subject: [PATCH 48/58] Added links to topics with macros which use re-entrancy versions. --- doc/ref/for_r.html | 157 ++++++++++++++++++++--------------------- doc/ref/repeat_z.html | 140 +++++++++++++++++-------------------- doc/ref/while_d.html | 158 +++++++++++++++++++----------------------- 3 files changed, 211 insertions(+), 244 deletions(-) diff --git a/doc/ref/for_r.html b/doc/ref/for_r.html index 1c23bb4..a566ea7 100644 --- a/doc/ref/for_r.html +++ b/doc/ref/for_r.html @@ -1,75 +1,68 @@ - - BOOST_PP_FOR_r - - - -
    - The BOOST_PP_FOR_r macro represents a reentry into the BOOST_PP_FOR repetition construct. -
    -

    Usage

    -
    - BOOST_PP_FOR_ ## r(state, pred, op, macro) -
    -

    Arguments

    -
    -
    r
    -
    - The next available BOOST_PP_FOR repetition. -
    -
    state
    -
    - The initial state. -
    -
    pred
    -
    - A binary predicate of the form pred(r, state).  - This macro must expand to an integer in the range of 0 to BOOST_PP_LIMIT_MAG.  - BOOST_PP_FOR repeatedly expands macro while this predicate returns non-zero.  - This macro is called with the next available BOOST_PP_FOR repetition and the current state. -
    -
    op
    -
    - A binary operation of the form op(r, state).  - This operation is expanded by BOOST_PP_FOR with the next available BOOST_PP_FOR repetition and the current state.  - This macro is repeatedly applied to the state, each time producing a new state, until pred returns 0. -
    -
    macro
    -
    - A binary macro of the form macro(r, state).  - This macro is expanded by BOOST_PP_FOR with the next available BOOST_PP_FOR repetition and the current state.  - This macro is is repeated by BOOST_PP_FOR until pred returns 0. -
    -
    -

    Remarks

    -
    - This macro expands to the sequence: -
    - macro(r, state) macro(r, op(r, state)) ... macro(r, op(r, ... op(r, state) ... )) -
    -
    -
    - At certain times, it may be necessary to perform the concatenation with BOOST_PP_CAT rather than the preprocessor token-pasting operator.  - This happens when the r value is a macro invocation itself.  - It needs a delay to allow it to expand.  - The syntax in such a scenario becomes: -
    - BOOST_PP_CAT(BOOST_PP_FOR_, r)(state, pred, op, macro) -
    -
    -

    See Also

    - -

    Requirements

    - -

    Sample Code

    -
    -#include <boost/preprocessor/arithmetic/dec.hpp>
    +  
    +    
    +    BOOST_PP_FOR_r
    +    
    +  
    +  
    +    
    The BOOST_PP_FOR_r macro + represents a reentry into the BOOST_PP_FOR repetition construct.
    +

    Usage

    +
    BOOST_PP_FOR_ ## r(state, pred, + op, macro)
    +

    Arguments

    +
    +
    r
    +
    The next available BOOST_PP_FOR repetition.
    +
    state
    +
    The initial state.
    +
    pred
    +
    A binary predicate of the form pred(r, state).  + This macro must expand to an integer in the range of 0 to BOOST_PP_LIMIT_MAG.  + BOOST_PP_FOR repeatedly expands macro while this + predicate returns non-zero.  This macro is called with the next + available BOOST_PP_FOR repetition and the current state. +
    +
    op
    +
    A binary operation of the form op(r, state).  + This operation is expanded by BOOST_PP_FOR with the next + available BOOST_PP_FOR repetition and the current state.  + This macro is repeatedly applied to the state, each time + producing a new state, until pred returns 0.
    +
    macro
    +
    A binary macro of the form macro(r, state).  + This macro is expanded by BOOST_PP_FOR with the next available BOOST_PP_FOR + repetition and the current state.  This macro is is + repeated by BOOST_PP_FOR until pred returns 0.
    +
    +

    Remarks

    +
    This macro expands to the sequence: +
    macro(r, state) macro(r, op(r, + state)) ... macro(r, op(r, ... op(r, + state) ... ))
    +
    +
    At certain times, it may be necessary to perform the concatenation + with BOOST_PP_CAT rather than the preprocessor token-pasting + operator.  This happens when the r value is a macro + invocation itself.  It needs a delay to allow it to expand.  The + syntax in such a scenario becomes: +
    BOOST_PP_CAT(BOOST_PP_FOR_, r)(state, + pred, op, macro)
    +
    +

    See Also

    + +

    Requirements

    + +

    Sample Code

    +
    +
    #include <boost/preprocessor/arithmetic/dec.hpp>
     #include <boost/preprocessor/arithmetic/inc.hpp>
     #include <boost/preprocessor/comparison/not_equal.hpp>
     #include <boost/preprocessor/punctuation/comma_if.hpp>
    @@ -140,16 +133,14 @@ TEMPLATE_TEMPLATE(2, 4, T)
        template<class, class, class, class> class T4
     */
     
    -
    -
    - © Copyright Housemarque Oy 2002 -
    © Copyright Paul Mensonides 2002 -
    -
    -

    Distributed under the Boost Software License, Version 1.0. (See - accompanying file LICENSE_1_0.txt or - copy at www.boost.org/LICENSE_1_0.txt)

    -
    - +
    +
    © Copyright Housemarque Oy 2002
    + © Copyright Paul Mensonides 2002
    +
    +

    Distributed under the Boost Software License, Version 1.0. (See + accompanying file LICENSE_1_0.txt + or copy at www.boost.org/LICENSE_1_0.txt)

    +
    + diff --git a/doc/ref/repeat_z.html b/doc/ref/repeat_z.html index 36d0d03..e808135 100644 --- a/doc/ref/repeat_z.html +++ b/doc/ref/repeat_z.html @@ -1,67 +1,59 @@ - - BOOST_PP_REPEAT_z - - - -
    - The BOOST_PP_REPEAT_z macro represents a reentry into the BOOST_PP_REPEAT repetition construct. -
    -

    Usage

    -
    - BOOST_PP_REPEAT_ ## z(count, macro, data) -
    -

    Arguments

    -
    -
    z
    -
    - The next available BOOST_PP_REPEAT dimension. -
    -
    count
    -
    - The number of repetitious calls to macro.  - Valid values range from 0 to BOOST_PP_LIMIT_REPEAT. -
    -
    macro
    -
    - A ternary operation of the form macro(z, n, data).  - This macro is expanded by BOOST_PP_REPEAT with the next available repetition depth, - the current repetition number, and the auxiliary data argument.  -
    -
    data
    -
    - Auxiliary data passed to macro. -
    -
    -

    Remarks

    -
    - This macro expands to the sequence: -
    - macro(z, 0, data) macro(z, 1, data) ... macro(z, count - 1, data) -
    -
    -
    - At certain times, it may be necessary to perform the concatenation with BOOST_PP_CAT rather than the preprocessor token-pasting operator.  - This happens when the z value is a macro invocation itself.  - It needs a delay to allow it to expand.  - The syntax in such a scenario becomes: -
    - BOOST_PP_CAT(BOOST_PP_REPEAT_, z)(count, macro, data) -
    -
    -

    See Also

    - -

    Requirements

    - -

    Sample Code

    -
    -#include <boost/preprocessor/arithmetic/inc.hpp>
    +  
    +    
    +    BOOST_PP_REPEAT_z
    +    
    +  
    +  
    +    
    The BOOST_PP_REPEAT_z macro + represents a reentry into the BOOST_PP_REPEAT repetition + construct.
    +

    Usage

    +
    BOOST_PP_REPEAT_ ## z(count, macro, + data)
    +

    Arguments

    +
    +
    z
    +
    The next available BOOST_PP_REPEAT dimension.
    +
    count
    +
    The number of repetitious calls to macro.  Valid values + range from 0 to BOOST_PP_LIMIT_REPEAT.
    +
    macro
    +
    A ternary operation of the form macro(z, n, data).  + This macro is expanded by BOOST_PP_REPEAT with the next + available repetition depth, the current repetition number, and the + auxiliary data argument. 
    +
    data
    +
    Auxiliary data passed to macro.
    +
    +

    Remarks

    +
    This macro expands to the sequence: +
    macro(z, 0, data) macro(z, + 1, data) ... macro(z, count - 1, + data)
    +
    +
    At certain times, it may be necessary to perform the concatenation + with BOOST_PP_CAT rather than the preprocessor token-pasting + operator.  This happens when the z value is a macro + invocation itself.  It needs a delay to allow it to expand.  The + syntax in such a scenario becomes: +
    BOOST_PP_CAT(BOOST_PP_REPEAT_, z)(count, + macro, data)
    +
    +

    See Also

    + +

    Requirements

    + +

    Sample Code

    +
    +
    #include <boost/preprocessor/arithmetic/inc.hpp>
     #include <boost/preprocessor/punctuation/comma_if.hpp>
     #include <boost/preprocessor/repetition/repeat.hpp>
     
    @@ -85,16 +77,14 @@
           template<class, class, class> class T2
        */
     
    -
    -
    - © Copyright Housemarque Oy 2002 -
    © Copyright Paul Mensonides 2002 -
    -
    -

    Distributed under the Boost Software License, Version 1.0. (See - accompanying file LICENSE_1_0.txt or - copy at www.boost.org/LICENSE_1_0.txt)

    -
    - +
    +
    © Copyright Housemarque Oy 2002
    + © Copyright Paul Mensonides 2002
    +
    +

    Distributed under the Boost Software License, Version 1.0. (See + accompanying file LICENSE_1_0.txt + or copy at www.boost.org/LICENSE_1_0.txt)

    +
    + diff --git a/doc/ref/while_d.html b/doc/ref/while_d.html index 8b59f10..0be1bcb 100644 --- a/doc/ref/while_d.html +++ b/doc/ref/while_d.html @@ -1,78 +1,66 @@ - - BOOST_PP_WHILE_d - - - -
    - The BOOST_PP_WHILE_d macro represents a reentry into the BOOST_PP_WHILE looping construct. -
    -

    Usage

    -
    - BOOST_PP_WHILE_ ## d(pred, op, state) -
    -

    Arguments

    -
    -
    d
    -
    - The next available BOOST_PP_WHILE iteration. -
    -
    pred
    -
    - A binary predicate of the form pred(d, state).  - This predicate is expanded by BOOST_PP_WHILE with the next available - iteration d and the current state.  - This predicate must expand to value in the range of 0 to BOOST_PP_LIMIT_MAG. - The construct continues to loop until this predicate returns 0.  - When this predicate returns 0, BOOST_PP_WHILE returns the current state. -
    -
    op
    -
    - A binary operation of the form op(d, state).  - This operation is expanded by BOOST_PP_WHILE with the next available - iteration d and the current state.  - This macro is repeatedly applied to the state, each time producing a new state, until pred returns 0. -
    -
    state
    -
    - The initial state.  - Often this argument is a tuple. -
    -
    -

    Remarks

    -
    - This macro iterates op(d, state) while pred(d, state) is non-zero.  - In other words expands to: -
    - op(d, ... op(d, op(d, state)) ... ). -
    -
    -
    - At certain times, it may be necessary to perform the concatenation with BOOST_PP_CAT rather than the preprocessor token-pasting operator.  - This happens when the d value is a macro invocation itself.  - It needs a delay to allow it to expand.  - The syntax in such a scenario becomes: -
    - BOOST_PP_CAT(BOOST_PP_WHILE_, d)(pred, op, state). -
    -
    -
    - Previously, it was possible to concatenate d directly to BOOST_PP_WHILE (without the trailing underscore).  - This is no longer supported. -
    -

    See Also

    - -

    Requirements

    - -

    Sample Code

    -
    -#include <boost/preprocessor/arithmetic/add.hpp>
    +  
    +    
    +    BOOST_PP_WHILE_d
    +    
    +  
    +  
    +    
    The BOOST_PP_WHILE_d macro + represents a reentry into the BOOST_PP_WHILE looping construct.
    +

    Usage

    +
    BOOST_PP_WHILE_ ## d(pred, op, + state)
    +

    Arguments

    +
    +
    d
    +
    The next available BOOST_PP_WHILE iteration.
    +
    pred
    +
    A binary predicate of the form pred(d, state).  + This predicate is expanded by BOOST_PP_WHILE with the next + available iteration d and the current state.  This + predicate must expand to value in the range of 0 to BOOST_PP_LIMIT_MAG. + The construct continues to loop until this predicate returns 0.  + When this predicate returns 0, BOOST_PP_WHILE returns + the current state.
    +
    op
    +
    A binary operation of the form op(d, state).  + This operation is expanded by BOOST_PP_WHILE with the next + available iteration d and the current state.  This + macro is repeatedly applied to the state, each time producing a + new state, until pred returns 0.
    +
    state
    +
    The initial state.  Often this argument is a tuple.
    +
    +

    Remarks

    +
    This macro iterates op(d, state) while pred(d, + state) is non-zero.  In other words expands to: +
    op(d, ... op(d, op(d, state)) + ... ).
    +
    +
    At certain times, it may be necessary to perform the concatenation + with BOOST_PP_CAT rather than the preprocessor token-pasting + operator.  This happens when the d value is a macro + invocation itself.  It needs a delay to allow it to expand.  The + syntax in such a scenario becomes: +
    BOOST_PP_CAT(BOOST_PP_WHILE_, d)(pred, + op, state).
    +
    +
    Previously, it was possible to concatenate d directly to BOOST_PP_WHILE + (without the trailing underscore).  This is no longer supported.
    +

    See Also

    + +

    Requirements

    + +

    Sample Code

    +
    +
    #include <boost/preprocessor/arithmetic/add.hpp>
     #include <boost/preprocessor/arithmetic/dec.hpp>
     #include <boost/preprocessor/array/elem.hpp>
     #include <boost/preprocessor/array/size.hpp>
    @@ -114,16 +102,14 @@
     
     ACCUMULATE_D(1, ARRAY)// expands to 10
     
    -
    -
    - © Copyright Housemarque Oy 2002 -
    © Copyright Paul Mensonides 2002 -
    -
    -

    Distributed under the Boost Software License, Version 1.0. (See - accompanying file LICENSE_1_0.txt or - copy at www.boost.org/LICENSE_1_0.txt)

    -
    - +
    +
    © Copyright Housemarque Oy 2002
    + © Copyright Paul Mensonides 2002
    +
    +

    Distributed under the Boost Software License, Version 1.0. (See + accompanying file LICENSE_1_0.txt + or copy at www.boost.org/LICENSE_1_0.txt)

    +
    + From 83f05f532587a0a32be5f0db104989621da997e9 Mon Sep 17 00:00:00 2001 From: Edward Diener Date: Thu, 3 Jul 2014 21:02:11 -0400 Subject: [PATCH 49/58] Add links tio topics for re-entrancies. --- doc/ref/for_r.html | 2 +- doc/ref/repeat_z.html | 2 +- doc/ref/while_d.html | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/ref/for_r.html b/doc/ref/for_r.html index a566ea7..f3325ff 100644 --- a/doc/ref/for_r.html +++ b/doc/ref/for_r.html @@ -134,7 +134,7 @@ TEMPLATE_TEMPLATE(2, 4, T) */

    -
    © Copyright © Copyright Housemarque Oy 2002
    © Copyright Paul Mensonides 2002
    diff --git a/doc/ref/repeat_z.html b/doc/ref/repeat_z.html index e808135..586af90 100644 --- a/doc/ref/repeat_z.html +++ b/doc/ref/repeat_z.html @@ -78,7 +78,7 @@ */

    -
    © Copyright © Copyright Housemarque Oy 2002
    © Copyright Paul Mensonides 2002
    diff --git a/doc/ref/while_d.html b/doc/ref/while_d.html index 0be1bcb..e26ec65 100644 --- a/doc/ref/while_d.html +++ b/doc/ref/while_d.html @@ -103,7 +103,7 @@ ACCUMULATE_D(1, ARRAY)// expands to 10

    -
    © Copyright © Copyright Housemarque Oy 2002
    © Copyright Paul Mensonides 2002
    From 04634b402bef9993ffe9edb62e071197f5322325 Mon Sep 17 00:00:00 2001 From: Edward Diener Date: Thu, 27 Feb 2014 16:49:57 -0500 Subject: [PATCH 50/58] Added topics for showing lists of macros which re-enter FOR, REPEAT, and WHILE. --- doc/ref/for_r_macros.html | 39 +++++++++++++++++ doc/ref/repeat_z_macros.html | 43 +++++++++++++++++++ doc/ref/while_d_macros.html | 82 ++++++++++++++++++++++++++++++++++++ 3 files changed, 164 insertions(+) create mode 100644 doc/ref/for_r_macros.html create mode 100644 doc/ref/repeat_z_macros.html create mode 100644 doc/ref/while_d_macros.html diff --git a/doc/ref/for_r_macros.html b/doc/ref/for_r_macros.html new file mode 100644 index 0000000..854d826 --- /dev/null +++ b/doc/ref/for_r_macros.html @@ -0,0 +1,39 @@ + + + + BOOST_PP_FOR_r_macros + + + This is a list, based on functionality, of the macros which have an + alternate _r name, representing a reentry into the BOOST_PP_FOR + looping construct: +

    repetition

    + + list
    + + seq
    + +
    +
      +
    +
    +
    © Copyright Edward Diener 2014
    +
    +

    Distributed under the Boost Software License, Version 1.0. (See + accompanying file LICENSE_1_0.txt + or copy at www.boost.org/LICENSE_1_0.txt)

    +
    + + diff --git a/doc/ref/repeat_z_macros.html b/doc/ref/repeat_z_macros.html new file mode 100644 index 0000000..878a9f7 --- /dev/null +++ b/doc/ref/repeat_z_macros.html @@ -0,0 +1,43 @@ + + + + BOOST_PP_REPEAT_z_macros + + + This is a list, based on functionality, of the macros which have an + alternate _z name, representing a reentry into the BOOST_PP_REPEAT + looping construct:
    +
    + array
    + + repetition
    + +
    +
    +
    +
    +
    © Copyright Edward Diener 2014
    +
    +

    Distributed under the Boost Software License, Version 1.0. (See + accompanying file LICENSE_1_0.txt + or copy at www.boost.org/LICENSE_1_0.txt)

    +
    + + diff --git a/doc/ref/while_d_macros.html b/doc/ref/while_d_macros.html new file mode 100644 index 0000000..9d2aabb --- /dev/null +++ b/doc/ref/while_d_macros.html @@ -0,0 +1,82 @@ + + + + BOOST_PP_WHILE_d_macros + + + This is a list, based on functionality, of the macros which have an + alternate _d name, representing a reentry into the BOOST_PP_WHILE + looping construct:
    +
    + arithmetic
    + + array
    + + comparison
    + + control
    + + list
    +
      +
    + + selection
    + + repetition
    + + tuple
    + +
    +
    +
    © Copyright Edward Diener 2014
    +
    +

    Distributed under the Boost Software License, Version 1.0. (See + accompanying file LICENSE_1_0.txt + or copy at www.boost.org/LICENSE_1_0.txt)

    +
    + + From 46ff3eb1f4d7c6ac124b0de2e0af9ee1db289629 Mon Sep 17 00:00:00 2001 From: Edward Diener Date: Thu, 3 Jul 2014 21:15:56 -0400 Subject: [PATCH 51/58] Correct line endings. --- doc/ref/while_d_macros.html | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/doc/ref/while_d_macros.html b/doc/ref/while_d_macros.html index 9d2aabb..79b5a2e 100644 --- a/doc/ref/while_d_macros.html +++ b/doc/ref/while_d_macros.html @@ -12,13 +12,13 @@ array
    From 503175a63ea36c51c1ac3005e1ff753f52e79c0d Mon Sep 17 00:00:00 2001 From: Edward Diener Date: Thu, 27 Feb 2014 17:25:32 -0500 Subject: [PATCH 52/58] Added copyright and base link back to original macro. --- doc/ref/for_r.html | 4 +++- doc/ref/for_r_macros.html | 5 +++++ doc/ref/repeat_z.html | 4 +++- doc/ref/repeat_z_macros.html | 6 ++++-- doc/ref/while_d.html | 4 +++- doc/ref/while_d_macros.html | 4 ++++ 6 files changed, 22 insertions(+), 5 deletions(-) diff --git a/doc/ref/for_r.html b/doc/ref/for_r.html index f3325ff..4014a53 100644 --- a/doc/ref/for_r.html +++ b/doc/ref/for_r.html @@ -136,7 +136,9 @@ TEMPLATE_TEMPLATE(2, 4, T)
    © Copyright Housemarque Oy 2002
    - © Copyright Paul Mensonides 2002
    + © Copyright Paul Mensonides 2002
    +
    © Copyright Edward Diener 2014
    +

    Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt diff --git a/doc/ref/for_r_macros.html b/doc/ref/for_r_macros.html index 854d826..e5dda58 100644 --- a/doc/ref/for_r_macros.html +++ b/doc/ref/for_r_macros.html @@ -25,6 +25,11 @@

  • BOOST_PP_SEQ_FOR_EACH_PRODUCT_R
  • BOOST_PP_SEQ_FOR_EACH_R
  • + base
    +
    diff --git a/doc/ref/repeat_z.html b/doc/ref/repeat_z.html index 586af90..f18da06 100644 --- a/doc/ref/repeat_z.html +++ b/doc/ref/repeat_z.html @@ -80,7 +80,9 @@
    © Copyright Housemarque Oy 2002
    - © Copyright Paul Mensonides 2002
    + © Copyright Paul Mensonides 2002
    +
    © Copyright Edward Diener 2014
    +

    Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt diff --git a/doc/ref/repeat_z_macros.html b/doc/ref/repeat_z_macros.html index 878a9f7..14b8182 100644 --- a/doc/ref/repeat_z_macros.html +++ b/doc/ref/repeat_z_macros.html @@ -27,11 +27,13 @@

  • BOOST_PP_ENUM_z
  • BOOST_PP_REPEAT_FROM_TO_D_z
  • BOOST_PP_REPEAT_FROM_TO_z
  • + + base
    +
    -
    -
    +
    
         
    © Copyright Edward Diener 2014
    diff --git a/doc/ref/while_d.html b/doc/ref/while_d.html index e26ec65..b7077da 100644 --- a/doc/ref/while_d.html +++ b/doc/ref/while_d.html @@ -105,7 +105,9 @@ ACCUMULATE_D(1, ARRAY)// expands to 10
    © Copyright Housemarque Oy 2002
    - © Copyright Paul Mensonides 2002
    + © Copyright Paul Mensonides 2002
    +
    © Copyright Edward Diener 2014
    +

    Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt diff --git a/doc/ref/while_d_macros.html b/doc/ref/while_d_macros.html index 79b5a2e..7d8a945 100644 --- a/doc/ref/while_d_macros.html +++ b/doc/ref/while_d_macros.html @@ -70,6 +70,10 @@

  • BOOST_PP_TUPLE_REMOVE_D
  • BOOST_PP_TUPLE_REPLACE_D
  • + base
    +

    © Copyright Edward Diener 2014
    From cee3323340567a61bf2f3e9d86153202a325cf8c Mon Sep 17 00:00:00 2001 From: Edward Diener Date: Wed, 16 Jul 2014 19:30:51 -0400 Subject: [PATCH 53/58] Corrected link. --- doc/headers/array/to_list.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/headers/array/to_list.html b/doc/headers/array/to_list.html index 732cd0e..0c2d19a 100644 --- a/doc/headers/array/to_list.html +++ b/doc/headers/array/to_list.html @@ -11,7 +11,7 @@ defines a macro that converts an array to a list.

    Contents


    © Copyright Edward Diener 2011
    From 9c478f0c39830cba34b5628819d0d4a4e4b22aba Mon Sep 17 00:00:00 2001 From: Edward Diener Date: Sun, 20 Jul 2014 17:40:02 -0400 Subject: [PATCH 54/58] Special processing when "empty" single element . --- .../preprocessor/array/detail/get_data.hpp | 24 ++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/include/boost/preprocessor/array/detail/get_data.hpp b/include/boost/preprocessor/array/detail/get_data.hpp index 86f4049..15ae740 100644 --- a/include/boost/preprocessor/array/detail/get_data.hpp +++ b/include/boost/preprocessor/array/detail/get_data.hpp @@ -15,11 +15,33 @@ # include # include # include +# include +# include # # /* BOOST_PP_ARRAY_DETAIL_GET_DATA */ # # define BOOST_PP_ARRAY_DETAIL_GET_DATA_NONE(size, data) -# define BOOST_PP_ARRAY_DETAIL_GET_DATA_ANY(size, data) BOOST_PP_TUPLE_REM(size) data + +# if BOOST_PP_VARIADICS && !(BOOST_PP_VARIADICS_MSVC && _MSC_VER <= 1400) +# if BOOST_PP_VARIADICS_MSVC +# define BOOST_PP_ARRAY_DETAIL_GET_DATA_ANY_VC_DEFAULT(size, data) BOOST_PP_TUPLE_REM(size) data +# define BOOST_PP_ARRAY_DETAIL_GET_DATA_ANY_VC_CAT(size, data) BOOST_PP_TUPLE_REM_CAT(size) data +# define BOOST_PP_ARRAY_DETAIL_GET_DATA_ANY(size, data) \ + BOOST_PP_IIF \ + ( \ + BOOST_PP_IS_1(size), \ + BOOST_PP_ARRAY_DETAIL_GET_DATA_ANY_VC_CAT, \ + BOOST_PP_ARRAY_DETAIL_GET_DATA_ANY_VC_DEFAULT \ + ) \ + (size,data) \ +/**/ +# else +# define BOOST_PP_ARRAY_DETAIL_GET_DATA_ANY(size, data) BOOST_PP_TUPLE_REM(size) data +# endif +# else +# define BOOST_PP_ARRAY_DETAIL_GET_DATA_ANY(size, data) BOOST_PP_TUPLE_REM(size) data +# endif + # define BOOST_PP_ARRAY_DETAIL_GET_DATA(size, data) \ BOOST_PP_IF \ ( \ From 8924ad016f547babf16040cb681a18efcc0a5969 Mon Sep 17 00:00:00 2001 From: Edward Diener Date: Sun, 20 Jul 2014 17:40:34 -0400 Subject: [PATCH 55/58] Additional tests for "empty" tuples. --- test/tuple.cxx | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/test/tuple.cxx b/test/tuple.cxx index 68d7209..0f334f4 100644 --- a/test/tuple.cxx +++ b/test/tuple.cxx @@ -38,6 +38,7 @@ # define CALC(x) BOOST_PP_TUPLE_ELEM(0, x) BOOST_PP_TUPLE_ELEM(1, x) BOOST_PP_TUPLE_ELEM(2, x) # define TEST_EAT BOOST_PP_TUPLE_EAT()(1, 2) 4 +# define TEST_EAT_NONE BOOST_PP_TUPLE_EAT()() 17 # define TEST_EAT_LARGE BOOST_PP_TUPLE_EAT()(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32) 6 # define TEST_EAT_VERY_LARGE BOOST_PP_TUPLE_EAT()(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63) 8 @@ -45,6 +46,7 @@ # define CALC(x) BOOST_PP_TUPLE_ELEM(3, 0, x) BOOST_PP_TUPLE_ELEM(3, 1, x) BOOST_PP_TUPLE_ELEM(3, 2, x) # define TEST_EAT BOOST_PP_TUPLE_EAT(2)(1, 2) 4 +# define TEST_EAT_NONE BOOST_PP_TUPLE_EAT(1)() 17 # define TEST_EAT_LARGE BOOST_PP_TUPLE_EAT(33)(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32) 6 # define TEST_EAT_VERY_LARGE BOOST_PP_TUPLE_EAT(64)(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63) 8 @@ -64,6 +66,7 @@ BEGIN BOOST_PP_TUPLE_ELEM(64, 63, TUPLE_VERY_LARGE) == 63 END // reverse +BEGIN BOOST_PP_IS_EMPTY(BOOST_PP_TUPLE_ELEM(1, 0, BOOST_PP_TUPLE_REVERSE(1,TUPLE_NONE))) == 1 END BEGIN BOOST_PP_TUPLE_ELEM(6, 2, BOOST_PP_TUPLE_REVERSE(6,TUPLE)) == 3 END BEGIN BOOST_PP_TUPLE_ELEM(33, 27, BOOST_PP_TUPLE_REVERSE(33,TUPLE_LARGE)) == 5 END BEGIN BOOST_PP_TUPLE_ELEM(64, 43, BOOST_PP_TUPLE_REVERSE(64,TUPLE_VERY_LARGE)) == 20 END @@ -73,6 +76,7 @@ BEGIN CALC(BOOST_PP_TUPLE_REVERSE(3, T2)) == 6 END // eat BEGIN TEST_EAT == 4 END +BEGIN TEST_EAT_NONE == 17 END BEGIN TEST_EAT_LARGE == 6 END BEGIN TEST_EAT_VERY_LARGE == 8 END @@ -116,6 +120,7 @@ BEGIN BOOST_PP_TUPLE_ELEM(63, TUPLE_VERY_LARGE) == 63 END // reverse +BEGIN BOOST_PP_IS_EMPTY(BOOST_PP_TUPLE_ELEM(0, BOOST_PP_TUPLE_REVERSE(TUPLE_NONE))) == 1 END BEGIN BOOST_PP_TUPLE_ELEM(2, BOOST_PP_TUPLE_REVERSE(TUPLE)) == 3 END BEGIN BOOST_PP_TUPLE_ELEM(27, BOOST_PP_TUPLE_REVERSE(TUPLE_LARGE)) == 5 END BEGIN BOOST_PP_TUPLE_ELEM(43, BOOST_PP_TUPLE_REVERSE(TUPLE_VERY_LARGE)) == 20 END @@ -126,12 +131,16 @@ BEGIN BOOST_PP_VARIADIC_ELEM(45,BOOST_PP_TUPLE_ENUM(BOOST_PP_TUPLE_REVERSE(TUPLE // enum +BEGIN BOOST_PP_VARIADIC_SIZE(BOOST_PP_TUPLE_ENUM(TUPLE_NONE)) == 1 END BEGIN BOOST_PP_VARIADIC_SIZE(BOOST_PP_TUPLE_ENUM(TUPLE)) == 6 END BEGIN BOOST_PP_VARIADIC_SIZE(BOOST_PP_TUPLE_ENUM(TUPLE_LARGE)) == 33 END BEGIN BOOST_PP_VARIADIC_SIZE(BOOST_PP_TUPLE_ENUM(TUPLE_VERY_LARGE)) == 64 END // insert +BEGIN BOOST_PP_TUPLE_ELEM(0, BOOST_PP_TUPLE_INSERT(TUPLE_NONE,0,40)) == 40 END +BEGIN BOOST_PP_TUPLE_SIZE(BOOST_PP_TUPLE_INSERT(TUPLE_NONE,0,40)) == 2 END + BEGIN BOOST_PP_TUPLE_ELEM(0, BOOST_PP_TUPLE_INSERT(TUPLE,2,40)) == 0 END BEGIN BOOST_PP_TUPLE_ELEM(1, BOOST_PP_TUPLE_INSERT(TUPLE,1,40)) == 40 END BEGIN BOOST_PP_TUPLE_ELEM(2, BOOST_PP_TUPLE_INSERT(TUPLE,1,40)) == 1 END @@ -160,15 +169,19 @@ BEGIN BOOST_PP_TUPLE_ELEM(55, BOOST_PP_TUPLE_POP_FRONT(TUPLE_VERY_LARGE)) == 56 // push_back +BEGIN BOOST_PP_TUPLE_SIZE(BOOST_PP_TUPLE_PUSH_BACK(TUPLE_NONE, 1)) == 2 END BEGIN BOOST_PP_TUPLE_SIZE(BOOST_PP_TUPLE_PUSH_BACK(TUPLE, 6)) == 7 END BEGIN BOOST_PP_TUPLE_SIZE(BOOST_PP_TUPLE_PUSH_BACK(TUPLE_LARGE, 33)) == 34 END +BEGIN BOOST_PP_TUPLE_ELEM(1, BOOST_PP_TUPLE_PUSH_BACK(TUPLE_NONE, 1)) == 1 END BEGIN BOOST_PP_TUPLE_ELEM(0, BOOST_PP_TUPLE_PUSH_BACK(TUPLE, 6)) == 0 END BEGIN BOOST_PP_TUPLE_ELEM(33, BOOST_PP_TUPLE_PUSH_BACK(TUPLE_LARGE, 33)) == 33 END // push_front +BEGIN BOOST_PP_TUPLE_SIZE(BOOST_PP_TUPLE_PUSH_FRONT(TUPLE_NONE, 55)) == 2 END BEGIN BOOST_PP_TUPLE_SIZE(BOOST_PP_TUPLE_PUSH_FRONT(TUPLE, 555)) == 7 END BEGIN BOOST_PP_TUPLE_SIZE(BOOST_PP_TUPLE_PUSH_FRONT(TUPLE_LARGE, 666)) == 34 END +BEGIN BOOST_PP_TUPLE_ELEM(0, BOOST_PP_TUPLE_PUSH_FRONT(TUPLE_NONE, 55)) == 55 END BEGIN BOOST_PP_TUPLE_ELEM(0, BOOST_PP_TUPLE_PUSH_FRONT(TUPLE, 555)) == 555 END BEGIN BOOST_PP_TUPLE_ELEM(33, BOOST_PP_TUPLE_PUSH_FRONT(TUPLE_LARGE, 33)) == 32 END @@ -176,7 +189,7 @@ BEGIN BOOST_PP_TUPLE_ELEM(33, BOOST_PP_TUPLE_PUSH_FRONT(TUPLE_LARGE, 33)) == 32 #if BOOST_PP_VARIADICS_MSVC && _MSC_VER <= 1400 -BEGIN BOOST_PP_VARIADIC_SIZE(BOOST_PP_TUPLE_REM(6)(0, 1, 2, 3, 4, 5)) == 6 END +BEGIN BOOST_PP_VARIADIC_SIZE(BOOST_PP_TUPLE_REM(1)()) == 1 END BEGIN BOOST_PP_VARIADIC_SIZE(BOOST_PP_TUPLE_REM(33)(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32)) == 33 END BEGIN BOOST_PP_VARIADIC_SIZE(BOOST_PP_TUPLE_REM(64)(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63)) == 64 END @@ -213,6 +226,7 @@ BEGIN BOOST_PP_TUPLE_ELEM(62, BOOST_PP_TUPLE_REMOVE(TUPLE_VERY_LARGE, 48)) == 63 // replace BEGIN BOOST_PP_TUPLE_SIZE(BOOST_PP_TUPLE_REPLACE(TUPLE_VERY_LARGE, 27, 1000)) == 64 END +BEGIN BOOST_PP_TUPLE_ELEM(0, BOOST_PP_TUPLE_REPLACE(TUPLE_NONE, 0, 71)) == 71 END BEGIN BOOST_PP_TUPLE_ELEM(0, BOOST_PP_TUPLE_REPLACE(TUPLE, 1, 44)) == 0 END BEGIN BOOST_PP_TUPLE_ELEM(29, BOOST_PP_TUPLE_REPLACE(TUPLE_LARGE, 29, 999)) == 999 END BEGIN BOOST_PP_TUPLE_ELEM(38, BOOST_PP_TUPLE_REPLACE(TUPLE_VERY_LARGE, 37, 1)) == 38 END @@ -220,6 +234,7 @@ BEGIN BOOST_PP_TUPLE_ELEM(28, BOOST_PP_TUPLE_REPLACE(TUPLE_VERY_LARGE, 28, 1)) = // size +BEGIN BOOST_PP_TUPLE_SIZE(TUPLE_NONE) == 1 END BEGIN BOOST_PP_TUPLE_SIZE(TUPLE) == 6 END BEGIN BOOST_PP_TUPLE_SIZE(TUPLE_LARGE) == 33 END BEGIN BOOST_PP_TUPLE_SIZE(TUPLE_VERY_LARGE) == 64 END From 15f75eca350141047cbe00c8664fa4b074e21322 Mon Sep 17 00:00:00 2001 From: Edward Diener Date: Mon, 21 Jul 2014 08:38:07 -0400 Subject: [PATCH 56/58] Updated test for "empty" tuple and arrays. --- test/array.cxx | 19 ++++++++++++++++++- test/seq.cxx | 16 ++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/test/array.cxx b/test/array.cxx index 745581d..e6925ab 100644 --- a/test/array.cxx +++ b/test/array.cxx @@ -26,12 +26,14 @@ # endif # define ARRAY_EMPTY (0, ()) +# define ARRAY_ONE (1, ()) # define ARRAY (3, (0, 1, 2)) # define ARRAY_LARGE (33, (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32)) # define ARRAY_VERY_LARGE (64, (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63)) // element access +BEGIN BOOST_PP_IS_EMPTY(BOOST_PP_ARRAY_ELEM(0, ARRAY_ONE)) == 1 END BEGIN BOOST_PP_ARRAY_ELEM(1, ARRAY) == 1 END BEGIN BOOST_PP_ARRAY_ELEM(2, (5, (0, 1, 2, 3, 4))) == 2 END BEGIN BOOST_PP_ARRAY_ELEM(28, ARRAY_LARGE) == 28 END @@ -48,6 +50,7 @@ BEGIN BOOST_PP_ARRAY_SIZE((33, (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 BEGIN BOOST_PP_ARRAY_SIZE(ARRAY_VERY_LARGE) == 64 END BEGIN BOOST_PP_ARRAY_SIZE((64, (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63))) == 64 END BEGIN BOOST_PP_ARRAY_SIZE(ARRAY_EMPTY) == 0 END +BEGIN BOOST_PP_ARRAY_SIZE(ARRAY_ONE) == 1 END // enum @@ -63,7 +66,7 @@ BEGIN BOOST_PP_VARIADIC_SIZE(BOOST_PP_ARRAY_ENUM((5, (0, 1, 2, 3, 4)))) == 5 END BEGIN BOOST_PP_VARIADIC_SIZE(BOOST_PP_ARRAY_ENUM(ARRAY_LARGE)) == 33 END BEGIN BOOST_PP_VARIADIC_SIZE(BOOST_PP_ARRAY_ENUM(ARRAY_VERY_LARGE)) == 64 END BEGIN BOOST_PP_VARIADIC_SIZE(BOOST_PP_ARRAY_ENUM((64, (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63)))) == 64 END -BEGIN BOOST_PP_VARIADIC_SIZE(BOOST_PP_ARRAY_ENUM(ARRAY_EMPTY)) == 1 END +BEGIN BOOST_PP_VARIADIC_SIZE(BOOST_PP_ARRAY_ENUM(ARRAY_ONE)) == 1 END # endif @@ -74,9 +77,11 @@ BEGIN BOOST_PP_LIST_AT(BOOST_PP_ARRAY_TO_LIST((5, (0, 1, 2, 3, 4))), 4) == 4 END BEGIN BOOST_PP_LIST_AT(BOOST_PP_ARRAY_TO_LIST((33, (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32))), 26) == 26 END BEGIN BOOST_PP_LIST_AT(BOOST_PP_ARRAY_TO_LIST(ARRAY_VERY_LARGE), 60) == 60 END BEGIN BOOST_PP_LIST_SIZE(BOOST_PP_ARRAY_TO_LIST(ARRAY_EMPTY)) == 0 END +BEGIN BOOST_PP_LIST_SIZE(BOOST_PP_ARRAY_TO_LIST(ARRAY_ONE)) == 1 END // to_seq +BEGIN BOOST_PP_IS_EMPTY(BOOST_PP_SEQ_ELEM(0, BOOST_PP_ARRAY_TO_SEQ(ARRAY_ONE))) == 1 END BEGIN BOOST_PP_SEQ_ELEM(0, BOOST_PP_ARRAY_TO_SEQ(ARRAY)) == 0 END BEGIN BOOST_PP_SEQ_ELEM(3, BOOST_PP_ARRAY_TO_SEQ((5, (0, 1, 2, 3, 4)))) == 3 END BEGIN BOOST_PP_SEQ_ELEM(17, BOOST_PP_ARRAY_TO_SEQ(ARRAY_LARGE)) == 17 END @@ -86,6 +91,7 @@ BEGIN BOOST_PP_SEQ_ELEM(42, BOOST_PP_ARRAY_TO_SEQ((64, (0, 1, 2, 3, 4, 5, 6, 7, # if BOOST_PP_VARIADICS +BEGIN BOOST_PP_IS_EMPTY(BOOST_PP_TUPLE_ELEM(0, BOOST_PP_ARRAY_TO_TUPLE(ARRAY_ONE))) == 1 END BEGIN BOOST_PP_TUPLE_ELEM(2, BOOST_PP_ARRAY_TO_TUPLE(ARRAY)) == 2 END BEGIN BOOST_PP_TUPLE_ELEM(1, BOOST_PP_ARRAY_TO_TUPLE((5, (0, 1, 2, 3, 4)))) == 1 END BEGIN BOOST_PP_TUPLE_ELEM(26, BOOST_PP_ARRAY_TO_TUPLE(ARRAY_LARGE)) == 26 END @@ -93,6 +99,7 @@ BEGIN BOOST_PP_TUPLE_ELEM(37, BOOST_PP_ARRAY_TO_TUPLE((64, (0, 1, 2, 3, 4, 5, 6, # else +BEGIN BOOST_PP_IS_EMPTY(BOOST_PP_TUPLE_ELEM(1, 0, BOOST_PP_ARRAY_TO_TUPLE(ARRAY_ONE))) == 1 END BEGIN BOOST_PP_TUPLE_ELEM(3, 2, BOOST_PP_ARRAY_TO_TUPLE(ARRAY)) == 2 END BEGIN BOOST_PP_TUPLE_ELEM(5, 1, BOOST_PP_ARRAY_TO_TUPLE((5, (0, 1, 2, 3, 4)))) == 1 END BEGIN BOOST_PP_TUPLE_ELEM(33, 26, BOOST_PP_ARRAY_TO_TUPLE(ARRAY_LARGE)) == 26 END @@ -102,6 +109,7 @@ BEGIN BOOST_PP_TUPLE_ELEM(64, 37, BOOST_PP_ARRAY_TO_TUPLE((64, (0, 1, 2, 3, 4, 5 // insert +BEGIN BOOST_PP_ARRAY_ELEM(0, BOOST_PP_ARRAY_INSERT(ARRAY_ONE,0,63)) == 63 END BEGIN BOOST_PP_ARRAY_ELEM(0, BOOST_PP_ARRAY_INSERT(ARRAY,2,40)) == 0 END BEGIN BOOST_PP_ARRAY_ELEM(1, BOOST_PP_ARRAY_INSERT(ARRAY,1,40)) == 40 END BEGIN BOOST_PP_ARRAY_ELEM(2, BOOST_PP_ARRAY_INSERT(ARRAY,1,40)) == 1 END @@ -136,21 +144,26 @@ BEGIN BOOST_PP_ARRAY_ELEM(55, BOOST_PP_ARRAY_POP_FRONT(ARRAY_VERY_LARGE)) == 56 BEGIN BOOST_PP_ARRAY_SIZE(BOOST_PP_ARRAY_PUSH_BACK(ARRAY, 3)) == 4 END BEGIN BOOST_PP_ARRAY_SIZE(BOOST_PP_ARRAY_PUSH_BACK(ARRAY_LARGE, 33)) == 34 END BEGIN BOOST_PP_ARRAY_SIZE(BOOST_PP_ARRAY_PUSH_BACK(ARRAY_EMPTY, 10)) == 1 END +BEGIN BOOST_PP_ARRAY_SIZE(BOOST_PP_ARRAY_PUSH_BACK(ARRAY_ONE, 44)) == 2 END BEGIN BOOST_PP_ARRAY_ELEM(0, BOOST_PP_ARRAY_PUSH_BACK(ARRAY, 3)) == 0 END BEGIN BOOST_PP_ARRAY_ELEM(33, BOOST_PP_ARRAY_PUSH_BACK(ARRAY_LARGE, 33)) == 33 END BEGIN BOOST_PP_ARRAY_ELEM(0, BOOST_PP_ARRAY_PUSH_BACK(ARRAY_EMPTY, 136)) == 136 END +BEGIN BOOST_PP_ARRAY_ELEM(1, BOOST_PP_ARRAY_PUSH_BACK(ARRAY_ONE, 245)) == 245 END // push_front BEGIN BOOST_PP_ARRAY_SIZE(BOOST_PP_ARRAY_PUSH_FRONT(ARRAY, 555)) == 4 END BEGIN BOOST_PP_ARRAY_SIZE(BOOST_PP_ARRAY_PUSH_FRONT(ARRAY_LARGE, 666)) == 34 END BEGIN BOOST_PP_ARRAY_SIZE(BOOST_PP_ARRAY_PUSH_FRONT(ARRAY_EMPTY, 10)) == 1 END +BEGIN BOOST_PP_ARRAY_SIZE(BOOST_PP_ARRAY_PUSH_FRONT(ARRAY_ONE, 131)) == 2 END BEGIN BOOST_PP_ARRAY_ELEM(0, BOOST_PP_ARRAY_PUSH_FRONT(ARRAY, 555)) == 555 END BEGIN BOOST_PP_ARRAY_ELEM(33, BOOST_PP_ARRAY_PUSH_FRONT(ARRAY_LARGE, 33)) == 32 END BEGIN BOOST_PP_ARRAY_ELEM(0, BOOST_PP_ARRAY_PUSH_FRONT(ARRAY_EMPTY, 136)) == 136 END +BEGIN BOOST_PP_ARRAY_ELEM(0, BOOST_PP_ARRAY_PUSH_FRONT(ARRAY_ONE, 56)) == 56 END // remove +BEGIN BOOST_PP_ARRAY_SIZE(BOOST_PP_ARRAY_REMOVE(ARRAY_ONE, 0)) == 0 END BEGIN BOOST_PP_ARRAY_SIZE(BOOST_PP_ARRAY_REMOVE(ARRAY, 1)) == 2 END BEGIN BOOST_PP_ARRAY_SIZE(BOOST_PP_ARRAY_REMOVE(ARRAY_LARGE, 17)) == 32 END BEGIN BOOST_PP_ARRAY_SIZE(BOOST_PP_ARRAY_REMOVE(ARRAY_VERY_LARGE, 27)) == 63 END @@ -160,7 +173,9 @@ BEGIN BOOST_PP_ARRAY_ELEM(62, BOOST_PP_ARRAY_REMOVE(ARRAY_VERY_LARGE, 48)) == 63 // replace +BEGIN BOOST_PP_ARRAY_SIZE(BOOST_PP_ARRAY_REPLACE(ARRAY_ONE, 0, 3)) == 1 END BEGIN BOOST_PP_ARRAY_SIZE(BOOST_PP_ARRAY_REPLACE(ARRAY_VERY_LARGE, 27, 1000)) == 64 END +BEGIN BOOST_PP_ARRAY_ELEM(0, BOOST_PP_ARRAY_REPLACE(ARRAY_ONE, 0, 68)) == 68 END BEGIN BOOST_PP_ARRAY_ELEM(0, BOOST_PP_ARRAY_REPLACE(ARRAY, 1, 44)) == 0 END BEGIN BOOST_PP_ARRAY_ELEM(29, BOOST_PP_ARRAY_REPLACE(ARRAY_LARGE, 29, 999)) == 999 END BEGIN BOOST_PP_ARRAY_ELEM(38, BOOST_PP_ARRAY_REPLACE(ARRAY_VERY_LARGE, 37, 1)) == 38 END @@ -169,7 +184,9 @@ BEGIN BOOST_PP_ARRAY_ELEM(28, BOOST_PP_ARRAY_REPLACE(ARRAY_VERY_LARGE, 28, 1)) = // reverse BEGIN BOOST_PP_ARRAY_SIZE(BOOST_PP_ARRAY_REVERSE(ARRAY_VERY_LARGE)) == 64 END +BEGIN BOOST_PP_IS_EMPTY(BOOST_PP_ARRAY_ELEM(0, BOOST_PP_ARRAY_REVERSE(ARRAY_ONE))) == 1 END BEGIN BOOST_PP_ARRAY_ELEM(0, BOOST_PP_ARRAY_REVERSE(ARRAY)) == 2 END BEGIN BOOST_PP_ARRAY_ELEM(29, BOOST_PP_ARRAY_REVERSE(ARRAY_LARGE)) == 3 END BEGIN BOOST_PP_ARRAY_ELEM(38, BOOST_PP_ARRAY_REVERSE(ARRAY_VERY_LARGE)) == 25 END BEGIN BOOST_PP_ARRAY_SIZE(BOOST_PP_ARRAY_REVERSE(ARRAY_EMPTY)) == 0 END +BEGIN BOOST_PP_ARRAY_SIZE(BOOST_PP_ARRAY_REVERSE(ARRAY_ONE)) == 1 END diff --git a/test/seq.cxx b/test/seq.cxx index ae37291..bcda829 100644 --- a/test/seq.cxx +++ b/test/seq.cxx @@ -13,6 +13,7 @@ # # include # include +# include # include # include # include @@ -25,6 +26,7 @@ # include # include # include +# include # include # define SEQ_NONE () @@ -34,21 +36,30 @@ # define REVERSAL(s, x, y) BOOST_PP_SUB(y, x) # define SUB_S(s, x, y) BOOST_PP_SUB(x, y) # define ADD_S(s, x, y) BOOST_PP_ADD(x, y) +# define CAT_S(s, x, y) BOOST_PP_CAT(x, BOOST_PP_IS_EMPTY(y)) +BEGIN BOOST_PP_IS_EMPTY(BOOST_PP_SEQ_HEAD(SEQ_NONE)) == 1 END BEGIN BOOST_PP_SEQ_HEAD(SEQ) == 4 END +BEGIN BOOST_PP_SEQ_FOLD_LEFT(CAT_S, 1, SEQ_NONE) == 11 END BEGIN BOOST_PP_SEQ_FOLD_LEFT(SUB_S, 22, SEQ) == 10 END +BEGIN BOOST_PP_SEQ_FOLD_RIGHT(CAT_S, 2, SEQ_NONE) == 21 END BEGIN BOOST_PP_SEQ_FOLD_RIGHT(ADD_S, 0, SEQ) == 12 END BEGIN BOOST_PP_SEQ_FOLD_RIGHT(REVERSAL, 0, SEQ) == 4 END +BEGIN BOOST_PP_IS_EMPTY(BOOST_PP_SEQ_CAT(BOOST_PP_SEQ_REVERSE(SEQ_NONE))) == 1 END BEGIN BOOST_PP_SEQ_CAT(BOOST_PP_SEQ_REVERSE(SEQ)) == 2514 END BEGIN BOOST_PP_SEQ_CAT(BOOST_PP_SEQ_REST_N(2, SEQ)) == 52 END +BEGIN BOOST_PP_IS_EMPTY(BOOST_PP_SEQ_CAT(BOOST_PP_SEQ_FIRST_N(1, SEQ_NONE))) == 1 END BEGIN BOOST_PP_SEQ_CAT(BOOST_PP_SEQ_FIRST_N(2, SEQ)) == 41 END +BEGIN BOOST_PP_IS_EMPTY(BOOST_PP_SEQ_ELEM(0, SEQ_NONE)) == 1 END +BEGIN BOOST_PP_SEQ_SIZE(SEQ_NONE) == 1 END BEGIN BOOST_PP_SEQ_ELEM(2, SEQ) == 5 END BEGIN BOOST_PP_SEQ_SIZE(SEQ) == 4 END +BEGIN BOOST_PP_SEQ_CAT(BOOST_PP_SEQ_TRANSFORM(CAT_S, 13, SEQ_NONE)) == 131 END BEGIN BOOST_PP_SEQ_CAT(BOOST_PP_SEQ_TRANSFORM(ADD_S, 2, SEQ)) == 6374 END BEGIN BOOST_PP_SEQ_CAT(BOOST_PP_SEQ_TAIL(SEQ) SEQ) == 1524152 END @@ -74,6 +85,7 @@ BEGIN BOOST_PP_ARRAY_SIZE(BOOST_PP_SEQ_TO_ARRAY(SEQ_NONE)) == 1 END # define LESS_S(s, x, y) BOOST_PP_LESS(x, y) BEGIN BOOST_PP_SEQ_CAT(BOOST_PP_SEQ_FILTER(LESS_S, 3, SEQ)) == 45 END +BEGIN BOOST_PP_SEQ_CAT(BOOST_PP_SEQ_INSERT(SEQ_NONE, 0, 7)) == 7 END BEGIN BOOST_PP_SEQ_CAT(BOOST_PP_SEQ_INSERT(SEQ, 0, 3)) == 34152 END BEGIN BOOST_PP_SEQ_CAT(BOOST_PP_SEQ_INSERT(SEQ, 2, 3)) == 41352 END BEGIN BOOST_PP_SEQ_CAT(BOOST_PP_SEQ_INSERT(SEQ, 4, 3)) == 41523 END @@ -81,13 +93,16 @@ BEGIN BOOST_PP_SEQ_CAT(BOOST_PP_SEQ_INSERT(SEQ, 4, 3)) == 41523 END BEGIN BOOST_PP_SEQ_CAT(BOOST_PP_SEQ_POP_BACK(SEQ)) == 415 END BEGIN BOOST_PP_SEQ_CAT(BOOST_PP_SEQ_POP_FRONT(SEQ)) == 152 END +BEGIN BOOST_PP_SEQ_CAT(BOOST_PP_SEQ_PUSH_FRONT(SEQ_NONE, 145)) == 145 END BEGIN BOOST_PP_SEQ_CAT(BOOST_PP_SEQ_PUSH_FRONT(SEQ, 3)) == 34152 END +BEGIN BOOST_PP_SEQ_CAT(BOOST_PP_SEQ_PUSH_BACK(SEQ_NONE, 79)) == 79 END BEGIN BOOST_PP_SEQ_CAT(BOOST_PP_SEQ_PUSH_BACK(SEQ, 3)) == 41523 END BEGIN BOOST_PP_SEQ_CAT(BOOST_PP_SEQ_REMOVE(SEQ, 0)) == 152 END BEGIN BOOST_PP_SEQ_CAT(BOOST_PP_SEQ_REMOVE(SEQ, 2)) == 412 END BEGIN BOOST_PP_SEQ_CAT(BOOST_PP_SEQ_REMOVE(SEQ, 3)) == 415 END +BEGIN BOOST_PP_SEQ_CAT(BOOST_PP_SEQ_REPLACE(SEQ_NONE, 0, 22)) == 22 END BEGIN BOOST_PP_SEQ_CAT(BOOST_PP_SEQ_REPLACE(SEQ, 0, 3)) == 3152 END BEGIN BOOST_PP_SEQ_CAT(BOOST_PP_SEQ_REPLACE(SEQ, 1, 3)) == 4352 END BEGIN BOOST_PP_SEQ_CAT(BOOST_PP_SEQ_REPLACE(SEQ, 3, 3)) == 4153 END @@ -119,6 +134,7 @@ BEGIN BOOST_PP_LIST_SIZE(BOOST_PP_SEQ_TO_LIST(SEQ_NONE)) == 1 END #if BOOST_PP_VARIADICS +BEGIN BOOST_PP_VARIADIC_SIZE(BOOST_PP_SEQ_ENUM(SEQ_NONE)) == 1 END BEGIN BOOST_PP_VARIADIC_ELEM(0,BOOST_PP_SEQ_ENUM(SEQ)) == 4 END BEGIN BOOST_PP_TUPLE_ELEM(2,BOOST_PP_SEQ_ELEM(0,BOOST_PP_VARIADIC_SEQ_TO_SEQ(SEQVAR))) == 8 END From 1a40a5ea30322e3c4bd1a6f6a5ec27a26e108aad Mon Sep 17 00:00:00 2001 From: Daniel James Date: Mon, 18 Aug 2014 15:09:06 +0100 Subject: [PATCH 57/58] Add metadata file. --- meta/libraries.json | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 meta/libraries.json diff --git a/meta/libraries.json b/meta/libraries.json new file mode 100644 index 0000000..279c68f --- /dev/null +++ b/meta/libraries.json @@ -0,0 +1,15 @@ +{ + "key": "preprocessor", + "name": "Preprocessor", + "authors": [ + "Vesa Karvonen", + "Paul Mensonides" + ], + "description": "Preprocessor metaprogramming tools including repetition and recursion.", + "category": [ + "Preprocessor" + ], + "maintainers": [ + "Paul Mensonides " + ] +} From f77c8f2c85871213211afa0d8bbddde451a3620b Mon Sep 17 00:00:00 2001 From: Edward Diener Date: Tue, 19 Aug 2014 00:30:05 -0400 Subject: [PATCH 58/58] When using clang variadic macro support is now dependent on the C or C++ version system, and not automatically turned on in all situations. This reduces clang warnings. --- include/boost/preprocessor/config/config.hpp | 5 +- test/Jamfile.v2 | 98 ++++++++++---------- 2 files changed, 50 insertions(+), 53 deletions(-) diff --git a/include/boost/preprocessor/config/config.hpp b/include/boost/preprocessor/config/config.hpp index b6afbab..0134d88 100644 --- a/include/boost/preprocessor/config/config.hpp +++ b/include/boost/preprocessor/config/config.hpp @@ -74,11 +74,8 @@ # /* 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 # define BOOST_PP_VARIADICS 0 -# /* Clang, all versions */ -# elif defined __clang__ -# define BOOST_PP_VARIADICS 1 # /* VC++ (C/C++) */ -# elif defined _MSC_VER && _MSC_VER >= 1400 && !defined __EDG__ +# elif defined _MSC_VER && _MSC_VER >= 1400 && !defined __EDG__ && !defined __clang__ # define BOOST_PP_VARIADICS 1 # define BOOST_PP_VARIADICS_MSVC 1 # /* Wave (C/C++), GCC (C++) */ diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index 5e91c86..100df3b 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -19,22 +19,22 @@ project preprocessor_tests : requirements on test-suite preprocessor : - [ compile arithmetic.cpp : gcc:-std=c++0x ] - [ compile array.cpp : gcc:-std=c++0x ] - [ compile comparison.cpp : gcc:-std=c++0x ] - [ compile control.cpp : gcc:-std=c++0x ] - [ compile debug.cpp : gcc:-std=c++0x ] - [ compile facilities.cpp : gcc:-std=c++0x ] - [ compile iteration.cpp : gcc:-std=c++0x ] - [ compile list.cpp : gcc:-std=c++0x ] - [ compile logical.cpp : gcc:-std=c++0x ] - [ compile punctuation.cpp : gcc:-std=c++0x ] - [ compile repetition.cpp : gcc:-std=c++0x ] - [ compile selection.cpp : gcc:-std=c++0x ] - [ compile seq.cpp : gcc:-std=c++0x ] - [ compile slot.cpp : gcc:-std=c++0x ] - [ compile tuple.cpp : gcc:-std=c++0x ] - [ compile variadic.cpp : gcc:-std=c++0x ] + [ compile arithmetic.cpp : gcc:-std=c++0x clang:-std=c++0x ] + [ compile array.cpp : gcc:-std=c++0x clang:-std=c++0x ] + [ compile comparison.cpp : gcc:-std=c++0x clang:-std=c++0x ] + [ compile control.cpp : gcc:-std=c++0x clang:-std=c++0x ] + [ compile debug.cpp : gcc:-std=c++0x clang:-std=c++0x ] + [ compile facilities.cpp : gcc:-std=c++0x clang:-std=c++0x ] + [ compile iteration.cpp : gcc:-std=c++0x clang:-std=c++0x ] + [ compile list.cpp : gcc:-std=c++0x clang:-std=c++0x ] + [ compile logical.cpp : gcc:-std=c++0x clang:-std=c++0x ] + [ compile punctuation.cpp : gcc:-std=c++0x clang:-std=c++0x ] + [ compile repetition.cpp : gcc:-std=c++0x clang:-std=c++0x ] + [ compile selection.cpp : gcc:-std=c++0x clang:-std=c++0x ] + [ compile seq.cpp : gcc:-std=c++0x clang:-std=c++0x ] + [ compile slot.cpp : gcc:-std=c++0x clang:-std=c++0x ] + [ compile tuple.cpp : gcc:-std=c++0x clang:-std=c++0x ] + [ compile variadic.cpp : gcc:-std=c++0x clang:-std=c++0x ] ; test-suite preprocessor_nvm @@ -58,59 +58,59 @@ test-suite preprocessor_nvm test-suite preprocessor_c : [ compile arithmetic.c - : gcc:-std=c99 + : gcc:-std=c99 clang:-std=c99 : arithmetic_c ] [ compile array.c - : gcc:-std=c99 + : gcc:-std=c99 clang:-std=c99 : array_c ] [ compile comparison.c - : gcc:-std=c99 + : gcc:-std=c99 clang:-std=c99 : comparison_c ] [ compile control.c - : gcc:-std=c99 + : gcc:-std=c99 clang:-std=c99 : control_c ] [ compile debug.c - : gcc:-std=c99 + : gcc:-std=c99 clang:-std=c99 : debug_c ] [ compile facilities.c - : gcc:-std=c99 + : gcc:-std=c99 clang:-std=c99 : facilities_c ] [ compile list.c - : gcc:-std=c99 + : gcc:-std=c99 clang:-std=c99 : list_c ] [ compile logical.c - : gcc:-std=c99 + : gcc:-std=c99 clang:-std=c99 : logical_c ] [ compile punctuation.c - : gcc:-std=c99 + : gcc:-std=c99 clang:-std=c99 : punctuation_c ] [ compile selection.c - : gcc:-std=c99 + : gcc:-std=c99 clang:-std=c99 : selection_c ] [ compile seq.c - : gcc:-std=c99 + : gcc:-std=c99 clang:-std=c99 : seq_c ] [ compile slot.c - : gcc:-std=c99 + : gcc:-std=c99 clang:-std=c99 : slot_c ] [ compile tuple.c - : gcc:-std=c99 + : gcc:-std=c99 clang:-std=c99 : tuple_c ] [ compile variadic.c - : gcc:-std=c99 + : gcc:-std=c99 clang:-std=c99 : variadic_c ] ; @@ -119,71 +119,71 @@ test-suite preprocessor_c_nvm : [ compile arithmetic.c : BOOST_PP_VARIADICS=0 - gcc:-std=c99 + gcc:-std=c99 clang:-std=c99 : arithmetic_c_nvm ] [ compile array.c : BOOST_PP_VARIADICS=0 - gcc:-std=c99 + gcc:-std=c99 clang:-std=c99 : array_c_nvm ] [ compile comparison.c : BOOST_PP_VARIADICS=0 - gcc:-std=c99 + gcc:-std=c99 clang:-std=c99 : comparison_c_nvm ] [ compile control.c : BOOST_PP_VARIADICS=0 - gcc:-std=c99 + gcc:-std=c99 clang:-std=c99 : control_c_nvm ] [ compile debug.c : BOOST_PP_VARIADICS=0 - gcc:-std=c99 + gcc:-std=c99 clang:-std=c99 : debug_c_nvm ] [ compile facilities.c : BOOST_PP_VARIADICS=0 - gcc:-std=c99 + gcc:-std=c99 clang:-std=c99 : facilities_c_nvm ] [ compile list.c : BOOST_PP_VARIADICS=0 - gcc:-std=c99 + gcc:-std=c99 clang:-std=c99 : list_c_nvm ] [ compile logical.c : BOOST_PP_VARIADICS=0 - gcc:-std=c99 + gcc:-std=c99 clang:-std=c99 : logical_c_nvm ] [ compile selection.c : BOOST_PP_VARIADICS=0 - gcc:-std=c99 + gcc:-std=c99 clang:-std=c99 : selection_c_nvm ] [ compile seq.c : BOOST_PP_VARIADICS=0 - gcc:-std=c99 + gcc:-std=c99 clang:-std=c99 : seq_c_nvm ] [ compile slot.c : BOOST_PP_VARIADICS=0 - gcc:-std=c99 + gcc:-std=c99 clang:-std=c99 : slot_c_nvm ] [ compile tuple.c : BOOST_PP_VARIADICS=0 - gcc:-std=c99 + gcc:-std=c99 clang:-std=c99 : tuple_c_nvm ] ; test-suite preprocessor_isempty : - [ compile isempty.cpp : gcc:-std=c++0x ] - [ compile-fail isempty_variadic_standard_failure.cpp : gcc:-std=c++0x ] - [ compile-fail isempty_variadic_standard_failure2.cpp : gcc:-std=c++0x ] + [ compile isempty.cpp : gcc:-std=c++0x clang:-std=c++0x ] + [ compile-fail isempty_variadic_standard_failure.cpp : gcc:-std=c++0x clang:-std=c++0x ] + [ compile-fail isempty_variadic_standard_failure2.cpp : gcc:-std=c++0x clang:-std=c++0x ] ; test-suite preprocessor_isempty_nvm @@ -194,15 +194,15 @@ test-suite preprocessor_isempty_nvm test-suite preprocessor_isempty_c : [ compile isempty.c - : gcc:-std=c99 + : gcc:-std=c99 clang:-std=c99 : isempty_c ] [ compile-fail isempty_variadic_standard_failure.c - : gcc:-std=c99 + : gcc:-std=c99 clang:-std=c99 : isempty_variadic_standard_failure_c ] [ compile-fail isempty_variadic_standard_failure2.c - : gcc:-std=c99 + : gcc:-std=c99 clang:-std=c99 : isempty_variadic_standard_failure2_c ] ; @@ -211,7 +211,7 @@ test-suite preprocessor_isempty_c_nvm : [ compile isempty.c : BOOST_PP_VARIADICS=0 - gcc:-std=c99 + gcc:-std=c99 clang:-std=c99 : isempty_c_nvm ] ;