New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
iterator.hpp in vendors/XIOS/current/extern/boost/include/boost/mpl/aux_/range_c – NEMO

source: vendors/XIOS/current/extern/boost/include/boost/mpl/aux_/range_c/iterator.hpp @ 3428

Last change on this file since 3428 was 3428, checked in by rblod, 12 years ago

importing initial XIOS vendor drop

File size: 2.7 KB
Line 
1
2#ifndef BOOST_MPL_AUX_RANGE_C_ITERATOR_HPP_INCLUDED
3#define BOOST_MPL_AUX_RANGE_C_ITERATOR_HPP_INCLUDED
4
5// Copyright Aleksey Gurtovoy 2000-2004
6//
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)
10//
11// See http://www.boost.org/libs/mpl for documentation.
12
13// $Id: iterator.hpp 49267 2008-10-11 06:19:02Z agurtovoy $
14// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $
15// $Revision: 49267 $
16
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>
26
27namespace boost { namespace mpl {
28
29// theoretically will work on any discrete numeric type
30template< typename N > struct r_iter
31{
32    typedef aux::r_iter_tag tag;
33    typedef random_access_iterator_tag category;
34    typedef N type;
35
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;
39#endif
40};
41
42#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
43
44template<
45      typename N
46    >
47struct next< r_iter<N> >
48{
49    typedef r_iter< typename mpl::next<N>::type > type;
50};
51
52template<
53      typename N
54    >
55struct prior< r_iter<N> >
56{
57    typedef r_iter< typename mpl::prior<N>::type > type;
58};
59
60#endif
61
62
63template<> struct advance_impl<aux::r_iter_tag>
64{
65    template< typename Iter, typename Dist > struct apply
66    {
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_;
71#else
72        typedef typename plus<n_,Dist>::type m_;
73#endif
74        // agurt, 10/nov/04: to be generic, the code have to do something along
75        // the lines below...
76        //
77        // typedef typename apply_wrap1<
78        //       numeric_cast< typename m_::tag, typename n_::tag >
79        //     , m_
80        //     >::type result_;
81        //
82        // ... meanwhile:
83       
84        typedef integral_c< 
85              typename aux::value_type_wknd<n_>::type
86            , BOOST_MPL_AUX_VALUE_WKND(m_)::value
87            > result_;
88       
89        typedef r_iter<result_> type;
90    };
91};
92
93template<> struct distance_impl<aux::r_iter_tag>
94{
95    template< typename Iter1, typename Iter2 > struct apply
96        : minus<
97              typename Iter2::type
98            , typename Iter1::type
99            >
100    {
101    };
102};
103
104}}
105
106#endif // BOOST_MPL_AUX_RANGE_C_ITERATOR_HPP_INCLUDED
Note: See TracBrowser for help on using the repository browser.