1.1 --- a/epoc32/include/stdapis/boost/mpl/for_each.hpp Wed Mar 31 12:27:01 2010 +0100
1.2 +++ b/epoc32/include/stdapis/boost/mpl/for_each.hpp Wed Mar 31 12:33:34 2010 +0100
1.3 @@ -1,60 +1,112 @@
1.4 -# /* **************************************************************************
1.5 -# * *
1.6 -# * (C) Copyright Paul Mensonides 2002.
1.7 -# * Distributed under the Boost Software License, Version 1.0. (See
1.8 -# * accompanying file LICENSE_1_0.txt or copy at
1.9 -# * http://www.boost.org/LICENSE_1_0.txt)
1.10 -# * *
1.11 -# ************************************************************************** */
1.12 -#
1.13 -# /* See http://www.boost.org for most recent version. */
1.14 -#
1.15 -# ifndef BOOST_PREPROCESSOR_SEQ_FOR_EACH_HPP
1.16 -# define BOOST_PREPROCESSOR_SEQ_FOR_EACH_HPP
1.17 -#
1.18 -# include <boost/preprocessor/arithmetic/dec.hpp>
1.19 -# include <boost/preprocessor/config/config.hpp>
1.20 -# include <boost/preprocessor/repetition/for.hpp>
1.21 -# include <boost/preprocessor/seq/seq.hpp>
1.22 -# include <boost/preprocessor/seq/size.hpp>
1.23 -# include <boost/preprocessor/tuple/elem.hpp>
1.24 -# include <boost/preprocessor/tuple/rem.hpp>
1.25 -#
1.26 -# /* BOOST_PP_SEQ_FOR_EACH */
1.27 -#
1.28 -# if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG()
1.29 -# define BOOST_PP_SEQ_FOR_EACH(macro, data, seq) BOOST_PP_FOR((macro, data, seq (nil)), BOOST_PP_SEQ_FOR_EACH_P, BOOST_PP_SEQ_FOR_EACH_O, BOOST_PP_SEQ_FOR_EACH_M)
1.30 -# else
1.31 -# define BOOST_PP_SEQ_FOR_EACH(macro, data, seq) BOOST_PP_SEQ_FOR_EACH_D(macro, data, seq)
1.32 -# define BOOST_PP_SEQ_FOR_EACH_D(macro, data, seq) BOOST_PP_FOR((macro, data, seq (nil)), BOOST_PP_SEQ_FOR_EACH_P, BOOST_PP_SEQ_FOR_EACH_O, BOOST_PP_SEQ_FOR_EACH_M)
1.33 -# endif
1.34 -#
1.35 -# define BOOST_PP_SEQ_FOR_EACH_P(r, x) BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(BOOST_PP_TUPLE_ELEM(3, 2, x)))
1.36 -#
1.37 -# if BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_STRICT()
1.38 -# define BOOST_PP_SEQ_FOR_EACH_O(r, x) BOOST_PP_SEQ_FOR_EACH_O_I x
1.39 -# else
1.40 -# define BOOST_PP_SEQ_FOR_EACH_O(r, x) BOOST_PP_SEQ_FOR_EACH_O_I(BOOST_PP_TUPLE_ELEM(3, 0, x), BOOST_PP_TUPLE_ELEM(3, 1, x), BOOST_PP_TUPLE_ELEM(3, 2, x))
1.41 -# endif
1.42 -#
1.43 -# define BOOST_PP_SEQ_FOR_EACH_O_I(macro, data, seq) (macro, data, BOOST_PP_SEQ_TAIL(seq))
1.44 -#
1.45 -# if BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_STRICT()
1.46 -# define BOOST_PP_SEQ_FOR_EACH_M(r, x) BOOST_PP_SEQ_FOR_EACH_M_IM(r, BOOST_PP_TUPLE_REM_3 x)
1.47 -# define BOOST_PP_SEQ_FOR_EACH_M_IM(r, im) BOOST_PP_SEQ_FOR_EACH_M_I(r, im)
1.48 -# else
1.49 -# define BOOST_PP_SEQ_FOR_EACH_M(r, x) BOOST_PP_SEQ_FOR_EACH_M_I(r, BOOST_PP_TUPLE_ELEM(3, 0, x), BOOST_PP_TUPLE_ELEM(3, 1, x), BOOST_PP_TUPLE_ELEM(3, 2, x))
1.50 -# endif
1.51 -#
1.52 -# define BOOST_PP_SEQ_FOR_EACH_M_I(r, macro, data, seq) macro(r, data, BOOST_PP_SEQ_HEAD(seq))
1.53 -#
1.54 -# /* BOOST_PP_SEQ_FOR_EACH_R */
1.55 -#
1.56 -# if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG()
1.57 -# define BOOST_PP_SEQ_FOR_EACH_R(r, macro, data, seq) BOOST_PP_FOR_ ## r((macro, data, seq (nil)), BOOST_PP_SEQ_FOR_EACH_P, BOOST_PP_SEQ_FOR_EACH_O, BOOST_PP_SEQ_FOR_EACH_M)
1.58 -# else
1.59 -# define BOOST_PP_SEQ_FOR_EACH_R(r, macro, data, seq) BOOST_PP_SEQ_FOR_EACH_R_I(r, macro, data, seq)
1.60 -# define BOOST_PP_SEQ_FOR_EACH_R_I(r, macro, data, seq) BOOST_PP_FOR_ ## r((macro, data, seq (nil)), BOOST_PP_SEQ_FOR_EACH_P, BOOST_PP_SEQ_FOR_EACH_O, BOOST_PP_SEQ_FOR_EACH_M)
1.61 -# endif
1.62 -#
1.63 -# endif
1.64 +
1.65 +#ifndef BOOST_MPL_FOR_EACH_HPP_INCLUDED
1.66 +#define BOOST_MPL_FOR_EACH_HPP_INCLUDED
1.67 +
1.68 +// Copyright Aleksey Gurtovoy 2000-2004
1.69 +//
1.70 +// Distributed under the Boost Software License, Version 1.0.
1.71 +// (See accompanying file LICENSE_1_0.txt or copy at
1.72 +// http://www.boost.org/LICENSE_1_0.txt)
1.73 +//
1.74 +// See http://www.boost.org/libs/mpl for documentation.
1.75 +
1.76 +// $Source: /cvsroot/boost/boost/boost/mpl/for_each.hpp,v $
1.77 +// $Date: 2004/09/04 01:33:46 $
1.78 +// $Revision: 1.9 $
1.79 +
1.80 +#include <boost/mpl/begin_end.hpp>
1.81 +#include <boost/mpl/apply.hpp>
1.82 +#include <boost/mpl/bool.hpp>
1.83 +#include <boost/mpl/next_prior.hpp>
1.84 +#include <boost/mpl/deref.hpp>
1.85 +#include <boost/mpl/identity.hpp>
1.86 +#include <boost/mpl/aux_/unwrap.hpp>
1.87 +
1.88 +#include <boost/type_traits/is_same.hpp>
1.89 +#include <boost/utility/value_init.hpp>
1.90 +
1.91 +namespace boost { namespace mpl {
1.92 +
1.93 +namespace aux {
1.94 +
1.95 +template< bool done = true >
1.96 +struct for_each_impl
1.97 +{
1.98 + template<
1.99 + typename Iterator
1.100 + , typename LastIterator
1.101 + , typename TransformFunc
1.102 + , typename F
1.103 + >
1.104 + static void execute(
1.105 + Iterator*
1.106 + , LastIterator*
1.107 + , TransformFunc*
1.108 + , F
1.109 + )
1.110 + {
1.111 + }
1.112 +};
1.113 +
1.114 +template<>
1.115 +struct for_each_impl<false>
1.116 +{
1.117 + template<
1.118 + typename Iterator
1.119 + , typename LastIterator
1.120 + , typename TransformFunc
1.121 + , typename F
1.122 + >
1.123 + static void execute(
1.124 + Iterator*
1.125 + , LastIterator*
1.126 + , TransformFunc*
1.127 + , F f
1.128 + )
1.129 + {
1.130 + typedef typename deref<Iterator>::type item;
1.131 + typedef typename apply1<TransformFunc,item>::type arg;
1.132 +
1.133 + // dwa 2002/9/10 -- make sure not to invoke undefined behavior
1.134 + // when we pass arg.
1.135 + value_initialized<arg> x;
1.136 + aux::unwrap(f, 0)(boost::get(x));
1.137 +
1.138 + typedef typename mpl::next<Iterator>::type iter;
1.139 + for_each_impl<boost::is_same<iter,LastIterator>::value>
1.140 + ::execute((iter*)0, (LastIterator*)0, (TransformFunc*)0, f);
1.141 + }
1.142 +};
1.143 +
1.144 +} // namespace aux
1.145 +
1.146 +// agurt, 17/mar/02: pointer default parameters are necessary to workaround
1.147 +// MSVC 6.5 function template signature's mangling bug
1.148 +template<
1.149 + typename Sequence
1.150 + , typename TransformOp
1.151 + , typename F
1.152 + >
1.153 +inline
1.154 +void for_each(F f, Sequence* = 0, TransformOp* = 0)
1.155 +{
1.156 + typedef typename begin<Sequence>::type first;
1.157 + typedef typename end<Sequence>::type last;
1.158 +
1.159 + aux::for_each_impl< boost::is_same<first,last>::value >
1.160 + ::execute((first*)0, (last*)0, (TransformOp*)0, f);
1.161 +}
1.162 +
1.163 +template<
1.164 + typename Sequence
1.165 + , typename F
1.166 + >
1.167 +inline
1.168 +void for_each(F f, Sequence* = 0)
1.169 +{
1.170 + for_each<Sequence, identity<> >(f);
1.171 +}
1.172 +
1.173 +}}
1.174 +
1.175 +#endif // BOOST_MPL_FOR_EACH_HPP_INCLUDED