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

Private GIT Repository
5336b51a83e742202692bf68e4e5b4f81121526a
[canny.git] / stc / exp / ml_stc_linux_make_v1.0 / include / boost / mpl / vector / aux_ / iterator.hpp
1 \r
2 #ifndef BOOST_MPL_AUX_VECTOR_ITERATOR_HPP_INCLUDED\r
3 #define BOOST_MPL_AUX_VECTOR_ITERATOR_HPP_INCLUDED\r
4 \r
5 // Copyright Aleksey Gurtovoy 2000-2004\r
6 //\r
7 // Distributed under the Boost Software License, Version 1.0. \r
8 // (See accompanying file LICENSE_1_0.txt or copy at \r
9 // http://www.boost.org/LICENSE_1_0.txt)\r
10 //\r
11 // See http://www.boost.org/libs/mpl for documentation.\r
12 \r
13 // $Id: iterator.hpp 49267 2008-10-11 06:19:02Z agurtovoy $\r
14 // $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $\r
15 // $Revision: 49267 $\r
16 \r
17 #include <boost/mpl/vector/aux_/at.hpp>\r
18 #include <boost/mpl/iterator_tags.hpp>\r
19 #include <boost/mpl/plus.hpp>\r
20 #include <boost/mpl/minus.hpp>\r
21 #include <boost/mpl/advance_fwd.hpp>\r
22 #include <boost/mpl/distance_fwd.hpp>\r
23 #include <boost/mpl/next.hpp>\r
24 #include <boost/mpl/prior.hpp>\r
25 #include <boost/mpl/aux_/nttp_decl.hpp>\r
26 #include <boost/mpl/aux_/value_wknd.hpp>\r
27 #include <boost/mpl/aux_/config/ctps.hpp>\r
28 #include <boost/mpl/aux_/config/workaround.hpp>\r
29 \r
30 namespace boost { namespace mpl {\r
31 \r
32 template<\r
33       typename Vector\r
34     , BOOST_MPL_AUX_NTTP_DECL(long, n_)\r
35     >\r
36 struct v_iter\r
37 {\r
38     typedef aux::v_iter_tag tag;\r
39     typedef random_access_iterator_tag category;\r
40     typedef typename v_at<Vector,n_>::type type;\r
41 \r
42     typedef Vector vector_;\r
43     typedef mpl::long_<n_> pos;\r
44 \r
45 #if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)\r
46     enum { \r
47           next_ = n_ + 1\r
48         , prior_ = n_ - 1\r
49         , pos_ = n_\r
50     };\r
51     \r
52     typedef v_iter<Vector,next_> next;\r
53     typedef v_iter<Vector,prior_> prior;\r
54 #endif\r
55 \r
56 };\r
57 \r
58 \r
59 #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)\r
60 \r
61 template<\r
62       typename Vector\r
63     , BOOST_MPL_AUX_NTTP_DECL(long, n_)\r
64     >\r
65 struct next< v_iter<Vector,n_> >\r
66 {\r
67     typedef v_iter<Vector,(n_ + 1)> type;\r
68 };\r
69 \r
70 template<\r
71       typename Vector\r
72     , BOOST_MPL_AUX_NTTP_DECL(long, n_)\r
73     >\r
74 struct prior< v_iter<Vector,n_> >\r
75 {\r
76     typedef v_iter<Vector,(n_ - 1)> type;\r
77 };\r
78 \r
79 template<\r
80       typename Vector\r
81     , BOOST_MPL_AUX_NTTP_DECL(long, n_)\r
82     , typename Distance\r
83     >\r
84 struct advance< v_iter<Vector,n_>,Distance>\r
85 {\r
86     typedef v_iter<\r
87           Vector\r
88         , (n_ + BOOST_MPL_AUX_NESTED_VALUE_WKND(long, Distance))\r
89         > type;\r
90 };\r
91 \r
92 template< \r
93       typename Vector\r
94     , BOOST_MPL_AUX_NTTP_DECL(long, n_)\r
95     , BOOST_MPL_AUX_NTTP_DECL(long, m_)\r
96     > \r
97 struct distance< v_iter<Vector,n_>, v_iter<Vector,m_> >\r
98     : mpl::long_<(m_ - n_)>\r
99 {\r
100 };\r
101 \r
102 #else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION\r
103 \r
104 template<> struct advance_impl<aux::v_iter_tag>\r
105 {\r
106     template< typename Iterator, typename N > struct apply\r
107     {\r
108         enum { pos_ = Iterator::pos_, n_ = N::value };\r
109         typedef v_iter<\r
110               typename Iterator::vector_\r
111             , (pos_ + n_)\r
112             > type;\r
113     };\r
114 };\r
115 \r
116 template<> struct distance_impl<aux::v_iter_tag>\r
117 {\r
118     template< typename Iter1, typename Iter2 > struct apply\r
119     {\r
120         enum { pos1_ = Iter1::pos_, pos2_ = Iter2::pos_ };\r
121         typedef long_<( pos2_ - pos1_ )> type;\r
122         BOOST_STATIC_CONSTANT(long, value = ( pos2_ - pos1_ ));\r
123     };\r
124 };\r
125 \r
126 #endif\r
127 \r
128 }}\r
129 \r
130 #endif // BOOST_MPL_AUX_VECTOR_ITERATOR_HPP_INCLUDED\r