From 86be4492a3bedd7464301f3d3fc07b8066b4b121 Mon Sep 17 00:00:00 2001 From: Vesa Karvonen Date: Fri, 22 Feb 2002 10:38:40 +0000 Subject: [PATCH] Added BOOST_PP_FOLD_LEFT_2ND() [SVN r12894] --- .../boost/preprocessor/list/fold_left_2nd.hpp | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 include/boost/preprocessor/list/fold_left_2nd.hpp diff --git a/include/boost/preprocessor/list/fold_left_2nd.hpp b/include/boost/preprocessor/list/fold_left_2nd.hpp new file mode 100644 index 0000000..d7d6f49 --- /dev/null +++ b/include/boost/preprocessor/list/fold_left_2nd.hpp @@ -0,0 +1,35 @@ +#ifndef BOOST_PREPROCESSOR_LIST_FOLD_LEFT_2ND_HPP +#define BOOST_PREPROCESSOR_LIST_FOLD_LEFT_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_FOLD_LEFT(), but is implemented independently.

*/ +#define BOOST_PP_LIST_FOLD_LEFT_2ND(F,P,L) BOOST_PP_LIST_FOLD_LEFT_2ND_D(0,F,P,L) + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +#define BOOST_PP_LIST_FOLD_LEFT_2ND_D(D,F,P,L) BOOST_PP_TUPLE_ELEM(3,1,BOOST_PP_WHILE##D(BOOST_PP_LIST_FOLD_LEFT_2ND_C,BOOST_PP_LIST_FOLD_LEFT_2ND_F,(F,P,L))) +#if !defined(BOOST_NO_COMPILER_CONFIG) && defined(__MWERKS__) && __MWERKS__ <= 0x2406 +# define BOOST_PP_LIST_FOLD_LEFT_2ND_C(D,X) BOOST_PP_TUPLE_ELEM(3,2,BOOST_PP_TUPLE_ELEM(3,2,X)) +# define BOOST_PP_LIST_FOLD_LEFT_2ND_F(D,X) (BOOST_PP_TUPLE_ELEM(3,0,X),BOOST_PP_TUPLE_ELEM(3,0,X)(D,BOOST_PP_TUPLE_ELEM(3,1,X),BOOST_PP_TUPLE_ELEM(3,0,BOOST_PP_TUPLE_ELEM(3,2,X))),BOOST_PP_TUPLE_ELEM(3,1,BOOST_PP_TUPLE_ELEM(3,2,X))) +#elif !defined(BOOST_NO_COMPILER_CONFIG) && defined(_MSC_VER) +# define BOOST_PP_LIST_FOLD_LEFT_2ND_C(D,X) BOOST_PP_TUPLE3_ELEM2 BOOST_PP_TUPLE3_ELEM2 X +# define BOOST_PP_LIST_FOLD_LEFT_2ND_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_2ND_C(D,X) BOOST_PP_TUPLE3_ELEM2 BOOST_PP_TUPLE3_ELEM2 X +# define BOOST_PP_LIST_FOLD_LEFT_2ND_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