Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-16 09:57:04

0001 
0002 #ifndef BOOST_MPL_AUX_RANGE_C_ITERATOR_HPP_INCLUDED
0003 #define BOOST_MPL_AUX_RANGE_C_ITERATOR_HPP_INCLUDED
0004 
0005 // Copyright Aleksey Gurtovoy 2000-2004
0006 //
0007 // Distributed under the Boost Software License, Version 1.0. 
0008 // (See accompanying file LICENSE_1_0.txt or copy at 
0009 // http://www.boost.org/LICENSE_1_0.txt)
0010 //
0011 // See http://www.boost.org/libs/mpl for documentation.
0012 
0013 // $Id$
0014 // $Date$
0015 // $Revision$
0016 
0017 #include <boost/mpl/iterator_tags.hpp>
0018 #include <boost/mpl/advance_fwd.hpp>
0019 #include <boost/mpl/distance_fwd.hpp>
0020 #include <boost/mpl/next_prior.hpp>
0021 #include <boost/mpl/deref.hpp>
0022 #include <boost/mpl/plus.hpp>
0023 #include <boost/mpl/minus.hpp>
0024 #include <boost/mpl/aux_/value_wknd.hpp>
0025 #include <boost/mpl/aux_/config/ctps.hpp>
0026 
0027 namespace boost { namespace mpl {
0028 
0029 // theoretically will work on any discrete numeric type
0030 template< typename N > struct r_iter
0031 {
0032     typedef aux::r_iter_tag tag;
0033     typedef random_access_iterator_tag category;
0034     typedef N type;
0035 
0036 #if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
0037     typedef r_iter< typename mpl::next<N>::type > next;
0038     typedef r_iter< typename mpl::prior<N>::type > prior;
0039 #endif
0040 };
0041 
0042 #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
0043 
0044 template<
0045       typename N
0046     >
0047 struct next< r_iter<N> >
0048 {
0049     typedef r_iter< typename mpl::next<N>::type > type;
0050 };
0051 
0052 template<
0053       typename N
0054     >
0055 struct prior< r_iter<N> >
0056 {
0057     typedef r_iter< typename mpl::prior<N>::type > type;
0058 };
0059 
0060 #endif
0061 
0062 
0063 template<> struct advance_impl<aux::r_iter_tag>
0064 {
0065     template< typename Iter, typename Dist > struct apply
0066     {
0067         typedef typename deref<Iter>::type n_;
0068 #if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
0069         typedef typename plus_impl<integral_c_tag,integral_c_tag>
0070             ::template apply<n_,Dist>::type m_;
0071 #else
0072         typedef typename plus<n_,Dist>::type m_;
0073 #endif
0074         // agurt, 10/nov/04: to be generic, the code have to do something along
0075         // the lines below...
0076         //
0077         // typedef typename apply_wrap1<
0078         //       numeric_cast< typename m_::tag, typename n_::tag >
0079         //     , m_
0080         //     >::type result_;
0081         //
0082         // ... meanwhile:
0083         
0084         typedef integral_c< 
0085               typename aux::value_type_wknd<n_>::type
0086             , BOOST_MPL_AUX_VALUE_WKND(m_)::value 
0087             > result_;
0088         
0089         typedef r_iter<result_> type;
0090     };
0091 };
0092 
0093 template<> struct distance_impl<aux::r_iter_tag>
0094 {
0095     template< typename Iter1, typename Iter2 > struct apply
0096         : minus<
0097               typename Iter2::type
0098             , typename Iter1::type
0099             >
0100     {
0101     };
0102 };
0103 
0104 }}
0105 
0106 #endif // BOOST_MPL_AUX_RANGE_C_ITERATOR_HPP_INCLUDED