2 #ifndef BOOST_MPL_PAIR_VIEW_HPP_INCLUDED
\r
3 #define BOOST_MPL_PAIR_VIEW_HPP_INCLUDED
\r
5 // Copyright David Abrahams 2003-2004
\r
6 // Copyright Aleksey Gurtovoy 2004
\r
8 // Distributed under the Boost Software License, Version 1.0.
\r
9 // (See accompanying file LICENSE_1_0.txt or copy at
\r
10 // http://www.boost.org/LICENSE_1_0.txt)
\r
12 // See http://www.boost.org/libs/mpl for documentation.
\r
14 // $Id: pair_view.hpp 49267 2008-10-11 06:19:02Z agurtovoy $
\r
15 // $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $
\r
16 // $Revision: 49267 $
\r
18 #include <boost/mpl/begin_end.hpp>
\r
19 #include <boost/mpl/iterator_category.hpp>
\r
20 #include <boost/mpl/advance.hpp>
\r
21 #include <boost/mpl/distance.hpp>
\r
22 #include <boost/mpl/next_prior.hpp>
\r
23 #include <boost/mpl/deref.hpp>
\r
24 #include <boost/mpl/min_max.hpp>
\r
25 #include <boost/mpl/pair.hpp>
\r
26 #include <boost/mpl/iterator_tags.hpp>
\r
27 #include <boost/mpl/aux_/config/ctps.hpp>
\r
28 #include <boost/mpl/aux_/na_spec.hpp>
\r
30 namespace boost { namespace mpl {
\r
33 struct pair_iter_tag;
\r
35 #if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
\r
37 template< typename Iter1, typename Iter2, typename Category >
\r
40 template< typename Category > struct prior_pair_iter
\r
42 template< typename Iter1, typename Iter2 > struct apply
\r
44 typedef typename mpl::prior<Iter1>::type i1_;
\r
45 typedef typename mpl::prior<Iter2>::type i2_;
\r
46 typedef pair_iter<i1_,i2_,Category> type;
\r
50 template<> struct prior_pair_iter<forward_iterator_tag>
\r
52 template< typename Iter1, typename Iter2 > struct apply
\r
54 typedef pair_iter<Iter1,Iter2,forward_iterator_tag> type;
\r
68 typedef aux::pair_iter_tag tag;
\r
69 typedef Category category;
\r
70 typedef Iter1 first;
\r
71 typedef Iter2 second;
\r
73 #if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
\r
75 typename deref<Iter1>::type
\r
76 , typename deref<Iter2>::type
\r
79 typedef typename mpl::next<Iter1>::type i1_;
\r
80 typedef typename mpl::next<Iter2>::type i2_;
\r
81 typedef pair_iter<i1_,i2_,Category> next;
\r
83 typedef apply_wrap2< aux::prior_pair_iter<Category>,Iter1,Iter2 >::type prior;
\r
88 #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
\r
90 template< typename Iter1, typename Iter2, typename C >
\r
91 struct deref< pair_iter<Iter1,Iter2,C> >
\r
94 typename deref<Iter1>::type
\r
95 , typename deref<Iter2>::type
\r
99 template< typename Iter1, typename Iter2, typename C >
\r
100 struct next< pair_iter<Iter1,Iter2,C> >
\r
102 typedef typename mpl::next<Iter1>::type i1_;
\r
103 typedef typename mpl::next<Iter2>::type i2_;
\r
104 typedef pair_iter<i1_,i2_,C> type;
\r
107 template< typename Iter1, typename Iter2, typename C >
\r
108 struct prior< pair_iter<Iter1,Iter2,C> >
\r
110 typedef typename mpl::prior<Iter1>::type i1_;
\r
111 typedef typename mpl::prior<Iter2>::type i2_;
\r
112 typedef pair_iter<i1_,i2_,C> type;
\r
115 #endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
\r
118 template<> struct advance_impl<aux::pair_iter_tag>
\r
120 template< typename Iter, typename D > struct apply
\r
122 typedef typename mpl::advance< typename Iter::first,D >::type i1_;
\r
123 typedef typename mpl::advance< typename Iter::second,D >::type i2_;
\r
124 typedef pair_iter<i1_,i2_,typename Iter::category> type;
\r
128 template<> struct distance_impl<aux::pair_iter_tag>
\r
130 template< typename Iter1, typename Iter2 > struct apply
\r
132 // agurt, 10/nov/04: MSVC 6.5 ICE-s on forwarding
\r
133 typedef typename mpl::distance<
\r
134 typename first<Iter1>::type
\r
135 , typename first<Iter2>::type
\r
142 typename BOOST_MPL_AUX_NA_PARAM(Sequence1)
\r
143 , typename BOOST_MPL_AUX_NA_PARAM(Sequence2)
\r
147 typedef nested_begin_end_tag tag;
\r
149 typedef typename begin<Sequence1>::type iter1_;
\r
150 typedef typename begin<Sequence2>::type iter2_;
\r
151 typedef typename min<
\r
152 typename iterator_category<iter1_>::type
\r
153 , typename iterator_category<iter2_>::type
\r
156 typedef pair_iter<iter1_,iter2_,category_> begin;
\r
159 typename end<Sequence1>::type
\r
160 , typename end<Sequence2>::type
\r
165 BOOST_MPL_AUX_NA_SPEC(2, pair_view)
\r
169 #endif // BOOST_MPL_PAIR_VIEW_HPP_INCLUDED
\r