]> AND Private Git Repository - canny.git/blob - stc/exp/ml_stc_linux_make_v1.0/include/boost/mpl/pair_view.hpp
Logo AND Algorithmique Numérique Distribuée

Private GIT Repository
378d476735f6c9c92a87c1ebec8e5267918946bc
[canny.git] / stc / exp / ml_stc_linux_make_v1.0 / include / boost / mpl / pair_view.hpp
1 \r
2 #ifndef BOOST_MPL_PAIR_VIEW_HPP_INCLUDED\r
3 #define BOOST_MPL_PAIR_VIEW_HPP_INCLUDED\r
4 \r
5 // Copyright David Abrahams 2003-2004\r
6 // Copyright Aleksey Gurtovoy 2004\r
7 //\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
11 //\r
12 // See http://www.boost.org/libs/mpl for documentation.\r
13 \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
17 \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
29 \r
30 namespace boost { namespace mpl {\r
31 \r
32 namespace aux {\r
33 struct pair_iter_tag;\r
34 \r
35 #if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)\r
36 \r
37 template< typename Iter1, typename Iter2, typename Category >\r
38 struct pair_iter;\r
39 \r
40 template< typename Category > struct prior_pair_iter\r
41 {\r
42     template< typename Iter1, typename Iter2 > struct apply\r
43     {\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
47     };\r
48 };\r
49 \r
50 template<> struct prior_pair_iter<forward_iterator_tag>\r
51 {\r
52     template< typename Iter1, typename Iter2 > struct apply\r
53     {\r
54         typedef pair_iter<Iter1,Iter2,forward_iterator_tag> type;\r
55     };\r
56 };\r
57 \r
58 #endif\r
59 }\r
60 \r
61 template< \r
62       typename Iter1\r
63     , typename Iter2\r
64     , typename Category\r
65     >\r
66 struct pair_iter\r
67 {\r
68     typedef aux::pair_iter_tag tag;\r
69     typedef Category category;\r
70     typedef Iter1 first;\r
71     typedef Iter2 second;\r
72     \r
73 #if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)\r
74     typedef pair< \r
75           typename deref<Iter1>::type\r
76         , typename deref<Iter2>::type\r
77         > type;\r
78 \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
82     \r
83     typedef apply_wrap2< aux::prior_pair_iter<Category>,Iter1,Iter2 >::type prior;\r
84 #endif\r
85 };\r
86 \r
87 \r
88 #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)\r
89 \r
90 template< typename Iter1, typename Iter2, typename C >\r
91 struct deref< pair_iter<Iter1,Iter2,C> >\r
92 {\r
93     typedef pair< \r
94           typename deref<Iter1>::type\r
95         , typename deref<Iter2>::type\r
96         > type;\r
97 };\r
98 \r
99 template< typename Iter1, typename Iter2, typename C >\r
100 struct next< pair_iter<Iter1,Iter2,C> >\r
101 {\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
105 };\r
106 \r
107 template< typename Iter1, typename Iter2, typename C >\r
108 struct prior< pair_iter<Iter1,Iter2,C> >\r
109 {\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
113 };\r
114 \r
115 #endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION\r
116 \r
117 \r
118 template<> struct advance_impl<aux::pair_iter_tag>\r
119 {\r
120     template< typename Iter, typename D > struct apply\r
121     {\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
125     };\r
126 };\r
127 \r
128 template<> struct distance_impl<aux::pair_iter_tag>\r
129 {\r
130     template< typename Iter1, typename Iter2 > struct apply\r
131     {\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
136             >::type type;\r
137     };\r
138 };\r
139 \r
140 \r
141 template<\r
142       typename BOOST_MPL_AUX_NA_PARAM(Sequence1)\r
143     , typename BOOST_MPL_AUX_NA_PARAM(Sequence2)\r
144     >\r
145 struct pair_view\r
146 {\r
147     typedef nested_begin_end_tag tag;\r
148 \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
154         >::type category_;\r
155     \r
156     typedef pair_iter<iter1_,iter2_,category_> begin;\r
157     \r
158     typedef pair_iter<\r
159           typename end<Sequence1>::type\r
160         , typename end<Sequence2>::type\r
161         , category_\r
162         > end;\r
163 };\r
164 \r
165 BOOST_MPL_AUX_NA_SPEC(2, pair_view)\r
166 \r
167 }}\r
168 \r
169 #endif // BOOST_MPL_PAIR_VIEW_HPP_INCLUDED\r