epoc32/include/stdapis/boost/mpl/pair_view.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/pair_view.hpp	Tue Mar 16 16:12:26 2010 +0000
     1.3 @@ -0,0 +1,169 @@
     1.4 +
     1.5 +#ifndef BOOST_MPL_PAIR_VIEW_HPP_INCLUDED
     1.6 +#define BOOST_MPL_PAIR_VIEW_HPP_INCLUDED
     1.7 +
     1.8 +// Copyright David Abrahams 2003-2004
     1.9 +// Copyright Aleksey Gurtovoy 2004
    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/pair_view.hpp,v $
    1.18 +// $Date: 2004/11/28 01:56:21 $
    1.19 +// $Revision: 1.5 $
    1.20 +
    1.21 +#include <boost/mpl/begin_end.hpp>
    1.22 +#include <boost/mpl/iterator_category.hpp>
    1.23 +#include <boost/mpl/advance.hpp>
    1.24 +#include <boost/mpl/distance.hpp>
    1.25 +#include <boost/mpl/next_prior.hpp>
    1.26 +#include <boost/mpl/deref.hpp>
    1.27 +#include <boost/mpl/min_max.hpp>
    1.28 +#include <boost/mpl/pair.hpp>
    1.29 +#include <boost/mpl/iterator_tags.hpp>
    1.30 +#include <boost/mpl/aux_/config/ctps.hpp>
    1.31 +#include <boost/mpl/aux_/na_spec.hpp>
    1.32 +
    1.33 +namespace boost { namespace mpl {
    1.34 +
    1.35 +namespace aux {
    1.36 +struct pair_iter_tag;
    1.37 +
    1.38 +#if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
    1.39 +
    1.40 +template< typename Iter1, typename Iter2, typename Category >
    1.41 +struct pair_iter;
    1.42 +
    1.43 +template< typename Category > struct prior_pair_iter
    1.44 +{
    1.45 +    template< typename Iter1, typename Iter2 > struct apply
    1.46 +    {
    1.47 +        typedef typename mpl::prior<Iter1>::type i1_;
    1.48 +        typedef typename mpl::prior<Iter2>::type i2_;
    1.49 +        typedef pair_iter<i1_,i2_,Category> type;
    1.50 +    };
    1.51 +};
    1.52 +
    1.53 +template<> struct prior_pair_iter<forward_iterator_tag>
    1.54 +{
    1.55 +    template< typename Iter1, typename Iter2 > struct apply
    1.56 +    {
    1.57 +        typedef pair_iter<Iter1,Iter2,forward_iterator_tag> type;
    1.58 +    };
    1.59 +};
    1.60 +
    1.61 +#endif
    1.62 +}
    1.63 +
    1.64 +template< 
    1.65 +      typename Iter1
    1.66 +    , typename Iter2
    1.67 +    , typename Category
    1.68 +    >
    1.69 +struct pair_iter
    1.70 +{
    1.71 +    typedef aux::pair_iter_tag tag;
    1.72 +    typedef Category category;
    1.73 +    typedef Iter1 first;
    1.74 +    typedef Iter2 second;
    1.75 +    
    1.76 +#if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
    1.77 +    typedef pair< 
    1.78 +          typename deref<Iter1>::type
    1.79 +        , typename deref<Iter2>::type
    1.80 +        > type;
    1.81 +
    1.82 +    typedef typename mpl::next<Iter1>::type i1_;
    1.83 +    typedef typename mpl::next<Iter2>::type i2_;
    1.84 +    typedef pair_iter<i1_,i2_,Category> next;
    1.85 +    
    1.86 +    typedef apply_wrap2< aux::prior_pair_iter<Category>,Iter1,Iter2 >::type prior;
    1.87 +#endif
    1.88 +};
    1.89 +
    1.90 +
    1.91 +#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
    1.92 +
    1.93 +template< typename Iter1, typename Iter2, typename C >
    1.94 +struct deref< pair_iter<Iter1,Iter2,C> >
    1.95 +{
    1.96 +    typedef pair< 
    1.97 +          typename deref<Iter1>::type
    1.98 +        , typename deref<Iter2>::type
    1.99 +        > type;
   1.100 +};
   1.101 +
   1.102 +template< typename Iter1, typename Iter2, typename C >
   1.103 +struct next< pair_iter<Iter1,Iter2,C> >
   1.104 +{
   1.105 +    typedef typename mpl::next<Iter1>::type i1_;
   1.106 +    typedef typename mpl::next<Iter2>::type i2_;
   1.107 +    typedef pair_iter<i1_,i2_,C> type;
   1.108 +};
   1.109 +
   1.110 +template< typename Iter1, typename Iter2, typename C >
   1.111 +struct prior< pair_iter<Iter1,Iter2,C> >
   1.112 +{
   1.113 +    typedef typename mpl::prior<Iter1>::type i1_;
   1.114 +    typedef typename mpl::prior<Iter2>::type i2_;
   1.115 +    typedef pair_iter<i1_,i2_,C> type;
   1.116 +};
   1.117 +
   1.118 +#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
   1.119 +
   1.120 +
   1.121 +template<> struct advance_impl<aux::pair_iter_tag>
   1.122 +{
   1.123 +    template< typename Iter, typename D > struct apply
   1.124 +    {
   1.125 +        typedef typename mpl::advance< typename Iter::first,D >::type i1_;
   1.126 +        typedef typename mpl::advance< typename Iter::second,D >::type i2_;
   1.127 +        typedef pair_iter<i1_,i2_,typename Iter::category> type;
   1.128 +    };
   1.129 +};
   1.130 +
   1.131 +template<> struct distance_impl<aux::pair_iter_tag>
   1.132 +{
   1.133 +    template< typename Iter1, typename Iter2 > struct apply
   1.134 +    {
   1.135 +        // agurt, 10/nov/04: MSVC 6.5 ICE-s on forwarding
   1.136 +        typedef typename mpl::distance<
   1.137 +              typename first<Iter1>::type
   1.138 +            , typename first<Iter2>::type
   1.139 +            >::type type;
   1.140 +    };
   1.141 +};
   1.142 +
   1.143 +
   1.144 +template<
   1.145 +      typename BOOST_MPL_AUX_NA_PARAM(Sequence1)
   1.146 +    , typename BOOST_MPL_AUX_NA_PARAM(Sequence2)
   1.147 +    >
   1.148 +struct pair_view
   1.149 +{
   1.150 +    typedef nested_begin_end_tag tag;
   1.151 +
   1.152 +    typedef typename begin<Sequence1>::type iter1_;
   1.153 +    typedef typename begin<Sequence2>::type iter2_;
   1.154 +    typedef typename min<
   1.155 +          typename iterator_category<iter1_>::type
   1.156 +        , typename iterator_category<iter2_>::type
   1.157 +        >::type category_;
   1.158 +    
   1.159 +    typedef pair_iter<iter1_,iter2_,category_> begin;
   1.160 +    
   1.161 +    typedef pair_iter<
   1.162 +          typename end<Sequence1>::type
   1.163 +        , typename end<Sequence2>::type
   1.164 +        , category_
   1.165 +        > end;
   1.166 +};
   1.167 +
   1.168 +BOOST_MPL_AUX_NA_SPEC(2, pair_view)
   1.169 +
   1.170 +}}
   1.171 +
   1.172 +#endif // BOOST_MPL_PAIR_VIEW_HPP_INCLUDED