From 4834a1927b3e6dcf2a41d28d58b2903dc7817c19 Mon Sep 17 00:00:00 2001 From: Vesa Karvonen Date: Fri, 22 Feb 2002 11:03:40 +0000 Subject: [PATCH] Added BOOST_PP_FOLD_RIGHT_2ND [SVN r12896] --- include/boost/preprocessor/list.hpp | 2 +- .../preprocessor/list/fold_right_2nd.hpp | 32 +++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 include/boost/preprocessor/list/fold_right_2nd.hpp diff --git a/include/boost/preprocessor/list.hpp b/include/boost/preprocessor/list.hpp index 8a03819..77dc79a 100644 --- a/include/boost/preprocessor/list.hpp +++ b/include/boost/preprocessor/list.hpp @@ -20,7 +20,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/include/boost/preprocessor/list/fold_right_2nd.hpp b/include/boost/preprocessor/list/fold_right_2nd.hpp new file mode 100644 index 0000000..f7b055f --- /dev/null +++ b/include/boost/preprocessor/list/fold_right_2nd.hpp @@ -0,0 +1,32 @@ +#ifndef BOOST_PREPROCESSOR_LIST_FOLD_RIGHT_2ND_HPP +#define BOOST_PREPROCESSOR_LIST_FOLD_RIGHT_2ND_HPP + +/* Copyright (C) 2002 + * Housemarque Oy + * http://www.housemarque.com + * + * Permission to copy, use, modify, sell and distribute this software is + * granted provided this copyright notice appears in all copies. This + * software is provided "as is" without express or implied warranty, and + * with no claim as to its suitability for any purpose. + * + * See http://www.boost.org for most recent version. + */ + +#include +#include + +/**

Same as BOOST_PP_LIST_FOLD_RIGHT(), but is implemented independently.

*/ +#define BOOST_PP_LIST_FOLD_RIGHT_2ND(F,L,P) BOOST_PP_LIST_FOLD_RIGHT_2ND_D(0,F,L,P) + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +#define BOOST_PP_LIST_FOLD_RIGHT_2ND_D(D,F,L,P) BOOST_PP_TUPLE_ELEM(2,1,BOOST_PP_LIST_FOLD_LEFT_2ND_D(D,BOOST_PP_LIST_FOLD_RIGHT_2ND_F,(F,P),BOOST_PP_LIST_FOLD_LEFT_2ND_D(D,BOOST_PP_LIST_REVERSE_F,(_,_,0),L))) +#if !defined(BOOST_NO_COMPILER_CONFIG) && defined(__MWERKS__) && __MWERKS__ <= 0x2406 +# define BOOST_PP_LIST_FOLD_RIGHT_2ND_F(D,P,H) (BOOST_PP_TUPLE_ELEM(2,0,P),BOOST_PP_TUPLE_ELEM(2,0,P)(D,H,BOOST_PP_TUPLE_ELEM(2,1,P))) +#elif !defined(BOOST_NO_COMPILER_CONFIG) && defined(_MSC_VER) +# define BOOST_PP_LIST_FOLD_RIGHT_2ND_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_2ND_F(D,P,H) (BOOST_PP_TUPLE2_ELEM0 P,BOOST_PP_TUPLE2_ELEM0 P(D,H,BOOST_PP_TUPLE2_ELEM1 P)) +#endif +#endif +#endif