2 #ifndef BOOST_MPL_AUX_VECTOR_ITERATOR_HPP_INCLUDED
\r
3 #define BOOST_MPL_AUX_VECTOR_ITERATOR_HPP_INCLUDED
\r
5 // Copyright Aleksey Gurtovoy 2000-2004
\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
11 // See http://www.boost.org/libs/mpl for documentation.
\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
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
30 namespace boost { namespace mpl {
\r
34 , BOOST_MPL_AUX_NTTP_DECL(long, n_)
\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
42 typedef Vector vector_;
\r
43 typedef mpl::long_<n_> pos;
\r
45 #if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
\r
52 typedef v_iter<Vector,next_> next;
\r
53 typedef v_iter<Vector,prior_> prior;
\r
59 #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
\r
63 , BOOST_MPL_AUX_NTTP_DECL(long, n_)
\r
65 struct next< v_iter<Vector,n_> >
\r
67 typedef v_iter<Vector,(n_ + 1)> type;
\r
72 , BOOST_MPL_AUX_NTTP_DECL(long, n_)
\r
74 struct prior< v_iter<Vector,n_> >
\r
76 typedef v_iter<Vector,(n_ - 1)> type;
\r
81 , BOOST_MPL_AUX_NTTP_DECL(long, n_)
\r
84 struct advance< v_iter<Vector,n_>,Distance>
\r
88 , (n_ + BOOST_MPL_AUX_NESTED_VALUE_WKND(long, Distance))
\r
94 , BOOST_MPL_AUX_NTTP_DECL(long, n_)
\r
95 , BOOST_MPL_AUX_NTTP_DECL(long, m_)
\r
97 struct distance< v_iter<Vector,n_>, v_iter<Vector,m_> >
\r
98 : mpl::long_<(m_ - n_)>
\r
102 #else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
\r
104 template<> struct advance_impl<aux::v_iter_tag>
\r
106 template< typename Iterator, typename N > struct apply
\r
108 enum { pos_ = Iterator::pos_, n_ = N::value };
\r
110 typename Iterator::vector_
\r
116 template<> struct distance_impl<aux::v_iter_tag>
\r
118 template< typename Iter1, typename Iter2 > struct apply
\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
130 #endif // BOOST_MPL_AUX_VECTOR_ITERATOR_HPP_INCLUDED
\r