line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////// |
2
|
|
|
|
|
|
|
// |
3
|
|
|
|
|
|
|
// (C) Copyright Ion Gaztanaga 2014-2014 |
4
|
|
|
|
|
|
|
// |
5
|
|
|
|
|
|
|
// Distributed under the Boost Software License, Version 1.0. |
6
|
|
|
|
|
|
|
// (See accompanying file LICENSE_1_0.txt or copy at |
7
|
|
|
|
|
|
|
// http://www.boost.org/LICENSE_1_0.txt) |
8
|
|
|
|
|
|
|
// |
9
|
|
|
|
|
|
|
// See http://www.boost.org/libs/intrusive for documentation. |
10
|
|
|
|
|
|
|
// |
11
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////// |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
#ifndef BOOST_INTRUSIVE_DETAIL_REVERSE_ITERATOR_HPP |
14
|
|
|
|
|
|
|
#define BOOST_INTRUSIVE_DETAIL_REVERSE_ITERATOR_HPP |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
#ifndef BOOST_CONFIG_HPP |
17
|
|
|
|
|
|
|
# include |
18
|
|
|
|
|
|
|
#endif |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
#if defined(BOOST_HAS_PRAGMA_ONCE) |
21
|
|
|
|
|
|
|
# pragma once |
22
|
|
|
|
|
|
|
#endif |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
#include |
25
|
|
|
|
|
|
|
#include |
26
|
|
|
|
|
|
|
#include |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
namespace boost { |
29
|
|
|
|
|
|
|
namespace intrusive { |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
template |
32
|
|
|
|
|
|
|
class reverse_iterator |
33
|
|
|
|
|
|
|
{ |
34
|
|
|
|
|
|
|
public: |
35
|
|
|
|
|
|
|
typedef typename boost::intrusive::iterator_traits::pointer pointer; |
36
|
|
|
|
|
|
|
typedef typename boost::intrusive::iterator_traits::reference reference; |
37
|
|
|
|
|
|
|
typedef typename boost::intrusive::iterator_traits::difference_type difference_type; |
38
|
|
|
|
|
|
|
typedef typename boost::intrusive::iterator_traits::iterator_category iterator_category; |
39
|
|
|
|
|
|
|
typedef typename boost::intrusive::iterator_traits::value_type value_type; |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
typedef It iterator_type; |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
reverse_iterator() |
45
|
|
|
|
|
|
|
: m_current() //Value initialization to achieve "null iterators" (N3644) |
46
|
|
|
|
|
|
|
{} |
47
|
|
|
|
|
|
|
|
48
|
2428
|
|
|
|
|
|
explicit reverse_iterator(It r) |
49
|
2428
|
|
|
|
|
|
: m_current(r) |
50
|
2428
|
|
|
|
|
|
{} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
reverse_iterator(const reverse_iterator& r) |
53
|
|
|
|
|
|
|
: m_current(r.base()) |
54
|
|
|
|
|
|
|
{} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
template |
57
|
|
|
|
|
|
|
reverse_iterator( const reverse_iterator& r |
58
|
|
|
|
|
|
|
, typename boost::intrusive::detail::enable_if_convertible::type* =0 |
59
|
|
|
|
|
|
|
) |
60
|
|
|
|
|
|
|
: m_current(r.base()) |
61
|
|
|
|
|
|
|
{} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
reverse_iterator & operator=( const reverse_iterator& r) |
64
|
|
|
|
|
|
|
{ m_current = r.base(); return *this; } |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
template |
67
|
|
|
|
|
|
|
typename boost::intrusive::detail::enable_if_convertible::type |
68
|
|
|
|
|
|
|
operator=( const reverse_iterator& r) |
69
|
|
|
|
|
|
|
{ m_current = r.base(); return *this; } |
70
|
|
|
|
|
|
|
|
71
|
1214
|
|
|
|
|
|
It base() const |
72
|
1214
|
|
|
|
|
|
{ return m_current; } |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
reference operator*() const |
75
|
|
|
|
|
|
|
{ |
76
|
|
|
|
|
|
|
It temp(m_current); |
77
|
|
|
|
|
|
|
--temp; |
78
|
|
|
|
|
|
|
reference r = *temp; |
79
|
|
|
|
|
|
|
return r; |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
|
82
|
7751
|
|
|
|
|
|
pointer operator->() const |
83
|
|
|
|
|
|
|
{ |
84
|
7751
|
|
|
|
|
|
It temp(m_current); |
85
|
|
|
|
|
|
|
--temp; |
86
|
7751
|
|
|
|
|
|
return iterator_arrow_result(temp); |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
reference operator[](difference_type off) const |
90
|
|
|
|
|
|
|
{ |
91
|
|
|
|
|
|
|
return this->m_current[-off - 1]; |
92
|
|
|
|
|
|
|
} |
93
|
|
|
|
|
|
|
|
94
|
6537
|
|
|
|
|
|
reverse_iterator& operator++() |
95
|
|
|
|
|
|
|
{ |
96
|
6537
|
|
|
|
|
|
--m_current; |
97
|
6537
|
|
|
|
|
|
return *this; |
98
|
|
|
|
|
|
|
} |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
reverse_iterator operator++(int) |
101
|
|
|
|
|
|
|
{ |
102
|
|
|
|
|
|
|
reverse_iterator temp((*this)); |
103
|
|
|
|
|
|
|
--m_current; |
104
|
|
|
|
|
|
|
return temp; |
105
|
|
|
|
|
|
|
} |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
reverse_iterator& operator--() |
108
|
|
|
|
|
|
|
{ |
109
|
|
|
|
|
|
|
++m_current; |
110
|
|
|
|
|
|
|
return *this; |
111
|
|
|
|
|
|
|
} |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
reverse_iterator operator--(int) |
114
|
|
|
|
|
|
|
{ |
115
|
|
|
|
|
|
|
reverse_iterator temp((*this)); |
116
|
|
|
|
|
|
|
++m_current; |
117
|
|
|
|
|
|
|
return temp; |
118
|
|
|
|
|
|
|
} |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
friend bool operator==(const reverse_iterator& l, const reverse_iterator& r) |
121
|
|
|
|
|
|
|
{ return l.m_current == r.m_current; } |
122
|
|
|
|
|
|
|
|
123
|
7751
|
|
|
|
|
|
friend bool operator!=(const reverse_iterator& l, const reverse_iterator& r) |
124
|
7751
|
|
|
|
|
|
{ return l.m_current != r.m_current; } |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
friend bool operator<(const reverse_iterator& l, const reverse_iterator& r) |
127
|
|
|
|
|
|
|
{ return l.m_current > r.m_current; } |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
friend bool operator<=(const reverse_iterator& l, const reverse_iterator& r) |
130
|
|
|
|
|
|
|
{ return l.m_current >= r.m_current; } |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
friend bool operator>(const reverse_iterator& l, const reverse_iterator& r) |
133
|
|
|
|
|
|
|
{ return l.m_current < r.m_current; } |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
friend bool operator>=(const reverse_iterator& l, const reverse_iterator& r) |
136
|
|
|
|
|
|
|
{ return l.m_current <= r.m_current; } |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
reverse_iterator& operator+=(difference_type off) |
139
|
|
|
|
|
|
|
{ m_current -= off; return *this; } |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
reverse_iterator& operator-=(difference_type off) |
142
|
|
|
|
|
|
|
{ m_current += off; return *this; } |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
friend reverse_iterator operator+(reverse_iterator l, difference_type off) |
145
|
|
|
|
|
|
|
{ return (l += off); } |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
friend reverse_iterator operator+(difference_type off, reverse_iterator r) |
148
|
|
|
|
|
|
|
{ return (r += off); } |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
friend reverse_iterator operator-(reverse_iterator l, difference_type off) |
151
|
|
|
|
|
|
|
{ return (l-= off); } |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
friend difference_type operator-(const reverse_iterator& l, const reverse_iterator& r) |
154
|
|
|
|
|
|
|
{ return r.m_current - l.m_current; } |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
private: |
157
|
|
|
|
|
|
|
It m_current; // the wrapped iterator |
158
|
|
|
|
|
|
|
}; |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
} //namespace intrusive { |
161
|
|
|
|
|
|
|
} //namespace boost { |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
#include |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
#endif //BOOST_INTRUSIVE_DETAIL_REVERSE_ITERATOR_HPP |