diff --git a/include/boost/preprocessor/list/cat.hpp b/include/boost/preprocessor/list/cat.hpp index 695a01c..088914b 100644 --- a/include/boost/preprocessor/list/cat.hpp +++ b/include/boost/preprocessor/list/cat.hpp @@ -33,7 +33,7 @@ expands to 123. #define BOOST_PP_LIST_CAT(L) BOOST_PP_LIST_CAT_D(0,L) #ifndef DOXYGEN_SHOULD_SKIP_THIS -#define BOOST_PP_LIST_CAT_D(D,L) BOOST_PP_LIST_FOLD_LEFT_D(D,BOOST_PP_LIST_CAT_F,BOOST_PP_LIST_FIRST(L),BOOST_PP_LIST_REST(L)) +#define BOOST_PP_LIST_CAT_D(D,L) BOOST_PP_LIST_FOLD_LEFT_D(D,BOOST_PP_LIST_CAT_F,BOOST_PP_TUPLE3_ELEM0 L,BOOST_PP_TUPLE3_ELEM1 L) #define BOOST_PP_LIST_CAT_F(D,P,H) BOOST_PP_CAT(P,H) #endif #endif diff --git a/include/boost/preprocessor/list/filter.hpp b/include/boost/preprocessor/list/filter.hpp index 2bf2956..c320bed 100644 --- a/include/boost/preprocessor/list/filter.hpp +++ b/include/boost/preprocessor/list/filter.hpp @@ -33,6 +33,10 @@ expands to a list containing 1 and 3. #ifndef DOXYGEN_SHOULD_SKIP_THIS #define BOOST_PP_LIST_FILTER_D(D,F,P,L) BOOST_PP_TUPLE_ELEM(3,2,BOOST_PP_LIST_FOLD_RIGHT_D(D,BOOST_PP_LIST_FILTER_F,L,(F,P,(_,_,0)))) -#define BOOST_PP_LIST_FILTER_F(D,H,P) (BOOST_PP_TUPLE_ELEM(3,0,P),BOOST_PP_TUPLE3_ELEM1 P,BOOST_PP_IF(BOOST_PP_TUPLE3_ELEM0 P(D,BOOST_PP_TUPLE3_ELEM1 P,H),BOOST_PP_LIST_CONS,BOOST_PP_TUPLE2_ELEM1)(H,BOOST_PP_TUPLE3_ELEM2 P)) +#if !defined(BOOST_NO_COMPILER_CONFIG) && defined(_MSC_VER) +# define BOOST_PP_LIST_FILTER_F(D,H,P) (BOOST_PP_TUPLE_ELEM(3,0,P),BOOST_PP_TUPLE3_ELEM1 P,BOOST_PP_IF(BOOST_PP_TUPLE3_ELEM0 P(D,BOOST_PP_TUPLE3_ELEM1 P,H),BOOST_PP_LIST_CONS,BOOST_PP_TUPLE2_ELEM1)(H,BOOST_PP_TUPLE3_ELEM2 P)) +#else +# define BOOST_PP_LIST_FILTER_F(D,H,P) (BOOST_PP_TUPLE3_ELEM0 P,BOOST_PP_TUPLE3_ELEM1 P,BOOST_PP_IF(BOOST_PP_TUPLE3_ELEM0 P(D,BOOST_PP_TUPLE3_ELEM1 P,H),BOOST_PP_LIST_CONS,BOOST_PP_TUPLE2_ELEM1)(H,BOOST_PP_TUPLE3_ELEM2 P)) +#endif #endif #endif diff --git a/include/boost/preprocessor/list/first_n.hpp b/include/boost/preprocessor/list/first_n.hpp index 7e09f6b..f2aec1d 100644 --- a/include/boost/preprocessor/list/first_n.hpp +++ b/include/boost/preprocessor/list/first_n.hpp @@ -35,7 +35,7 @@ expands to a list containing + and -. #ifndef DOXYGEN_SHOULD_SKIP_THIS #define BOOST_PP_LIST_FIRST_N_D(D,N,L) BOOST_PP_LIST_REVERSE_D(D,BOOST_PP_TUPLE_ELEM(3,0,BOOST_PP_WHILE##D(BOOST_PP_LIST_FIRST_N_C,BOOST_PP_LIST_FIRST_N_F,((_,_,0),L,N)))) -#define BOOST_PP_LIST_FIRST_N_C(D,X) BOOST_PP_TUPLE_ELEM(3,2,X) -#define BOOST_PP_LIST_FIRST_N_F(D,X) ((BOOST_PP_LIST_FIRST(BOOST_PP_TUPLE_ELEM(3,1,X)),BOOST_PP_TUPLE_ELEM(3,0,X),1),BOOST_PP_LIST_REST(BOOST_PP_TUPLE_ELEM(3,1,X)),BOOST_PP_DEC(BOOST_PP_TUPLE_ELEM(3,2,X))) +#define BOOST_PP_LIST_FIRST_N_C(D,X) BOOST_PP_TUPLE3_ELEM2 X +#define BOOST_PP_LIST_FIRST_N_F(D,X) ((BOOST_PP_TUPLE3_ELEM0 BOOST_PP_TUPLE3_ELEM1 X,BOOST_PP_TUPLE3_ELEM0 X,1),BOOST_PP_TUPLE3_ELEM1 BOOST_PP_TUPLE3_ELEM1 X,BOOST_PP_DEC(BOOST_PP_TUPLE3_ELEM2 X)) #endif #endif diff --git a/include/boost/preprocessor/list/fold_left.hpp b/include/boost/preprocessor/list/fold_left.hpp index f4d1d32..c96717e 100644 --- a/include/boost/preprocessor/list/fold_left.hpp +++ b/include/boost/preprocessor/list/fold_left.hpp @@ -39,7 +39,7 @@ expands to: \endverbatim Note that folding, or accumulation, is a very general pattern of computation. -Most list operations can implemented in terms of folding. +Most list operations can be implemented in terms of folding. See BOOST_PP_LIST_FOLD_RIGHT(). */ @@ -48,6 +48,10 @@ See BOOST_PP_LIST_FOLD_RIGHT(). #ifndef DOXYGEN_SHOULD_SKIP_THIS #define BOOST_PP_LIST_FOLD_LEFT_D(D,F,P,L) BOOST_PP_TUPLE_ELEM(3,1,BOOST_PP_WHILE##D(BOOST_PP_LIST_FOLD_LEFT_C,BOOST_PP_LIST_FOLD_LEFT_F,(F,P,L))) #define BOOST_PP_LIST_FOLD_LEFT_C(D,X) BOOST_PP_TUPLE3_ELEM2 BOOST_PP_TUPLE3_ELEM2 X -#define BOOST_PP_LIST_FOLD_LEFT_F(D,X) (BOOST_PP_TUPLE_ELEM(3,0,X),BOOST_PP_TUPLE3_ELEM0 X(D,BOOST_PP_TUPLE3_ELEM1 X,BOOST_PP_TUPLE3_ELEM0 BOOST_PP_TUPLE3_ELEM2 X),BOOST_PP_TUPLE3_ELEM1 BOOST_PP_TUPLE3_ELEM2 X) +#if !defined(BOOST_NO_COMPILER_CONFIG) && defined(_MSC_VER) +# define BOOST_PP_LIST_FOLD_LEFT_F(D,X) (BOOST_PP_TUPLE_ELEM(3,0,X),BOOST_PP_TUPLE3_ELEM0 X(D,BOOST_PP_TUPLE3_ELEM1 X,BOOST_PP_TUPLE3_ELEM0 BOOST_PP_TUPLE3_ELEM2 X),BOOST_PP_TUPLE3_ELEM1 BOOST_PP_TUPLE3_ELEM2 X) +#else +# define BOOST_PP_LIST_FOLD_LEFT_F(D,X) (BOOST_PP_TUPLE3_ELEM0 X,BOOST_PP_TUPLE3_ELEM0 X(D,BOOST_PP_TUPLE3_ELEM1 X,BOOST_PP_TUPLE3_ELEM0 BOOST_PP_TUPLE3_ELEM2 X),BOOST_PP_TUPLE3_ELEM1 BOOST_PP_TUPLE3_ELEM2 X) +#endif #endif #endif diff --git a/include/boost/preprocessor/list/fold_right.hpp b/include/boost/preprocessor/list/fold_right.hpp index 679e65a..0a50263 100644 --- a/include/boost/preprocessor/list/fold_right.hpp +++ b/include/boost/preprocessor/list/fold_right.hpp @@ -51,6 +51,10 @@ See BOOST_PP_LIST_FOLD_LEFT(). #ifndef DOXYGEN_SHOULD_SKIP_THIS #define BOOST_PP_LIST_FOLD_RIGHT_D(D,F,L,P) BOOST_PP_TUPLE_ELEM(2,1,BOOST_PP_LIST_FOLD_LEFT_D(D,BOOST_PP_LIST_FOLD_RIGHT_F,(F,P),BOOST_PP_LIST_REVERSE_D(D,L))) -#define BOOST_PP_LIST_FOLD_RIGHT_F(D,P,H) (BOOST_PP_TUPLE_ELEM(2,0,P),BOOST_PP_TUPLE_ELEM(2,0,P)(D,H,BOOST_PP_TUPLE2_ELEM1 P)) +#if !defined(BOOST_NO_COMPILER_CONFIG) && defined(_MSC_VER) +# define BOOST_PP_LIST_FOLD_RIGHT_F(D,P,H) (BOOST_PP_TUPLE_ELEM(2,0,P),BOOST_PP_TUPLE_ELEM(2,0,P)(D,H,BOOST_PP_TUPLE2_ELEM1 P)) +#else +# define BOOST_PP_LIST_FOLD_RIGHT_F(D,P,H) (BOOST_PP_TUPLE2_ELEM0 P,BOOST_PP_TUPLE2_ELEM0 P(D,H,BOOST_PP_TUPLE2_ELEM1 P)) +#endif #endif #endif diff --git a/include/boost/preprocessor/list/for_each.hpp b/include/boost/preprocessor/list/for_each.hpp index efd985b..1cbd2f7 100644 --- a/include/boost/preprocessor/list/for_each.hpp +++ b/include/boost/preprocessor/list/for_each.hpp @@ -37,8 +37,12 @@ See BOOST_PP_FOR() for an explanation of the R parameter. #ifndef DOXYGEN_SHOULD_SKIP_THIS #define BOOST_PP_LIST_FOR_EACH_R(R,F,P,L) BOOST_PP_FOR##R((F,P,L,0),BOOST_PP_LIST_FOR_EACH_C,BOOST_PP_LIST_FOR_EACH_F,BOOST_PP_LIST_FOR_EACH_I) -#define BOOST_PP_LIST_FOR_EACH_C(R,FPL) BOOST_PP_LIST_IS_CONS(BOOST_PP_TUPLE4_ELEM2 FPL) -#define BOOST_PP_LIST_FOR_EACH_F(R,FPL) (BOOST_PP_TUPLE_ELEM(4,0,FPL),BOOST_PP_TUPLE4_ELEM1 FPL,BOOST_PP_LIST_REST(BOOST_PP_TUPLE4_ELEM2 FPL),BOOST_PP_INC(BOOST_PP_TUPLE4_ELEM3 FPL)) -#define BOOST_PP_LIST_FOR_EACH_I(R,FPL) BOOST_PP_TUPLE4_ELEM0 FPL(BOOST_PP_TUPLE4_ELEM3 FPL,BOOST_PP_TUPLE4_ELEM1 FPL,BOOST_PP_LIST_FIRST(BOOST_PP_TUPLE4_ELEM2 FPL)) +#if !defined(BOOST_NO_COMPILER_CONFIG) && defined(_MSC_VER) +# define BOOST_PP_LIST_FOR_EACH_C(R,FPL) BOOST_PP_LIST_IS_CONS(BOOST_PP_TUPLE4_ELEM2 FPL) +#else +# define BOOST_PP_LIST_FOR_EACH_C(R,FPL) BOOST_PP_TUPLE3_ELEM2 BOOST_PP_TUPLE4_ELEM2 FPL +#endif +#define BOOST_PP_LIST_FOR_EACH_F(R,FPL) (BOOST_PP_TUPLE_ELEM(4,0,FPL),BOOST_PP_TUPLE4_ELEM1 FPL,BOOST_PP_TUPLE3_ELEM1 BOOST_PP_TUPLE4_ELEM2 FPL,BOOST_PP_INC(BOOST_PP_TUPLE4_ELEM3 FPL)) +#define BOOST_PP_LIST_FOR_EACH_I(R,FPL) BOOST_PP_TUPLE4_ELEM0 FPL(BOOST_PP_TUPLE4_ELEM3 FPL,BOOST_PP_TUPLE4_ELEM1 FPL,BOOST_PP_TUPLE3_ELEM0 BOOST_PP_TUPLE4_ELEM2 FPL) #endif #endif diff --git a/include/boost/preprocessor/list/rest_n.hpp b/include/boost/preprocessor/list/rest_n.hpp index fc7a844..8e29f29 100644 --- a/include/boost/preprocessor/list/rest_n.hpp +++ b/include/boost/preprocessor/list/rest_n.hpp @@ -36,6 +36,6 @@ expands to a list containing * and /. #ifndef DOXYGEN_SHOULD_SKIP_THIS #define BOOST_PP_LIST_REST_N_D(D,N,L) BOOST_PP_TUPLE_ELEM(2,0,BOOST_PP_WHILE##D(BOOST_PP_LIST_REST_N_C,BOOST_PP_LIST_REST_N_F,(L,N))) #define BOOST_PP_LIST_REST_N_C(D,X) BOOST_PP_TUPLE2_ELEM1 X -#define BOOST_PP_LIST_REST_N_F(D,X) (BOOST_PP_LIST_REST(BOOST_PP_TUPLE2_ELEM0 X),BOOST_PP_DEC(BOOST_PP_TUPLE2_ELEM1 X)) +#define BOOST_PP_LIST_REST_N_F(D,X) (BOOST_PP_TUPLE3_ELEM1 BOOST_PP_TUPLE2_ELEM0 X,BOOST_PP_DEC(BOOST_PP_TUPLE2_ELEM1 X)) #endif #endif diff --git a/include/boost/preprocessor/list/transform.hpp b/include/boost/preprocessor/list/transform.hpp index 49c23d3..0e213a8 100644 --- a/include/boost/preprocessor/list/transform.hpp +++ b/include/boost/preprocessor/list/transform.hpp @@ -43,6 +43,10 @@ expands to a list containing 3 and 4. #ifndef DOXYGEN_SHOULD_SKIP_THIS #define BOOST_PP_LIST_TRANSFORM_D(D,F,P,L) BOOST_PP_TUPLE_ELEM(3,2,BOOST_PP_LIST_FOLD_RIGHT_D(D,BOOST_PP_LIST_TRANSFORM_F,L,(F,P,(_,_,0)))) -#define BOOST_PP_LIST_TRANSFORM_F(D,H,P) (BOOST_PP_TUPLE_ELEM(3,0,P),BOOST_PP_TUPLE3_ELEM1 P,(BOOST_PP_TUPLE_ELEM(3,0,P)(D,BOOST_PP_TUPLE3_ELEM1 P,H),BOOST_PP_TUPLE3_ELEM2 P,1)) +#if !defined(BOOST_NO_COMPILER_CONFIG) && defined(_MSC_VER) +# define BOOST_PP_LIST_TRANSFORM_F(D,H,P) (BOOST_PP_TUPLE_ELEM(3,0,P),BOOST_PP_TUPLE3_ELEM1 P,(BOOST_PP_TUPLE_ELEM(3,0,P)(D,BOOST_PP_TUPLE3_ELEM1 P,H),BOOST_PP_TUPLE3_ELEM2 P,1)) +#else +# define BOOST_PP_LIST_TRANSFORM_F(D,H,P) (BOOST_PP_TUPLE3_ELEM0 P,BOOST_PP_TUPLE3_ELEM1 P,(BOOST_PP_TUPLE3_ELEM0 P(D,BOOST_PP_TUPLE3_ELEM1 P,H),BOOST_PP_TUPLE3_ELEM2 P,1)) +#endif #endif #endif