libstdc++
safe_iterator.tcc
Go to the documentation of this file.
1// Debugging iterator implementation (out of line) -*- C++ -*-
2
3// Copyright (C) 2003-2024 Free Software Foundation, Inc.
4//
5// This file is part of the GNU ISO C++ Library. This library is free
6// software; you can redistribute it and/or modify it under the
7// terms of the GNU General Public License as published by the
8// Free Software Foundation; either version 3, or (at your option)
9// any later version.
10
11// This library is distributed in the hope that it will be useful,
12// but WITHOUT ANY WARRANTY; without even the implied warranty of
13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14// GNU General Public License for more details.
15
16// Under Section 7 of GPL version 3, you are granted additional
17// permissions described in the GCC Runtime Library Exception, version
18// 3.1, as published by the Free Software Foundation.
19
20// You should have received a copy of the GNU General Public License and
21// a copy of the GCC Runtime Library Exception along with this program;
22// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
23// <http://www.gnu.org/licenses/>.
24
25/** @file debug/safe_iterator.tcc
26 * This file is a GNU debug extension to the Standard C++ Library.
27 */
28
29#ifndef _GLIBCXX_DEBUG_SAFE_ITERATOR_TCC
30#define _GLIBCXX_DEBUG_SAFE_ITERATOR_TCC 1
31
32#include <bits/stl_algobase.h>
33
34namespace __gnu_debug
35{
36 template<typename _Iterator, typename _Sequence, typename _Category>
37 typename _Distance_traits<_Iterator>::__type
38 _Safe_iterator<_Iterator, _Sequence, _Category>::
39 _M_get_distance_from_begin() const
40 {
41 typedef _Sequence_traits<_Sequence> _SeqTraits;
42
43 // No need to consider before_begin as this function is only used in
44 // _M_can_advance which won't be used for forward_list iterators.
45 if (_M_is_begin())
46 return std::make_pair(0, __dp_exact);
47
48 if (_M_is_end())
49 return _SeqTraits::_S_size(*_M_get_sequence());
50
51 typename _Distance_traits<_Iterator>::__type __res
52 = __get_distance(_M_get_sequence()->_M_base().begin(), base());
53
54 if (__res.second == __dp_equality)
55 return std::make_pair(1, __dp_sign);
56
57 return __res;
58 }
59
60 template<typename _Iterator, typename _Sequence, typename _Category>
61 typename _Distance_traits<_Iterator>::__type
62 _Safe_iterator<_Iterator, _Sequence, _Category>::
63 _M_get_distance_to_end() const
64 {
65 typedef _Sequence_traits<_Sequence> _SeqTraits;
66
67 // No need to consider before_begin as this function is only used in
68 // _M_can_advance which won't be used for forward_list iterators.
69 if (_M_is_begin())
70 return _SeqTraits::_S_size(*_M_get_sequence());
71
72 if (_M_is_end())
73 return std::make_pair(0, __dp_exact);
74
75 typename _Distance_traits<_Iterator>::__type __res
76 = __get_distance(base(), _M_get_sequence()->_M_base().end());
77
78 if (__res.second == __dp_equality)
79 return std::make_pair(1, __dp_sign);
80
81 return __res;
82 }
83
84 template<typename _Iterator, typename _Sequence, typename _Category>
85 bool
86 _Safe_iterator<_Iterator, _Sequence, _Category>::
87 _M_can_advance(difference_type __n, bool __strict) const
88 {
89 if (this->_M_singular())
90 return false;
91
92 if (__n == 0)
93 return true;
94
96 ? _M_get_distance_from_begin()
97 : _M_get_distance_to_end();
98
99 if (__n < 0)
100 __n = -__n;
101
102 return __dist.second > __dp_sign
103 ? __dist.first >= __n
104 : !__strict && __dist.first > 0;
105 }
106
107 template<typename _Iterator, typename _Sequence, typename _Category>
108 template<typename _Diff>
109 bool
110 _Safe_iterator<_Iterator, _Sequence, _Category>::
111 _M_can_advance(const std::pair<_Diff, _Distance_precision>& __dist,
112 int __way) const
113 {
114 return __dist.second == __dp_exact
115 ? _M_can_advance(__way * __dist.first)
116 : _M_can_advance(__way * (__dist.first == 0
117 ? 0
118 : __dist.first < 0 ? -1 : 1));
119 }
120
121 template<typename _Iterator, typename _Sequence, typename _Category>
122 typename _Distance_traits<_Iterator>::__type
123 _Safe_iterator<_Iterator, _Sequence, _Category>::
124 _M_get_distance_to(const _Safe_iterator& __rhs) const
125 {
126 typedef typename _Distance_traits<_Iterator>::__type _Dist;
127 typedef _Sequence_traits<_Sequence> _SeqTraits;
128
129 _Dist __base_dist = __get_distance(this->base(), __rhs.base());
130 if (__base_dist.second == __dp_exact)
131 return __base_dist;
132
133 _Dist __seq_dist = _SeqTraits::_S_size(*this->_M_get_sequence());
134 if (this->_M_is_before_begin())
135 {
136 if (__rhs._M_is_begin())
137 return std::make_pair(1, __dp_exact);
138
139 return __seq_dist.second == __dp_exact
140 ? std::make_pair(__seq_dist.first + 1, __dp_exact)
141 : __seq_dist;
142 }
143
144 if (this->_M_is_begin())
145 {
146 if (__rhs._M_is_before_begin())
147 return std::make_pair(-1, __dp_exact);
148
149 if (__rhs._M_is_end())
150 return __seq_dist;
151
152 return std::make_pair(__seq_dist.first,
153 __seq_dist.second == __dp_exact
154 ? __dp_sign_max_size : __seq_dist.second);
155 }
156
157 if (this->_M_is_end())
158 {
159 if (__rhs._M_is_before_begin())
160 return __seq_dist.second == __dp_exact
161 ? std::make_pair(-__seq_dist.first - 1, __dp_exact)
162 : std::make_pair(-__seq_dist.first, __dp_sign);
163
164 if (__rhs._M_is_begin())
165 return std::make_pair(-__seq_dist.first, __seq_dist.second);
166
167 return std::make_pair(-__seq_dist.first,
168 __seq_dist.second == __dp_exact
169 ? __dp_sign_max_size : __seq_dist.second);
170 }
171
172 if (__rhs._M_is_before_begin())
173 return __seq_dist.second == __dp_exact
174 ? std::make_pair(__seq_dist.first - 1, __dp_exact)
175 : std::make_pair(-__seq_dist.first, __dp_sign);
176
177 if (__rhs._M_is_begin())
178 return std::make_pair(-__seq_dist.first,
179 __seq_dist.second == __dp_exact
180 ? __dp_sign_max_size : __seq_dist.second);
181
182 if (__rhs._M_is_end())
183 return std::make_pair(__seq_dist.first,
184 __seq_dist.second == __dp_exact
185 ? __dp_sign_max_size : __seq_dist.second);
186
187 return std::make_pair(1, __dp_equality);
188 }
189
190 template<typename _Iterator, typename _Sequence, typename _Category>
191 bool
192 _Safe_iterator<_Iterator, _Sequence, _Category>::
193 _M_valid_range(const _Safe_iterator& __rhs,
195 bool __check_dereferenceable) const
196 {
197 if (_M_singular() || __rhs._M_singular() || !_M_can_compare(__rhs))
198 return false;
199
200 /* Determine iterators order */
201 __dist = _M_get_distance_to(__rhs);
202 if (__dist.second != __dp_equality)
203 {
204 // If range is not empty first iterator must be dereferenceable.
205 return __dist.first == 0
206 || (__dist.first > 0
207 && (!__check_dereferenceable || _M_dereferenceable()));
208 }
209
210 // Assume that this is a valid range; we can't check anything else.
211 return true;
212 }
213
214 template<typename _Iterator, typename _Sequence>
215 bool
216 _Safe_iterator<_Iterator, _Sequence, std::random_access_iterator_tag>::
217 _M_valid_range(const _Safe_iterator& __rhs,
218 std::pair<difference_type,
219 _Distance_precision>& __dist) const
220 {
221 if (this->_M_singular() || __rhs._M_singular()
222 || !this->_M_can_compare(__rhs))
223 return false;
224
225 /* Determine iterators order */
226 __dist = std::make_pair(__rhs.base() - this->base(), __dp_exact);
227
228 // If range is not empty first iterator must be dereferenceable.
229 return __dist.first == 0
230 || (__dist.first > 0 && this->_M_dereferenceable());
231 }
232} // namespace __gnu_debug
233
234namespace std _GLIBCXX_VISIBILITY(default)
235{
236_GLIBCXX_BEGIN_NAMESPACE_VERSION
237
238#if __cplusplus < 201103L
239 template<typename _Ite, typename _Seq>
240 _Ite
241 __niter_base(const ::__gnu_debug::_Safe_iterator<_Ite, _Seq,
243 { return __it.base(); }
244
245 template<typename _Ite, typename _Cont, typename _DbgSeq>
246 _Ite
247 __niter_base(const ::__gnu_debug::_Safe_iterator<
248 ::__gnu_cxx::__normal_iterator<_Ite, _Cont>, _DbgSeq,
250 { return __it.base().base(); }
251#else
252 template<typename _Ite, typename _Seq>
253 _GLIBCXX20_CONSTEXPR
254 decltype(std::__niter_base(std::declval<_Ite>()))
255 __niter_base(const ::__gnu_debug::_Safe_iterator<_Ite, _Seq,
258 { return std::__niter_base(__it.base()); }
259#endif
260
261 template<bool _IsMove,
262 typename _Ite, typename _Seq, typename _Cat, typename _OI>
263 _GLIBCXX20_CONSTEXPR
264 _OI
265 __copy_move_a(
266 const ::__gnu_debug::_Safe_iterator<_Ite, _Seq, _Cat>& __first,
267 const ::__gnu_debug::_Safe_iterator<_Ite, _Seq, _Cat>& __last,
268 _OI __result)
269 {
270 typename ::__gnu_debug::_Distance_traits<_Ite>::__type __dist;
271 __glibcxx_check_valid_range2(__first, __last, __dist);
272 __glibcxx_check_can_increment_dist(__result, __dist, 1);
273
274 if (__dist.second > ::__gnu_debug::__dp_equality)
275 return std::__copy_move_a<_IsMove>(__first.base(), __last.base(),
276 __result);
277
278 return std::__copy_move_a1<_IsMove>(__first, __last, __result);
279 }
280
281 template<bool _IsMove,
282 typename _II, typename _Ite, typename _Seq, typename _Cat>
283 _GLIBCXX20_CONSTEXPR
285 __copy_move_a(_II __first, _II __last,
286 const ::__gnu_debug::_Safe_iterator<_Ite, _Seq, _Cat>& __result)
287 {
288 typename ::__gnu_debug::_Distance_traits<_II>::__type __dist;
289 __glibcxx_check_valid_range2(__first, __last, __dist);
290 __glibcxx_check_can_increment_dist(__result, __dist, 1);
291
292 if (__dist.second > ::__gnu_debug::__dp_sign
293 && __result._M_can_advance(__dist.first, true))
294 return ::__gnu_debug::_Safe_iterator<_Ite, _Seq, _Cat>(
295 std::__copy_move_a<_IsMove>(__first, __last, __result.base()),
296 __result._M_sequence);
297
298 return std::__copy_move_a1<_IsMove>(__first, __last, __result);
299 }
300
301 template<bool _IsMove,
302 typename _IIte, typename _ISeq, typename _ICat,
303 typename _OIte, typename _OSeq, typename _OCat>
304 _GLIBCXX20_CONSTEXPR
305 ::__gnu_debug::_Safe_iterator<_OIte, _OSeq, _OCat>
306 __copy_move_a(
307 const ::__gnu_debug::_Safe_iterator<_IIte, _ISeq, _ICat>& __first,
308 const ::__gnu_debug::_Safe_iterator<_IIte, _ISeq, _ICat>& __last,
309 const ::__gnu_debug::_Safe_iterator<_OIte, _OSeq, _OCat>& __result)
310 {
311 typename ::__gnu_debug::_Distance_traits<_IIte>::__type __dist;
312 __glibcxx_check_valid_range2(__first, __last, __dist);
313 __glibcxx_check_can_increment_dist(__result, __dist, 1);
314
315 if (__dist.second > ::__gnu_debug::__dp_equality)
316 {
317 if (__dist.second > ::__gnu_debug::__dp_sign
318 && __result._M_can_advance(__dist.first, true))
319 return ::__gnu_debug::_Safe_iterator<_OIte, _OSeq, _OCat>(
320 std::__copy_move_a<_IsMove>(__first.base(), __last.base(),
321 __result.base()),
322 __result._M_sequence);
323
324 return std::__copy_move_a<_IsMove>(__first.base(), __last.base(),
325 __result);
326 }
327
328 return std::__copy_move_a1<_IsMove>(__first, __last, __result);
329 }
330
331 template<bool _IsMove,
332 typename _Ite, typename _Seq, typename _Cat, typename _OI>
333 _GLIBCXX20_CONSTEXPR
334 _OI
335 __copy_move_backward_a(
336 const ::__gnu_debug::_Safe_iterator<_Ite, _Seq, _Cat>& __first,
337 const ::__gnu_debug::_Safe_iterator<_Ite, _Seq, _Cat>& __last,
338 _OI __result)
339 {
340 typename ::__gnu_debug::_Distance_traits<_Ite>::__type __dist;
341 __glibcxx_check_valid_range2(__first, __last, __dist);
342 __glibcxx_check_can_increment_dist(__result, __dist, -1);
343
344 if (__dist.second > ::__gnu_debug::__dp_equality)
345 return std::__copy_move_backward_a<_IsMove>(
346 __first.base(), __last.base(), __result);
347
348 return std::__copy_move_backward_a1<_IsMove>(__first, __last, __result);
349 }
350
351 template<bool _IsMove,
352 typename _II, typename _Ite, typename _Seq, typename _Cat>
353 _GLIBCXX20_CONSTEXPR
355 __copy_move_backward_a(_II __first, _II __last,
356 const ::__gnu_debug::_Safe_iterator<_Ite, _Seq, _Cat>& __result)
357 {
358 typename ::__gnu_debug::_Distance_traits<_II>::__type __dist;
359 __glibcxx_check_valid_range2(__first, __last, __dist);
360 __glibcxx_check_can_increment_dist(__result, __dist, -1);
361
362 if (__dist.second > ::__gnu_debug::__dp_sign
363 && __result._M_can_advance(-__dist.first, true))
364 return ::__gnu_debug::_Safe_iterator<_Ite, _Seq, _Cat>(
365 std::__copy_move_backward_a<_IsMove>(__first, __last,
366 __result.base()),
367 __result._M_sequence);
368
369 return std::__copy_move_backward_a1<_IsMove>(__first, __last, __result);
370 }
371
372 template<bool _IsMove,
373 typename _IIte, typename _ISeq, typename _ICat,
374 typename _OIte, typename _OSeq, typename _OCat>
375 _GLIBCXX20_CONSTEXPR
376 ::__gnu_debug::_Safe_iterator<_OIte, _OSeq, _OCat>
377 __copy_move_backward_a(
378 const ::__gnu_debug::_Safe_iterator<_IIte, _ISeq, _ICat>& __first,
379 const ::__gnu_debug::_Safe_iterator<_IIte, _ISeq, _ICat>& __last,
380 const ::__gnu_debug::_Safe_iterator<_OIte, _OSeq, _OCat>& __result)
381 {
382 typename ::__gnu_debug::_Distance_traits<_IIte>::__type __dist;
383 __glibcxx_check_valid_range2(__first, __last, __dist);
384 __glibcxx_check_can_increment_dist(__result, __dist, -1);
385
386 if (__dist.second > ::__gnu_debug::__dp_equality)
387 {
388 if (__dist.second > ::__gnu_debug::__dp_sign
389 && __result._M_can_advance(-__dist.first, true))
390 return ::__gnu_debug::_Safe_iterator<_OIte, _OSeq, _OCat>(
391 std::__copy_move_backward_a<_IsMove>(__first.base(), __last.base(),
392 __result.base()),
393 __result._M_sequence);
394
395 return std::__copy_move_backward_a<_IsMove>(
396 __first.base(), __last.base(), __result);
397 }
398
399 return std::__copy_move_backward_a1<_IsMove>(__first, __last, __result);
400 }
401
402 template<typename _Ite, typename _Seq, typename _Cat, typename _Tp>
403 _GLIBCXX20_CONSTEXPR
404 void
405 __fill_a(const ::__gnu_debug::_Safe_iterator<_Ite, _Seq, _Cat>& __first,
406 const ::__gnu_debug::_Safe_iterator<_Ite, _Seq, _Cat>& __last,
407 const _Tp& __value)
408 {
409 typename ::__gnu_debug::_Distance_traits<_Ite>::__type __dist;
410 __glibcxx_check_valid_range2(__first, __last, __dist);
411
412 if (__dist.second > ::__gnu_debug::__dp_equality)
413 std::__fill_a(__first.base(), __last.base(), __value);
414
415 std::__fill_a1(__first, __last, __value);
416 }
417
418 template<typename _Ite, typename _Seq, typename _Cat, typename _Size,
419 typename _Tp>
420 _GLIBCXX20_CONSTEXPR
421 ::__gnu_debug::_Safe_iterator<_Ite, _Seq, _Cat>
422 __fill_n_a(const ::__gnu_debug::_Safe_iterator<_Ite, _Seq, _Cat>& __first,
423 _Size __n, const _Tp& __value,
425 {
426#if __cplusplus >= 201103L
427 static_assert(is_integral<_Size>{}, "fill_n must pass integral size");
428#endif
429
430 if (__n <= 0)
431 return __first;
432
433 __glibcxx_check_can_increment(__first, __n);
434 if (__first._M_can_advance(__n, true))
435 return ::__gnu_debug::_Safe_iterator<_Ite, _Seq, _Cat>(
436 std::__fill_n_a(__first.base(), __n, __value, _Cat()),
437 __first._M_sequence);
438
439 return std::__fill_n_a1(__first, __n, __value);
440 }
441
442 template<typename _II1, typename _Seq1, typename _Cat1, typename _II2>
443 _GLIBCXX20_CONSTEXPR
444 bool
445 __equal_aux(
446 const ::__gnu_debug::_Safe_iterator<_II1, _Seq1, _Cat1>& __first1,
447 const ::__gnu_debug::_Safe_iterator<_II1, _Seq1, _Cat1>& __last1,
448 _II2 __first2)
449 {
450 typename ::__gnu_debug::_Distance_traits<_II1>::__type __dist;
451 __glibcxx_check_valid_range2(__first1, __last1, __dist);
452 __glibcxx_check_can_increment_dist(__first2, __dist, 1);
453
454 if (__dist.second > ::__gnu_debug::__dp_equality)
455 return std::__equal_aux(__first1.base(), __last1.base(), __first2);
456
457 return std::__equal_aux1(__first1, __last1, __first2);
458 }
459
460 template<typename _II1, typename _II2, typename _Seq2, typename _Cat2>
461 _GLIBCXX20_CONSTEXPR
462 bool
463 __equal_aux(_II1 __first1, _II1 __last1,
464 const ::__gnu_debug::_Safe_iterator<_II2, _Seq2, _Cat2>& __first2)
465 {
466 typename ::__gnu_debug::_Distance_traits<_II1>::__type __dist;
467 __glibcxx_check_valid_range2(__first1, __last1, __dist);
468 __glibcxx_check_can_increment_dist(__first2, __dist, 1);
469
470 if (__dist.second > ::__gnu_debug::__dp_sign
471 && __first2._M_can_advance(__dist.first, true))
472 return std::__equal_aux(__first1, __last1, __first2.base());
473
474 return std::__equal_aux1(__first1, __last1, __first2);
475 }
476
477 template<typename _II1, typename _Seq1, typename _Cat1,
478 typename _II2, typename _Seq2, typename _Cat2>
479 _GLIBCXX20_CONSTEXPR
480 bool
481 __equal_aux(
482 const ::__gnu_debug::_Safe_iterator<_II1, _Seq1, _Cat1>& __first1,
483 const ::__gnu_debug::_Safe_iterator<_II1, _Seq1, _Cat1>& __last1,
484 const ::__gnu_debug::_Safe_iterator<_II2, _Seq2, _Cat2>& __first2)
485 {
486 typename ::__gnu_debug::_Distance_traits<_II1>::__type __dist;
487 __glibcxx_check_valid_range2(__first1, __last1, __dist);
488 __glibcxx_check_can_increment_dist(__first2, __dist, 1);
489
490 if (__dist.second > ::__gnu_debug::__dp_equality)
491 {
492 if (__dist.second > ::__gnu_debug::__dp_sign &&
493 __first2._M_can_advance(__dist.first, true))
494 return std::__equal_aux(__first1.base(), __last1.base(),
495 __first2.base());
496 return std::__equal_aux(__first1.base(), __last1.base(), __first2);
497 }
498
499 return __equal_aux1(__first1, __last1, __first2);
500 }
501
502 template<typename _Ite1, typename _Seq1, typename _Cat1,
503 typename _II2>
504 _GLIBCXX20_CONSTEXPR
505 bool
506 __lexicographical_compare_aux(
507 const ::__gnu_debug::_Safe_iterator<_Ite1, _Seq1, _Cat1>& __first1,
508 const ::__gnu_debug::_Safe_iterator<_Ite1, _Seq1, _Cat1>& __last1,
509 _II2 __first2, _II2 __last2)
510 {
511 typename ::__gnu_debug::_Distance_traits<_Ite1>::__type __dist1;
512 __glibcxx_check_valid_range2(__first1, __last1, __dist1);
513 __glibcxx_check_valid_range(__first2, __last2);
514
515 if (__dist1.second > ::__gnu_debug::__dp_equality)
516 return std::__lexicographical_compare_aux(__first1.base(),
517 __last1.base(),
518 __first2, __last2);
519 return std::__lexicographical_compare_aux1(__first1, __last1,
520 __first2, __last2);
521 }
522
523 template<typename _II1,
524 typename _Ite2, typename _Seq2, typename _Cat2>
525 _GLIBCXX20_CONSTEXPR
526 bool
527 __lexicographical_compare_aux(
528 _II1 __first1, _II1 __last1,
529 const ::__gnu_debug::_Safe_iterator<_Ite2, _Seq2, _Cat2>& __first2,
530 const ::__gnu_debug::_Safe_iterator<_Ite2, _Seq2, _Cat2>& __last2)
531 {
532 __glibcxx_check_valid_range(__first1, __last1);
533 typename ::__gnu_debug::_Distance_traits<_II1>::__type __dist2;
534 __glibcxx_check_valid_range2(__first2, __last2, __dist2);
535
536 if (__dist2.second > ::__gnu_debug::__dp_equality)
537 return std::__lexicographical_compare_aux(__first1, __last1,
538 __first2.base(),
539 __last2.base());
540 return std::__lexicographical_compare_aux1(__first1, __last1,
541 __first2, __last2);
542 }
543
544 template<typename _Ite1, typename _Seq1, typename _Cat1,
545 typename _Ite2, typename _Seq2, typename _Cat2>
546 _GLIBCXX20_CONSTEXPR
547 bool
548 __lexicographical_compare_aux(
549 const ::__gnu_debug::_Safe_iterator<_Ite1, _Seq1, _Cat1>& __first1,
550 const ::__gnu_debug::_Safe_iterator<_Ite1, _Seq1, _Cat1>& __last1,
551 const ::__gnu_debug::_Safe_iterator<_Ite2, _Seq2, _Cat2>& __first2,
552 const ::__gnu_debug::_Safe_iterator<_Ite2, _Seq2, _Cat2>& __last2)
553 {
554 typename ::__gnu_debug::_Distance_traits<_Ite1>::__type __dist1;
555 __glibcxx_check_valid_range2(__first1, __last1, __dist1);
556 typename ::__gnu_debug::_Distance_traits<_Ite2>::__type __dist2;
557 __glibcxx_check_valid_range2(__first2, __last2, __dist2);
558
559 if (__dist1.second > ::__gnu_debug::__dp_equality)
560 {
561 if (__dist2.second > ::__gnu_debug::__dp_equality)
562 return std::__lexicographical_compare_aux(__first1.base(),
563 __last1.base(),
564 __first2.base(),
565 __last2.base());
566 return std::__lexicographical_compare_aux(__first1.base(),
567 __last1.base(),
568 __first2, __last2);
569 }
570
571 if (__dist2.second > ::__gnu_debug::__dp_equality)
572 return std::__lexicographical_compare_aux(__first1, __last1,
573 __first2.base(),
574 __last2.base());
575 return std::__lexicographical_compare_aux1(__first1, __last1,
576 __first2, __last2);
577 }
578
579_GLIBCXX_END_NAMESPACE_VERSION
580} // namespace std
581
582#endif
_Tp * end(valarray< _Tp > &__va) noexcept
Return an iterator pointing to one past the last element of the valarray.
Definition valarray:1249
_Tp * begin(valarray< _Tp > &__va) noexcept
Return an iterator pointing to the first element of the valarray.
Definition valarray:1227
ISO C++ entities toplevel namespace is std.
GNU debug classes for public use.
constexpr _Distance_traits< _Iterator >::__type __get_distance(_Iterator __lhs, _Iterator __rhs, std::random_access_iterator_tag)
is_nothrow_copy_constructible
Definition type_traits:1203
Safe iterator wrapper.
Struct holding two objects of arbitrary type.
Definition stl_pair.h:286
_T1 first
The first member.
Definition stl_pair.h:290
_T2 second
The second member.
Definition stl_pair.h:291
Marking input iterators.
Random-access iterators support a superset of bidirectional iterator operations.