epoc32/include/stdapis/boost/mpl/iter_fold_if.hpp
branchSymbian2
changeset 2 2fe1408b6811
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/epoc32/include/stdapis/boost/mpl/iter_fold_if.hpp	Tue Mar 16 16:12:26 2010 +0000
     1.3 @@ -0,0 +1,117 @@
     1.4 +
     1.5 +#ifndef BOOST_MPL_ITER_FOLD_IF_HPP_INCLUDED
     1.6 +#define BOOST_MPL_ITER_FOLD_IF_HPP_INCLUDED
     1.7 +
     1.8 +// Copyright Aleksey Gurtovoy 2003-2004
     1.9 +// Copyright Eric Friedman 2003
    1.10 +//
    1.11 +// Distributed under the Boost Software License, Version 1.0. 
    1.12 +// (See accompanying file LICENSE_1_0.txt or copy at 
    1.13 +// http://www.boost.org/LICENSE_1_0.txt)
    1.14 +//
    1.15 +// See http://www.boost.org/libs/mpl for documentation.
    1.16 +
    1.17 +// $Source: /cvsroot/boost/boost/boost/mpl/iter_fold_if.hpp,v $
    1.18 +// $Date: 2004/09/02 15:40:41 $
    1.19 +// $Revision: 1.7 $
    1.20 +
    1.21 +#include <boost/mpl/begin_end.hpp>
    1.22 +#include <boost/mpl/logical.hpp>
    1.23 +#include <boost/mpl/always.hpp>
    1.24 +#include <boost/mpl/eval_if.hpp>
    1.25 +#include <boost/mpl/if.hpp>
    1.26 +#include <boost/mpl/pair.hpp>
    1.27 +#include <boost/mpl/apply.hpp>
    1.28 +#include <boost/mpl/aux_/iter_fold_if_impl.hpp>
    1.29 +#include <boost/mpl/aux_/na_spec.hpp>
    1.30 +#include <boost/mpl/aux_/lambda_support.hpp>
    1.31 +#include <boost/mpl/aux_/config/forwarding.hpp>
    1.32 +#include <boost/mpl/aux_/config/workaround.hpp>
    1.33 +
    1.34 +#include <boost/type_traits/is_same.hpp>
    1.35 +
    1.36 +namespace boost { namespace mpl {
    1.37 +
    1.38 +namespace aux {
    1.39 +
    1.40 +template< typename Predicate, typename LastIterator >
    1.41 +struct iter_fold_if_pred
    1.42 +{
    1.43 +    template< typename State, typename Iterator > struct apply
    1.44 +#if !defined(BOOST_MPL_CFG_NO_NESTED_FORWARDING)
    1.45 +        : and_<
    1.46 +              not_< is_same<Iterator,LastIterator> >
    1.47 +            , apply1<Predicate,Iterator>
    1.48 +            >
    1.49 +    {
    1.50 +#else
    1.51 +    {
    1.52 +        typedef and_<
    1.53 +              not_< is_same<Iterator,LastIterator> >
    1.54 +            , apply1<Predicate,Iterator>
    1.55 +            > type;
    1.56 +#endif
    1.57 +    };
    1.58 +};
    1.59 +
    1.60 +} // namespace aux
    1.61 +
    1.62 +template<
    1.63 +      typename BOOST_MPL_AUX_NA_PARAM(Sequence)
    1.64 +    , typename BOOST_MPL_AUX_NA_PARAM(State)
    1.65 +    , typename BOOST_MPL_AUX_NA_PARAM(ForwardOp)
    1.66 +    , typename BOOST_MPL_AUX_NA_PARAM(ForwardPredicate)
    1.67 +    , typename BOOST_MPL_AUX_NA_PARAM(BackwardOp)
    1.68 +    , typename BOOST_MPL_AUX_NA_PARAM(BackwardPredicate)
    1.69 +    >
    1.70 +struct iter_fold_if
    1.71 +{
    1.72 +
    1.73 +    typedef typename begin<Sequence>::type first_;
    1.74 +    typedef typename end<Sequence>::type last_;
    1.75 +
    1.76 +    typedef typename eval_if<
    1.77 +          is_na<BackwardPredicate>
    1.78 +        , if_< is_na<BackwardOp>, always<false_>, always<true_> >
    1.79 +        , identity<BackwardPredicate>
    1.80 +        >::type backward_pred_;
    1.81 +
    1.82 +// cwpro8 doesn't like 'cut-off' type here (use typedef instead)
    1.83 +#if !BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003)) && !BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(600))
    1.84 +    struct result_ :
    1.85 +#else
    1.86 +    typedef
    1.87 +#endif
    1.88 +        aux::iter_fold_if_impl<
    1.89 +          first_
    1.90 +        , State
    1.91 +        , ForwardOp
    1.92 +        , protect< aux::iter_fold_if_pred< ForwardPredicate,last_ > >
    1.93 +        , BackwardOp
    1.94 +        , backward_pred_
    1.95 +        >
    1.96 +#if !BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003)) && !BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(600))
    1.97 +    { };
    1.98 +#else
    1.99 +    result_;
   1.100 +#endif
   1.101 +
   1.102 +public:
   1.103 +
   1.104 +    typedef pair<
   1.105 +          typename result_::state
   1.106 +        , typename result_::iterator
   1.107 +        > type;
   1.108 +
   1.109 +    BOOST_MPL_AUX_LAMBDA_SUPPORT(
   1.110 +          6
   1.111 +        , iter_fold_if
   1.112 +        , (Sequence,State,ForwardOp,ForwardPredicate,BackwardOp,BackwardPredicate)
   1.113 +        )
   1.114 +};
   1.115 +
   1.116 +BOOST_MPL_AUX_NA_SPEC(6, iter_fold_if)
   1.117 +
   1.118 +}}
   1.119 +
   1.120 +#endif // BOOST_MPL_ITER_FOLD_IF_HPP_INCLUDED