Added BOOST_PP_FOLD_RIGHT_2ND

[SVN r12896]
This commit is contained in:
Vesa Karvonen
2002-02-22 11:03:40 +00:00
parent ffef0494ce
commit 4834a1927b
2 changed files with 33 additions and 1 deletions

View File

@ -20,7 +20,7 @@
#include <boost/preprocessor/list/cat.hpp>
#include <boost/preprocessor/list/filter.hpp>
#include <boost/preprocessor/list/first_n.hpp>
#include <boost/preprocessor/list/fold_left_2nd.hpp>
#include <boost/preprocessor/list/fold_right_2nd.hpp>
#include <boost/preprocessor/list/for_each.hpp>
#include <boost/preprocessor/list/for_each_product.hpp>
#include <boost/preprocessor/list/size.hpp>

View File

@ -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 <boost/preprocessor/list/fold_left_2nd.hpp>
#include <boost/preprocessor/list/reverse.hpp>
/** <p>Same as BOOST_PP_LIST_FOLD_RIGHT(), but is implemented independently.</p> */
#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