]> git.ipfire.org Git - thirdparty/gcc.git/blame - libstdc++-v3/include/debug/deque
Update copyright years.
[thirdparty/gcc.git] / libstdc++-v3 / include / debug / deque
CommitLineData
285b36d6
BK
1// Debugging deque implementation -*- C++ -*-
2
8d9254fc 3// Copyright (C) 2003-2020 Free Software Foundation, Inc.
285b36d6
BK
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
748086b7 8// Free Software Foundation; either version 3, or (at your option)
285b36d6
BK
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
748086b7
JJ
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/>.
285b36d6 24
78a53887
BK
25/** @file debug/deque
26 * This file is a GNU debug extension to the Standard C++ Library.
27 */
28
285b36d6
BK
29#ifndef _GLIBCXX_DEBUG_DEQUE
30#define _GLIBCXX_DEBUG_DEQUE 1
31
541a9b10
JW
32#pragma GCC system_header
33
9ca2ac69
JW
34#include <bits/c++config.h>
35namespace std _GLIBCXX_VISIBILITY(default) { namespace __debug {
36 template<typename _Tp, typename _Allocator> class deque;
37} } // namespace std::__debug
38
285b36d6
BK
39#include <deque>
40#include <debug/safe_sequence.h>
15ee1a77 41#include <debug/safe_container.h>
285b36d6
BK
42#include <debug/safe_iterator.h>
43
12ffa228 44namespace std _GLIBCXX_VISIBILITY(default)
3cbc7af0 45{
45f388bb 46namespace __debug
285b36d6 47{
1ceb9e06 48 /// Class std::deque with safety/checking/debug instrumentation.
285b36d6 49 template<typename _Tp, typename _Allocator = std::allocator<_Tp> >
526da49c 50 class deque
15ee1a77
FD
51 : public __gnu_debug::_Safe_container<
52 deque<_Tp, _Allocator>, _Allocator,
b6f86694 53 __gnu_debug::_Safe_sequence>,
15ee1a77 54 public _GLIBCXX_STD_C::deque<_Tp, _Allocator>
285b36d6 55 {
15ee1a77
FD
56 typedef _GLIBCXX_STD_C::deque<_Tp, _Allocator> _Base;
57 typedef __gnu_debug::_Safe_container<
b6f86694 58 deque, _Allocator, __gnu_debug::_Safe_sequence> _Safe;
285b36d6 59
15ee1a77
FD
60 typedef typename _Base::const_iterator _Base_const_iterator;
61 typedef typename _Base::iterator _Base_iterator;
afe96d41 62 typedef __gnu_debug::_Equal_to<_Base_const_iterator> _Equal;
15ee1a77 63
e9afbed0
FD
64 template<typename _ItT, typename _SeqT, typename _CatT>
65 friend class ::__gnu_debug::_Safe_iterator;
66
285b36d6 67 public:
15ee1a77
FD
68 typedef typename _Base::reference reference;
69 typedef typename _Base::const_reference const_reference;
526da49c 70
15ee1a77
FD
71 typedef __gnu_debug::_Safe_iterator<_Base_iterator, deque>
72 iterator;
73 typedef __gnu_debug::_Safe_iterator<_Base_const_iterator, deque>
74 const_iterator;
526da49c 75
15ee1a77
FD
76 typedef typename _Base::size_type size_type;
77 typedef typename _Base::difference_type difference_type;
526da49c 78
15ee1a77
FD
79 typedef _Tp value_type;
80 typedef _Allocator allocator_type;
81 typedef typename _Base::pointer pointer;
82 typedef typename _Base::const_pointer const_pointer;
83 typedef std::reverse_iterator<iterator> reverse_iterator;
84 typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
285b36d6
BK
85
86 // 23.2.1.1 construct/copy/destroy:
c3cdd71f 87
15ee1a77
FD
88#if __cplusplus < 201103L
89 deque()
90 : _Base() { }
91
92 deque(const deque& __x)
93 : _Base(__x) { }
94
95 ~deque() { }
96#else
97 deque() = default;
98 deque(const deque&) = default;
99 deque(deque&&) = default;
100
fd18c76a
JW
101 deque(const deque& __d, const _Allocator& __a)
102 : _Base(__d, __a) { }
103
104 deque(deque&& __d, const _Allocator& __a)
105 : _Safe(std::move(__d)), _Base(std::move(__d), __a) { }
106
15ee1a77
FD
107 deque(initializer_list<value_type> __l,
108 const allocator_type& __a = allocator_type())
109 : _Base(__l, __a) { }
110
111 ~deque() = default;
112#endif
c3cdd71f 113
dc2cf706 114 explicit
c3cdd71f 115 deque(const _Allocator& __a)
285b36d6
BK
116 : _Base(__a) { }
117
734f5023 118#if __cplusplus >= 201103L
dc2cf706 119 explicit
fd18c76a
JW
120 deque(size_type __n, const _Allocator& __a = _Allocator())
121 : _Base(__n, __a) { }
dc2cf706
PC
122
123 deque(size_type __n, const _Tp& __value,
124 const _Allocator& __a = _Allocator())
125 : _Base(__n, __value, __a) { }
126#else
127 explicit
128 deque(size_type __n, const _Tp& __value = _Tp(),
129 const _Allocator& __a = _Allocator())
285b36d6 130 : _Base(__n, __value, __a) { }
dc2cf706 131#endif
285b36d6 132
734f5023 133#if __cplusplus >= 201103L
2203cb90
PC
134 template<class _InputIterator,
135 typename = std::_RequireInputIter<_InputIterator>>
136#else
285b36d6 137 template<class _InputIterator>
2203cb90 138#endif
15ee1a77 139 deque(_InputIterator __first, _InputIterator __last,
285b36d6 140 const _Allocator& __a = _Allocator())
90aabc7e
FD
141 : _Base(__gnu_debug::__base(
142 __glibcxx_check_valid_constructor_range(__first, __last)),
1f5ca1a1 143 __gnu_debug::__base(__last), __a)
15ee1a77 144 { }
285b36d6 145
ed540c0a 146 deque(const _Base& __x)
4c2d93db 147 : _Base(__x) { }
ed540c0a 148
15ee1a77 149#if __cplusplus < 201103L
ed540c0a
CJ
150 deque&
151 operator=(const deque& __x)
285b36d6 152 {
15ee1a77
FD
153 this->_M_safe() = __x;
154 _M_base() = __x;
285b36d6
BK
155 return *this;
156 }
15ee1a77
FD
157#else
158 deque&
159 operator=(const deque&) = default;
526da49c 160
ed540c0a 161 deque&
15ee1a77 162 operator=(deque&&) = default;
988499f4
JM
163
164 deque&
165 operator=(initializer_list<value_type> __l)
166 {
15ee1a77 167 _M_base() = __l;
988499f4
JM
168 this->_M_invalidate_all();
169 return *this;
170 }
ed540c0a
CJ
171#endif
172
734f5023 173#if __cplusplus >= 201103L
2203cb90
PC
174 template<class _InputIterator,
175 typename = std::_RequireInputIter<_InputIterator>>
176#else
285b36d6 177 template<class _InputIterator>
2203cb90 178#endif
15ee1a77
FD
179 void
180 assign(_InputIterator __first, _InputIterator __last)
181 {
24167c42
FD
182 typename __gnu_debug::_Distance_traits<_InputIterator>::__type __dist;
183 __glibcxx_check_valid_range2(__first, __last, __dist);
184 if (__dist.second >= __gnu_debug::__dp_sign)
185 _Base::assign(__gnu_debug::__unsafe(__first),
186 __gnu_debug::__unsafe(__last));
187 else
188 _Base::assign(__first, __last);
189
285b36d6
BK
190 this->_M_invalidate_all();
191 }
192
526da49c 193 void
285b36d6
BK
194 assign(size_type __n, const _Tp& __t)
195 {
196 _Base::assign(__n, __t);
197 this->_M_invalidate_all();
198 }
526da49c 199
734f5023 200#if __cplusplus >= 201103L
988499f4
JM
201 void
202 assign(initializer_list<value_type> __l)
203 {
204 _Base::assign(__l);
205 this->_M_invalidate_all();
206 }
207#endif
208
285b36d6 209 using _Base::get_allocator;
526da49c 210
285b36d6 211 // iterators:
526da49c 212 iterator
d3677132 213 begin() _GLIBCXX_NOEXCEPT
285b36d6 214 { return iterator(_Base::begin(), this); }
526da49c
BI
215
216 const_iterator
d3677132 217 begin() const _GLIBCXX_NOEXCEPT
285b36d6 218 { return const_iterator(_Base::begin(), this); }
526da49c
BI
219
220 iterator
d3677132 221 end() _GLIBCXX_NOEXCEPT
285b36d6 222 { return iterator(_Base::end(), this); }
526da49c
BI
223
224 const_iterator
d3677132 225 end() const _GLIBCXX_NOEXCEPT
285b36d6 226 { return const_iterator(_Base::end(), this); }
526da49c
BI
227
228 reverse_iterator
d3677132 229 rbegin() _GLIBCXX_NOEXCEPT
285b36d6 230 { return reverse_iterator(end()); }
526da49c
BI
231
232 const_reverse_iterator
d3677132 233 rbegin() const _GLIBCXX_NOEXCEPT
285b36d6 234 { return const_reverse_iterator(end()); }
526da49c
BI
235
236 reverse_iterator
d3677132 237 rend() _GLIBCXX_NOEXCEPT
285b36d6 238 { return reverse_iterator(begin()); }
526da49c
BI
239
240 const_reverse_iterator
d3677132 241 rend() const _GLIBCXX_NOEXCEPT
285b36d6 242 { return const_reverse_iterator(begin()); }
526da49c 243
734f5023 244#if __cplusplus >= 201103L
0cd50f89 245 const_iterator
d3677132 246 cbegin() const noexcept
0cd50f89
PC
247 { return const_iterator(_Base::begin(), this); }
248
249 const_iterator
d3677132 250 cend() const noexcept
0cd50f89
PC
251 { return const_iterator(_Base::end(), this); }
252
253 const_reverse_iterator
d3677132 254 crbegin() const noexcept
0cd50f89
PC
255 { return const_reverse_iterator(end()); }
256
257 const_reverse_iterator
d3677132 258 crend() const noexcept
0cd50f89
PC
259 { return const_reverse_iterator(begin()); }
260#endif
261
afe96d41
FD
262 private:
263 void
264 _M_invalidate_after_nth(difference_type __n)
265 {
266 typedef __gnu_debug::_After_nth_from<_Base_const_iterator> _After_nth;
267 this->_M_invalidate_if(_After_nth(__n, _Base::begin()));
268 }
15ee1a77 269
afe96d41 270 public:
285b36d6
BK
271 // 23.2.1.2 capacity:
272 using _Base::size;
273 using _Base::max_size;
526da49c 274
734f5023 275#if __cplusplus >= 201103L
dc2cf706
PC
276 void
277 resize(size_type __sz)
278 {
dc2cf706
PC
279 bool __invalidate_all = __sz > this->size();
280 if (__sz < this->size())
afe96d41 281 this->_M_invalidate_after_nth(__sz);
dc2cf706
PC
282
283 _Base::resize(__sz);
284
285 if (__invalidate_all)
286 this->_M_invalidate_all();
287 }
288
289 void
290 resize(size_type __sz, const _Tp& __c)
291 {
dc2cf706
PC
292 bool __invalidate_all = __sz > this->size();
293 if (__sz < this->size())
afe96d41 294 this->_M_invalidate_after_nth(__sz);
dc2cf706
PC
295
296 _Base::resize(__sz, __c);
297
298 if (__invalidate_all)
299 this->_M_invalidate_all();
300 }
301#else
526da49c 302 void
285b36d6
BK
303 resize(size_type __sz, _Tp __c = _Tp())
304 {
285b36d6
BK
305 bool __invalidate_all = __sz > this->size();
306 if (__sz < this->size())
afe96d41 307 this->_M_invalidate_after_nth(__sz);
526da49c 308
285b36d6 309 _Base::resize(__sz, __c);
526da49c 310
285b36d6
BK
311 if (__invalidate_all)
312 this->_M_invalidate_all();
313 }
dc2cf706 314#endif
526da49c 315
734f5023 316#if __cplusplus >= 201103L
8a752dfe 317 void
d15ac9d9 318 shrink_to_fit() noexcept
8a752dfe
FD
319 {
320 if (_Base::_M_shrink_to_fit())
321 this->_M_invalidate_all();
322 }
79667f82
PC
323#endif
324
285b36d6 325 using _Base::empty;
526da49c 326
285b36d6 327 // element access:
526da49c 328 reference
d15ac9d9 329 operator[](size_type __n) _GLIBCXX_NOEXCEPT
285b36d6
BK
330 {
331 __glibcxx_check_subscript(__n);
332 return _M_base()[__n];
333 }
526da49c
BI
334
335 const_reference
d15ac9d9 336 operator[](size_type __n) const _GLIBCXX_NOEXCEPT
285b36d6
BK
337 {
338 __glibcxx_check_subscript(__n);
339 return _M_base()[__n];
340 }
526da49c 341
285b36d6 342 using _Base::at;
526da49c
BI
343
344 reference
d15ac9d9 345 front() _GLIBCXX_NOEXCEPT
285b36d6
BK
346 {
347 __glibcxx_check_nonempty();
348 return _Base::front();
349 }
526da49c
BI
350
351 const_reference
d15ac9d9 352 front() const _GLIBCXX_NOEXCEPT
285b36d6
BK
353 {
354 __glibcxx_check_nonempty();
355 return _Base::front();
356 }
526da49c
BI
357
358 reference
d15ac9d9 359 back() _GLIBCXX_NOEXCEPT
285b36d6
BK
360 {
361 __glibcxx_check_nonempty();
362 return _Base::back();
363 }
526da49c
BI
364
365 const_reference
d15ac9d9 366 back() const _GLIBCXX_NOEXCEPT
285b36d6
BK
367 {
368 __glibcxx_check_nonempty();
369 return _Base::back();
370 }
526da49c 371
285b36d6 372 // 23.2.1.3 modifiers:
526da49c 373 void
285b36d6
BK
374 push_front(const _Tp& __x)
375 {
376 _Base::push_front(__x);
377 this->_M_invalidate_all();
378 }
526da49c
BI
379
380 void
285b36d6
BK
381 push_back(const _Tp& __x)
382 {
383 _Base::push_back(__x);
384 this->_M_invalidate_all();
385 }
4dc3e453 386
734f5023 387#if __cplusplus >= 201103L
4dc3e453
PC
388 void
389 push_front(_Tp&& __x)
390 { emplace_front(std::move(__x)); }
391
392 void
393 push_back(_Tp&& __x)
394 { emplace_back(std::move(__x)); }
395
7ffec97f 396 template<typename... _Args>
594ef205
JW
397#if __cplusplus > 201402L
398 reference
399#else
15ee1a77 400 void
594ef205 401#endif
15ee1a77 402 emplace_front(_Args&&... __args)
7ffec97f 403 {
4dc3e453 404 _Base::emplace_front(std::forward<_Args>(__args)...);
7ffec97f 405 this->_M_invalidate_all();
594ef205
JW
406#if __cplusplus > 201402L
407 return front();
408#endif
7ffec97f
CJ
409 }
410
411 template<typename... _Args>
594ef205
JW
412#if __cplusplus > 201402L
413 reference
414#else
15ee1a77 415 void
594ef205 416#endif
15ee1a77 417 emplace_back(_Args&&... __args)
7ffec97f 418 {
4dc3e453 419 _Base::emplace_back(std::forward<_Args>(__args)...);
7ffec97f 420 this->_M_invalidate_all();
594ef205
JW
421#if __cplusplus > 201402L
422 return back();
423#endif
7ffec97f
CJ
424 }
425
426 template<typename... _Args>
15ee1a77
FD
427 iterator
428 emplace(const_iterator __position, _Args&&... __args)
7ffec97f
CJ
429 {
430 __glibcxx_check_insert(__position);
afe96d41
FD
431 _Base_iterator __res = _Base::emplace(__position.base(),
432 std::forward<_Args>(__args)...);
7ffec97f
CJ
433 this->_M_invalidate_all();
434 return iterator(__res, this);
435 }
436#endif
526da49c
BI
437
438 iterator
7b61c5a9
PC
439#if __cplusplus >= 201103L
440 insert(const_iterator __position, const _Tp& __x)
441#else
285b36d6 442 insert(iterator __position, const _Tp& __x)
7b61c5a9 443#endif
285b36d6
BK
444 {
445 __glibcxx_check_insert(__position);
afe96d41 446 _Base_iterator __res = _Base::insert(__position.base(), __x);
285b36d6
BK
447 this->_M_invalidate_all();
448 return iterator(__res, this);
449 }
526da49c 450
734f5023 451#if __cplusplus >= 201103L
7ffec97f 452 iterator
7b61c5a9 453 insert(const_iterator __position, _Tp&& __x)
360b7bff 454 { return emplace(__position, std::move(__x)); }
988499f4 455
06eed9f5
PC
456 iterator
457 insert(const_iterator __position, initializer_list<value_type> __l)
988499f4 458 {
06eed9f5
PC
459 __glibcxx_check_insert(__position);
460 _Base_iterator __res = _Base::insert(__position.base(), __l);
988499f4 461 this->_M_invalidate_all();
06eed9f5 462 return iterator(__res, this);
988499f4 463 }
7ffec97f
CJ
464#endif
465
06eed9f5
PC
466#if __cplusplus >= 201103L
467 iterator
468 insert(const_iterator __position, size_type __n, const _Tp& __x)
469 {
470 __glibcxx_check_insert(__position);
471 _Base_iterator __res = _Base::insert(__position.base(), __n, __x);
472 this->_M_invalidate_all();
473 return iterator(__res, this);
474 }
475#else
526da49c 476 void
285b36d6
BK
477 insert(iterator __position, size_type __n, const _Tp& __x)
478 {
479 __glibcxx_check_insert(__position);
480 _Base::insert(__position.base(), __n, __x);
481 this->_M_invalidate_all();
482 }
06eed9f5 483#endif
526da49c 484
734f5023 485#if __cplusplus >= 201103L
2203cb90
PC
486 template<class _InputIterator,
487 typename = std::_RequireInputIter<_InputIterator>>
06eed9f5 488 iterator
15ee1a77 489 insert(const_iterator __position,
06eed9f5 490 _InputIterator __first, _InputIterator __last)
15ee1a77 491 {
24167c42
FD
492 typename __gnu_debug::_Distance_traits<_InputIterator>::__type __dist;
493 __glibcxx_check_insert_range(__position, __first, __last, __dist);
494 _Base_iterator __res;
495 if (__dist.second >= __gnu_debug::__dp_sign)
496 __res = _Base::insert(__position.base(),
497 __gnu_debug::__unsafe(__first),
498 __gnu_debug::__unsafe(__last));
499 else
500 __res = _Base::insert(__position.base(), __first, __last);
501
06eed9f5
PC
502 this->_M_invalidate_all();
503 return iterator(__res, this);
504 }
2203cb90 505#else
285b36d6 506 template<class _InputIterator>
15ee1a77
FD
507 void
508 insert(iterator __position,
285b36d6 509 _InputIterator __first, _InputIterator __last)
15ee1a77 510 {
24167c42
FD
511 typename __gnu_debug::_Distance_traits<_InputIterator>::__type __dist;
512 __glibcxx_check_insert_range(__position, __first, __last, __dist);
513
514 if (__dist.second >= __gnu_debug::__dp_sign)
515 _Base::insert(__position.base(),
516 __gnu_debug::__unsafe(__first),
517 __gnu_debug::__unsafe(__last));
518 else
519 _Base::insert(__position.base(), __first, __last);
520
285b36d6
BK
521 this->_M_invalidate_all();
522 }
06eed9f5 523#endif
526da49c
BI
524
525 void
d15ac9d9 526 pop_front() _GLIBCXX_NOEXCEPT
285b36d6
BK
527 {
528 __glibcxx_check_nonempty();
afe96d41 529 this->_M_invalidate_if(_Equal(_Base::begin()));
285b36d6
BK
530 _Base::pop_front();
531 }
526da49c
BI
532
533 void
d15ac9d9 534 pop_back() _GLIBCXX_NOEXCEPT
285b36d6
BK
535 {
536 __glibcxx_check_nonempty();
afe96d41 537 this->_M_invalidate_if(_Equal(--_Base::end()));
285b36d6
BK
538 _Base::pop_back();
539 }
526da49c
BI
540
541 iterator
94938aec
PC
542#if __cplusplus >= 201103L
543 erase(const_iterator __position)
544#else
545 erase(iterator __position)
546#endif
285b36d6
BK
547 {
548 __glibcxx_check_erase(__position);
94938aec
PC
549#if __cplusplus >= 201103L
550 _Base_const_iterator __victim = __position.base();
551#else
afe96d41 552 _Base_iterator __victim = __position.base();
94938aec
PC
553#endif
554 if (__victim == _Base::begin() || __victim == _Base::end() - 1)
285b36d6 555 {
afe96d41
FD
556 this->_M_invalidate_if(_Equal(__victim));
557 return iterator(_Base::erase(__victim), this);
285b36d6
BK
558 }
559 else
560 {
afe96d41 561 _Base_iterator __res = _Base::erase(__victim);
285b36d6
BK
562 this->_M_invalidate_all();
563 return iterator(__res, this);
564 }
565 }
526da49c
BI
566
567 iterator
94938aec
PC
568#if __cplusplus >= 201103L
569 erase(const_iterator __first, const_iterator __last)
570#else
285b36d6 571 erase(iterator __first, iterator __last)
94938aec 572#endif
285b36d6
BK
573 {
574 // _GLIBCXX_RESOLVE_LIB_DEFECTS
575 // 151. can't currently clear() empty container
576 __glibcxx_check_erase_range(__first, __last);
a7cee01d 577
cdfa3dbb 578 if (__first.base() == __last.base())
94938aec
PC
579#if __cplusplus >= 201103L
580 return iterator(__first.base()._M_const_cast(), this);
581#else
a7cee01d 582 return __first;
94938aec 583#endif
15ee1a77 584 else if (__first.base() == _Base::begin()
a7cee01d 585 || __last.base() == _Base::end())
285b36d6
BK
586 {
587 this->_M_detach_singular();
94938aec 588 for (_Base_const_iterator __position = __first.base();
afe96d41 589 __position != __last.base(); ++__position)
285b36d6 590 {
afe96d41 591 this->_M_invalidate_if(_Equal(__position));
285b36d6 592 }
bc2631e0 593 __try
526da49c 594 {
285b36d6 595 return iterator(_Base::erase(__first.base(), __last.base()),
526da49c 596 this);
285b36d6 597 }
bc2631e0 598 __catch(...)
285b36d6
BK
599 {
600 this->_M_revalidate_singular();
601 __throw_exception_again;
602 }
603 }
604 else
605 {
afe96d41
FD
606 _Base_iterator __res = _Base::erase(__first.base(),
607 __last.base());
285b36d6
BK
608 this->_M_invalidate_all();
609 return iterator(__res, this);
610 }
611 }
526da49c
BI
612
613 void
15ee1a77 614 swap(deque& __x)
c5d9ec56 615 _GLIBCXX_NOEXCEPT_IF( noexcept(declval<_Base&>().swap(__x)) )
285b36d6 616 {
15ee1a77 617 _Safe::_M_swap(__x);
285b36d6 618 _Base::swap(__x);
285b36d6 619 }
526da49c
BI
620
621 void
d3677132 622 clear() _GLIBCXX_NOEXCEPT
285b36d6
BK
623 {
624 _Base::clear();
625 this->_M_invalidate_all();
626 }
526da49c
BI
627
628 _Base&
15ee1a77 629 _M_base() _GLIBCXX_NOEXCEPT { return *this; }
285b36d6 630
526da49c 631 const _Base&
15ee1a77 632 _M_base() const _GLIBCXX_NOEXCEPT { return *this; }
285b36d6
BK
633 };
634
957f5fea
VV
635#if __cpp_deduction_guides >= 201606
636 template<typename _InputIterator, typename _ValT
637 = typename iterator_traits<_InputIterator>::value_type,
638 typename _Allocator = allocator<_ValT>,
639 typename = _RequireInputIter<_InputIterator>,
640 typename = _RequireAllocator<_Allocator>>
641 deque(_InputIterator, _InputIterator, _Allocator = _Allocator())
642 -> deque<_ValT, _Allocator>;
643#endif
644
285b36d6
BK
645 template<typename _Tp, typename _Alloc>
646 inline bool
526da49c 647 operator==(const deque<_Tp, _Alloc>& __lhs,
285b36d6
BK
648 const deque<_Tp, _Alloc>& __rhs)
649 { return __lhs._M_base() == __rhs._M_base(); }
650
651 template<typename _Tp, typename _Alloc>
652 inline bool
526da49c 653 operator!=(const deque<_Tp, _Alloc>& __lhs,
285b36d6
BK
654 const deque<_Tp, _Alloc>& __rhs)
655 { return __lhs._M_base() != __rhs._M_base(); }
656
657 template<typename _Tp, typename _Alloc>
658 inline bool
ed540c0a
CJ
659 operator<(const deque<_Tp, _Alloc>& __lhs,
660 const deque<_Tp, _Alloc>& __rhs)
285b36d6
BK
661 { return __lhs._M_base() < __rhs._M_base(); }
662
663 template<typename _Tp, typename _Alloc>
664 inline bool
526da49c 665 operator<=(const deque<_Tp, _Alloc>& __lhs,
285b36d6
BK
666 const deque<_Tp, _Alloc>& __rhs)
667 { return __lhs._M_base() <= __rhs._M_base(); }
668
669 template<typename _Tp, typename _Alloc>
670 inline bool
526da49c 671 operator>=(const deque<_Tp, _Alloc>& __lhs,
285b36d6
BK
672 const deque<_Tp, _Alloc>& __rhs)
673 { return __lhs._M_base() >= __rhs._M_base(); }
674
675 template<typename _Tp, typename _Alloc>
676 inline bool
ed540c0a
CJ
677 operator>(const deque<_Tp, _Alloc>& __lhs,
678 const deque<_Tp, _Alloc>& __rhs)
285b36d6
BK
679 { return __lhs._M_base() > __rhs._M_base(); }
680
681 template<typename _Tp, typename _Alloc>
682 inline void
683 swap(deque<_Tp, _Alloc>& __lhs, deque<_Tp, _Alloc>& __rhs)
c5d9ec56 684 _GLIBCXX_NOEXCEPT_IF(noexcept(__lhs.swap(__rhs)))
285b36d6 685 { __lhs.swap(__rhs); }
ed540c0a 686
45f388bb 687} // namespace __debug
3cbc7af0 688} // namespace std
285b36d6
BK
689
690#endif