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