2 #ifndef BOOST_MPL_AUX_VECTOR_ITERATOR_HPP_INCLUDED
3 #define BOOST_MPL_AUX_VECTOR_ITERATOR_HPP_INCLUDED
5 // Copyright Aleksey Gurtovoy 2000-2004
7 // Distributed under the Boost Software License, Version 1.0.
8 // (See accompanying file LICENSE_1_0.txt or copy at
9 // http://www.boost.org/LICENSE_1_0.txt)
11 // See http://www.boost.org/libs/mpl for documentation.
17 #include <boost/mpl/vector/aux_/at.hpp>
18 #include <boost/mpl/iterator_tags.hpp>
19 #include <boost/mpl/plus.hpp>
20 #include <boost/mpl/minus.hpp>
21 #include <boost/mpl/advance_fwd.hpp>
22 #include <boost/mpl/distance_fwd.hpp>
23 #include <boost/mpl/next.hpp>
24 #include <boost/mpl/prior.hpp>
25 #include <boost/mpl/aux_/nttp_decl.hpp>
26 #include <boost/mpl/aux_/value_wknd.hpp>
27 #include <boost/mpl/aux_/config/ctps.hpp>
28 #include <boost/mpl/aux_/config/workaround.hpp>
30 namespace boost { namespace mpl {
34 , BOOST_MPL_AUX_NTTP_DECL(long, n_)
38 typedef aux::v_iter_tag tag;
39 typedef random_access_iterator_tag category;
40 typedef typename v_at<Vector,n_>::type type;
42 typedef Vector vector_;
43 typedef mpl::long_<n_> pos;
45 #if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
52 typedef v_iter<Vector,next_> next;
53 typedef v_iter<Vector,prior_> prior;
59 #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
63 , BOOST_MPL_AUX_NTTP_DECL(long, n_)
65 struct next< v_iter<Vector,n_> >
67 typedef v_iter<Vector,(n_ + 1)> type;
72 , BOOST_MPL_AUX_NTTP_DECL(long, n_)
74 struct prior< v_iter<Vector,n_> >
76 typedef v_iter<Vector,(n_ - 1)> type;
81 , BOOST_MPL_AUX_NTTP_DECL(long, n_)
84 struct advance< v_iter<Vector,n_>,Distance>
88 , (n_ + BOOST_MPL_AUX_NESTED_VALUE_WKND(long, Distance))
94 , BOOST_MPL_AUX_NTTP_DECL(long, n_)
95 , BOOST_MPL_AUX_NTTP_DECL(long, m_)
97 struct distance< v_iter<Vector,n_>, v_iter<Vector,m_> >
98 : mpl::long_<(m_ - n_)>
102 #else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
104 template<> struct advance_impl<aux::v_iter_tag>
106 template< typename Iterator, typename N > struct apply
108 enum { pos_ = Iterator::pos_, n_ = N::value };
110 typename Iterator::vector_
116 template<> struct distance_impl<aux::v_iter_tag>
118 template< typename Iter1, typename Iter2 > struct apply
120 enum { pos1_ = Iter1::pos_, pos2_ = Iter2::pos_ };
121 typedef long_<( pos2_ - pos1_ )> type;
122 BOOST_STATIC_CONSTANT(long, value = ( pos2_ - pos1_ ));
130 #endif // BOOST_MPL_AUX_VECTOR_ITERATOR_HPP_INCLUDED