29 #ifndef _GLIBCXX_PROFILE_ITERATOR_TRACKER 30 #define _GLIBCXX_PROFILE_ITERATOR_TRACKER 1 34 namespace std _GLIBCXX_VISIBILITY(default)
38 template<
typename _Iterator,
typename _Sequence>
39 class __iterator_tracker
41 typedef __iterator_tracker _Self;
47 const _Sequence* _M_ds;
48 typedef std::iterator_traits<_Iterator> _Traits;
51 typedef _Iterator _Base_iterator;
52 typedef typename _Traits::iterator_category iterator_category;
53 typedef typename _Traits::value_type value_type;
54 typedef typename _Traits::difference_type difference_type;
55 typedef typename _Traits::reference reference;
56 typedef typename _Traits::pointer pointer;
58 __iterator_tracker() _GLIBCXX_NOEXCEPT
59 : _M_current(), _M_ds(0) { }
61 __iterator_tracker(
const _Iterator& __i,
const _Sequence* __seq)
63 : _M_current(__i), _M_ds(__seq) { }
65 __iterator_tracker(
const __iterator_tracker& __x) _GLIBCXX_NOEXCEPT
66 : _M_current(__x._M_current), _M_ds(__x._M_ds) { }
68 template<
typename _MutableIterator>
69 __iterator_tracker(
const __iterator_tracker<_MutableIterator,
70 typename __gnu_cxx::__enable_if
71 <(std::__are_same<_MutableIterator,
typename 72 _Sequence::iterator::_Base_iterator>::__value),
73 _Sequence>::__type>& __x) _GLIBCXX_NOEXCEPT
74 : _M_current(__x.base()), _M_ds(__x._M_get_sequence()) { }
77 base() const _GLIBCXX_NOEXCEPT {
return _M_current; }
83 operator _Iterator() const _GLIBCXX_NOEXCEPT {
return _M_current; }
86 operator->() const _GLIBCXX_NOEXCEPT {
return &*_M_current; }
89 operator++() _GLIBCXX_NOEXCEPT
91 _M_ds->_M_profile_iterate();
97 operator++(
int) _GLIBCXX_NOEXCEPT
99 _M_ds->_M_profile_iterate();
100 __iterator_tracker __tmp(*
this);
106 operator--() _GLIBCXX_NOEXCEPT
108 _M_ds->_M_profile_iterate(1);
114 operator--(
int) _GLIBCXX_NOEXCEPT
116 _M_ds->_M_profile_iterate(1);
117 __iterator_tracker __tmp(*
this);
123 operator=(
const __iterator_tracker& __x) _GLIBCXX_NOEXCEPT
125 _M_current = __x._M_current;
132 {
return *_M_current; }
136 operator[](
const difference_type& __n)
const _GLIBCXX_NOEXCEPT
137 {
return _M_current[__n]; }
140 operator+=(
const difference_type& __n) _GLIBCXX_NOEXCEPT
147 operator+(
const difference_type& __n)
const _GLIBCXX_NOEXCEPT
149 __iterator_tracker __tmp(*
this);
155 operator-=(
const difference_type& __n) _GLIBCXX_NOEXCEPT
162 operator-(
const difference_type& __n)
const _GLIBCXX_NOEXCEPT
164 __iterator_tracker __tmp(*
this);
170 _M_get_sequence()
const 171 {
return static_cast<const _Sequence*
>(_M_ds); }
174 template<
typename _IteratorL,
typename _IteratorR,
typename _Sequence>
176 operator==(
const __iterator_tracker<_IteratorL, _Sequence>& __lhs,
177 const __iterator_tracker<_IteratorR, _Sequence>& __rhs)
179 {
return __lhs.base() == __rhs.base(); }
181 template<
typename _Iterator,
typename _Sequence>
183 operator==(
const __iterator_tracker<_Iterator, _Sequence>& __lhs,
184 const __iterator_tracker<_Iterator, _Sequence>& __rhs)
186 {
return __lhs.base() == __rhs.base(); }
188 template<
typename _IteratorL,
typename _IteratorR,
typename _Sequence>
190 operator!=(
const __iterator_tracker<_IteratorL, _Sequence>& __lhs,
191 const __iterator_tracker<_IteratorR, _Sequence>& __rhs)
193 {
return __lhs.base() != __rhs.base(); }
195 template<
typename _Iterator,
typename _Sequence>
197 operator!=(
const __iterator_tracker<_Iterator, _Sequence>& __lhs,
198 const __iterator_tracker<_Iterator, _Sequence>& __rhs)
200 {
return __lhs.base() != __rhs.base(); }
202 template<
typename _IteratorL,
typename _IteratorR,
typename _Sequence>
204 operator<(const __iterator_tracker<_IteratorL, _Sequence>& __lhs,
205 const __iterator_tracker<_IteratorR, _Sequence>& __rhs)
207 {
return __lhs.base() < __rhs.base(); }
209 template<
typename _Iterator,
typename _Sequence>
211 operator<(const __iterator_tracker<_Iterator, _Sequence>& __lhs,
212 const __iterator_tracker<_Iterator, _Sequence>& __rhs)
214 {
return __lhs.base() < __rhs.base(); }
216 template<
typename _IteratorL,
typename _IteratorR,
typename _Sequence>
218 operator<=(const __iterator_tracker<_IteratorL, _Sequence>& __lhs,
219 const __iterator_tracker<_IteratorR, _Sequence>& __rhs)
221 {
return __lhs.base() <= __rhs.base(); }
223 template<
typename _Iterator,
typename _Sequence>
225 operator<=(const __iterator_tracker<_Iterator, _Sequence>& __lhs,
226 const __iterator_tracker<_Iterator, _Sequence>& __rhs)
228 {
return __lhs.base() <= __rhs.base(); }
230 template<
typename _IteratorL,
typename _IteratorR,
typename _Sequence>
232 operator>(
const __iterator_tracker<_IteratorL, _Sequence>& __lhs,
233 const __iterator_tracker<_IteratorR, _Sequence>& __rhs)
235 {
return __lhs.base() > __rhs.base(); }
237 template<
typename _Iterator,
typename _Sequence>
239 operator>(
const __iterator_tracker<_Iterator, _Sequence>& __lhs,
240 const __iterator_tracker<_Iterator, _Sequence>& __rhs)
242 {
return __lhs.base() > __rhs.base(); }
244 template<
typename _IteratorL,
typename _IteratorR,
typename _Sequence>
246 operator>=(
const __iterator_tracker<_IteratorL, _Sequence>& __lhs,
247 const __iterator_tracker<_IteratorR, _Sequence>& __rhs)
249 {
return __lhs.base() >= __rhs.base(); }
251 template<
typename _Iterator,
typename _Sequence>
253 operator>=(
const __iterator_tracker<_Iterator, _Sequence>& __lhs,
254 const __iterator_tracker<_Iterator, _Sequence>& __rhs)
256 {
return __lhs.base() >= __rhs.base(); }
262 template<
typename _IteratorL,
typename _IteratorR,
typename _Sequence>
263 inline typename __iterator_tracker<_IteratorL, _Sequence>::difference_type
264 operator-(
const __iterator_tracker<_IteratorL, _Sequence>& __lhs,
265 const __iterator_tracker<_IteratorR, _Sequence>& __rhs)
267 {
return __lhs.base() - __rhs.base(); }
269 template<
typename _Iterator,
typename _Sequence>
270 inline typename __iterator_tracker<_Iterator, _Sequence>::difference_type
271 operator-(
const __iterator_tracker<_Iterator, _Sequence>& __lhs,
272 const __iterator_tracker<_Iterator, _Sequence>& __rhs)
274 {
return __lhs.base() - __rhs.base(); }
276 template<
typename _Iterator,
typename _Sequence>
277 inline __iterator_tracker<_Iterator, _Sequence>
278 operator+(
typename __iterator_tracker<_Iterator,_Sequence>::difference_type
280 const __iterator_tracker<_Iterator, _Sequence>& __i)
282 {
return __i + __n; }
complex< _Tp > operator*(const complex< _Tp > &__x, const complex< _Tp > &__y)
Return new complex value x times y.
ISO C++ entities toplevel namespace is std.