epoc32/include/stdapis/boost/mpl/transform.hpp
branchSymbian3
changeset 4 837f303aceeb
parent 3 e1b950c65cb4
     1.1 --- a/epoc32/include/stdapis/boost/mpl/transform.hpp	Wed Mar 31 12:27:01 2010 +0100
     1.2 +++ b/epoc32/include/stdapis/boost/mpl/transform.hpp	Wed Mar 31 12:33:34 2010 +0100
     1.3 @@ -1,48 +1,145 @@
     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_TRANSFORM_HPP
    1.16 -# define BOOST_PREPROCESSOR_SEQ_TRANSFORM_HPP
    1.17 -#
    1.18 -# include <boost/preprocessor/config/config.hpp>
    1.19 -# include <boost/preprocessor/seq/fold_left.hpp>
    1.20 -# include <boost/preprocessor/seq/seq.hpp>
    1.21 -# include <boost/preprocessor/tuple/elem.hpp>
    1.22 -# include <boost/preprocessor/tuple/rem.hpp>
    1.23 -#
    1.24 -# /* BOOST_PP_SEQ_TRANSFORM */
    1.25 -#
    1.26 -# if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG()
    1.27 -#    define BOOST_PP_SEQ_TRANSFORM(op, data, seq) BOOST_PP_SEQ_TAIL(BOOST_PP_TUPLE_ELEM(3, 2, BOOST_PP_SEQ_FOLD_LEFT(BOOST_PP_SEQ_TRANSFORM_O, (op, data, (nil)), seq)))
    1.28 -# else
    1.29 -#    define BOOST_PP_SEQ_TRANSFORM(op, data, seq) BOOST_PP_SEQ_TRANSFORM_I(op, data, seq)
    1.30 -#    define BOOST_PP_SEQ_TRANSFORM_I(op, data, seq) BOOST_PP_SEQ_TAIL(BOOST_PP_TUPLE_ELEM(3, 2, BOOST_PP_SEQ_FOLD_LEFT(BOOST_PP_SEQ_TRANSFORM_O, (op, data, (nil)), seq)))
    1.31 -# endif
    1.32 -#
    1.33 -# if BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_STRICT()
    1.34 -#    define BOOST_PP_SEQ_TRANSFORM_O(s, state, elem) BOOST_PP_SEQ_TRANSFORM_O_IM(s, BOOST_PP_TUPLE_REM_3 state, elem)
    1.35 -#    define BOOST_PP_SEQ_TRANSFORM_O_IM(s, im, elem) BOOST_PP_SEQ_TRANSFORM_O_I(s, im, elem)
    1.36 -# else
    1.37 -#    define BOOST_PP_SEQ_TRANSFORM_O(s, state, elem) BOOST_PP_SEQ_TRANSFORM_O_I(s, BOOST_PP_TUPLE_ELEM(3, 0, state), BOOST_PP_TUPLE_ELEM(3, 1, state), BOOST_PP_TUPLE_ELEM(3, 2, state), elem)
    1.38 -# endif
    1.39 -#
    1.40 -# define BOOST_PP_SEQ_TRANSFORM_O_I(s, op, data, res, elem) (op, data, res (op(s, data, elem)))
    1.41 -#
    1.42 -# /* BOOST_PP_SEQ_TRANSFORM_S */
    1.43 -#
    1.44 -# if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG()
    1.45 -#    define BOOST_PP_SEQ_TRANSFORM_S(s, op, data, seq) BOOST_PP_SEQ_TAIL(BOOST_PP_TUPLE_ELEM(3, 2, BOOST_PP_SEQ_FOLD_LEFT_ ## s(BOOST_PP_SEQ_TRANSFORM_O, (op, data, (nil)), seq)))
    1.46 -# else
    1.47 -#    define BOOST_PP_SEQ_TRANSFORM_S(s, op, data, seq) BOOST_PP_SEQ_TRANSFORM_S_I(s, op, data, seq)
    1.48 -#    define BOOST_PP_SEQ_TRANSFORM_S_I(s, op, data, seq) BOOST_PP_SEQ_TAIL(BOOST_PP_TUPLE_ELEM(3, 2, BOOST_PP_SEQ_FOLD_LEFT_ ## s(BOOST_PP_SEQ_TRANSFORM_O, (op, data, (nil)), seq)))
    1.49 -# endif
    1.50 -#
    1.51 -# endif
    1.52 +
    1.53 +#ifndef BOOST_MPL_TRANSFORM_HPP_INCLUDED
    1.54 +#define BOOST_MPL_TRANSFORM_HPP_INCLUDED
    1.55 +
    1.56 +// Copyright Aleksey Gurtovoy 2000-2004
    1.57 +// Copyright David Abrahams 2003-2004
    1.58 +//
    1.59 +// Distributed under the Boost Software License, Version 1.0. 
    1.60 +// (See accompanying file LICENSE_1_0.txt or copy at 
    1.61 +// http://www.boost.org/LICENSE_1_0.txt)
    1.62 +//
    1.63 +// See http://www.boost.org/libs/mpl for documentation.
    1.64 +
    1.65 +// $Source: /cvsroot/boost/boost/boost/mpl/transform.hpp,v $
    1.66 +// $Date: 2004/12/20 17:18:17 $
    1.67 +// $Revision: 1.10 $
    1.68 +
    1.69 +#include <boost/mpl/fold.hpp>
    1.70 +#include <boost/mpl/reverse_fold.hpp>
    1.71 +#include <boost/mpl/pair_view.hpp>
    1.72 +#include <boost/mpl/is_sequence.hpp>
    1.73 +#include <boost/mpl/eval_if.hpp>
    1.74 +#include <boost/mpl/lambda.hpp>
    1.75 +#include <boost/mpl/bind.hpp>
    1.76 +#include <boost/mpl/or.hpp>
    1.77 +#include <boost/mpl/not.hpp>
    1.78 +#include <boost/mpl/aux_/na.hpp>
    1.79 +#include <boost/mpl/aux_/inserter_algorithm.hpp>
    1.80 +
    1.81 +namespace boost { namespace mpl {
    1.82 +
    1.83 +namespace aux { 
    1.84 +
    1.85 +template< 
    1.86 +      typename Seq
    1.87 +    , typename Op
    1.88 +    , typename In
    1.89 +    >
    1.90 +struct transform1_impl
    1.91 +    : fold< 
    1.92 +          Seq
    1.93 +        , typename In::state
    1.94 +        , bind2< typename lambda< typename In::operation >::type
    1.95 +            , _1
    1.96 +            , bind1< typename lambda<Op>::type, _2>
    1.97 +            > 
    1.98 +        >
    1.99 +{
   1.100 +};
   1.101 +
   1.102 +template< 
   1.103 +      typename Seq
   1.104 +    , typename Op
   1.105 +    , typename In
   1.106 +    >
   1.107 +struct reverse_transform1_impl
   1.108 +    : reverse_fold< 
   1.109 +          Seq
   1.110 +        , typename In::state
   1.111 +        , bind2< typename lambda< typename In::operation >::type
   1.112 +            , _1
   1.113 +            , bind1< typename lambda<Op>::type, _2>
   1.114 +            > 
   1.115 +        >
   1.116 +{
   1.117 +};
   1.118 +
   1.119 +template< 
   1.120 +      typename Seq1
   1.121 +    , typename Seq2
   1.122 +    , typename Op
   1.123 +    , typename In
   1.124 +    >
   1.125 +struct transform2_impl
   1.126 +    : fold< 
   1.127 +          pair_view<Seq1,Seq2>
   1.128 +        , typename In::state
   1.129 +        , bind2< typename lambda< typename In::operation >::type
   1.130 +            , _1
   1.131 +            , bind2<
   1.132 +                  typename lambda<Op>::type
   1.133 +                , bind1<first<>,_2>
   1.134 +                , bind1<second<>,_2>
   1.135 +                >
   1.136 +            > 
   1.137 +        >
   1.138 +{
   1.139 +};
   1.140 +
   1.141 +template< 
   1.142 +      typename Seq1
   1.143 +    , typename Seq2
   1.144 +    , typename Op
   1.145 +    , typename In
   1.146 +    >
   1.147 +struct reverse_transform2_impl
   1.148 +    : reverse_fold< 
   1.149 +          pair_view<Seq1,Seq2>
   1.150 +        , typename In::state
   1.151 +        , bind2< typename lambda< typename In::operation >::type
   1.152 +            , _1
   1.153 +            , bind2< typename lambda< Op >::type
   1.154 +                , bind1<first<>,_2>
   1.155 +                , bind1<second<>,_2>
   1.156 +                >
   1.157 +            > 
   1.158 +        >
   1.159 +{
   1.160 +};
   1.161 +
   1.162 +} // namespace aux 
   1.163 +
   1.164 +BOOST_MPL_AUX_INSERTER_ALGORITHM_DEF(3, transform1)                    
   1.165 +BOOST_MPL_AUX_INSERTER_ALGORITHM_DEF(4, transform2)
   1.166 +    
   1.167 +#define AUX778076_TRANSFORM_DEF(name)                                   \
   1.168 +template<                                                               \
   1.169 +      typename BOOST_MPL_AUX_NA_PARAM(Seq1)                             \
   1.170 +    , typename BOOST_MPL_AUX_NA_PARAM(Seq2OrOperation)                  \
   1.171 +    , typename BOOST_MPL_AUX_NA_PARAM(OperationOrInserter)              \
   1.172 +    , typename BOOST_MPL_AUX_NA_PARAM(Inserter)                         \
   1.173 +    >                                                                   \
   1.174 +struct name                                                             \
   1.175 +{                                                                       \
   1.176 +    typedef typename eval_if<                                           \
   1.177 +          or_<                                                          \
   1.178 +              is_na<OperationOrInserter>                                \
   1.179 +            , is_lambda_expression< Seq2OrOperation >                   \
   1.180 +            , not_< is_sequence<Seq2OrOperation> >                      \
   1.181 +            >                                                           \
   1.182 +        , name##1<Seq1,Seq2OrOperation,OperationOrInserter>             \
   1.183 +        , name##2<Seq1,Seq2OrOperation,OperationOrInserter,Inserter>    \
   1.184 +        >::type type;                                                   \
   1.185 +};                                                                      \
   1.186 +BOOST_MPL_AUX_NA_SPEC(4, name)                                          \
   1.187 +/**/
   1.188 +
   1.189 +AUX778076_TRANSFORM_DEF(transform)
   1.190 +AUX778076_TRANSFORM_DEF(reverse_transform)
   1.191 +
   1.192 +#undef AUX778076_TRANSFORM_DEF
   1.193 +
   1.194 +}}
   1.195 +
   1.196 +#endif // BOOST_MPL_TRANSFORM_HPP_INCLUDED