2 #ifndef BOOST_MPL_AUX_RANGE_C_ITERATOR_HPP_INCLUDED
\r
3 #define BOOST_MPL_AUX_RANGE_C_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/iterator_tags.hpp>
\r
18 #include <boost/mpl/advance_fwd.hpp>
\r
19 #include <boost/mpl/distance_fwd.hpp>
\r
20 #include <boost/mpl/next_prior.hpp>
\r
21 #include <boost/mpl/deref.hpp>
\r
22 #include <boost/mpl/plus.hpp>
\r
23 #include <boost/mpl/minus.hpp>
\r
24 #include <boost/mpl/aux_/value_wknd.hpp>
\r
25 #include <boost/mpl/aux_/config/ctps.hpp>
\r
27 namespace boost { namespace mpl {
\r
29 // theoretically will work on any discrete numeric type
\r
30 template< typename N > struct r_iter
\r
32 typedef aux::r_iter_tag tag;
\r
33 typedef random_access_iterator_tag category;
\r
36 #if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
\r
37 typedef r_iter< typename mpl::next<N>::type > next;
\r
38 typedef r_iter< typename mpl::prior<N>::type > prior;
\r
42 #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
\r
47 struct next< r_iter<N> >
\r
49 typedef r_iter< typename mpl::next<N>::type > type;
\r
55 struct prior< r_iter<N> >
\r
57 typedef r_iter< typename mpl::prior<N>::type > type;
\r
63 template<> struct advance_impl<aux::r_iter_tag>
\r
65 template< typename Iter, typename Dist > struct apply
\r
67 typedef typename deref<Iter>::type n_;
\r
68 #if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
\r
69 typedef typename plus_impl<integral_c_tag,integral_c_tag>
\r
70 ::template apply<n_,Dist>::type m_;
\r
72 typedef typename plus<n_,Dist>::type m_;
\r
74 // agurt, 10/nov/04: to be generic, the code have to do something along
\r
75 // the lines below...
\r
77 // typedef typename apply_wrap1<
\r
78 // numeric_cast< typename m_::tag, typename n_::tag >
\r
84 typedef integral_c<
\r
85 typename aux::value_type_wknd<n_>::type
\r
86 , BOOST_MPL_AUX_VALUE_WKND(m_)::value
\r
89 typedef r_iter<result_> type;
\r
93 template<> struct distance_impl<aux::r_iter_tag>
\r
95 template< typename Iter1, typename Iter2 > struct apply
\r
97 typename Iter2::type
\r
98 , typename Iter1::type
\r
106 #endif // BOOST_MPL_AUX_RANGE_C_ITERATOR_HPP_INCLUDED
\r