52 deque<_Tp, _Allocator>, _Allocator,
53 __gnu_debug::_Safe_sequence>,
54 public _GLIBCXX_STD_C::deque<_Tp, _Allocator>
56 typedef _GLIBCXX_STD_C::deque<_Tp, _Allocator> _Base;
60 typedef typename _Base::const_iterator _Base_const_iterator;
61 typedef typename _Base::iterator _Base_iterator;
64 template<
typename _ItT,
typename _SeqT,
typename _CatT>
65 friend class ::__gnu_debug::_Safe_iterator;
72 _Base_ref(
const _Base& __r) : _M_ref(__r) { }
78 typedef typename _Base::reference reference;
79 typedef typename _Base::const_reference const_reference;
86 typedef typename _Base::size_type size_type;
87 typedef typename _Base::difference_type difference_type;
89 typedef _Tp value_type;
90 typedef _Allocator allocator_type;
91 typedef typename _Base::pointer pointer;
92 typedef typename _Base::const_pointer const_pointer;
98#if __cplusplus < 201103L
102 deque(
const deque& __x)
108 deque(
const deque&) =
default;
109 deque(deque&&) =
default;
111 deque(
const deque& __d,
const _Allocator& __a)
112 : _Base(__d, __a) { }
114 deque(deque&& __d,
const _Allocator& __a)
118 const allocator_type& __a = allocator_type())
119 : _Base(__l, __a) { }
125 deque(
const _Allocator& __a)
128#if __cplusplus >= 201103L
130 deque(size_type __n,
const _Allocator& __a = _Allocator())
131 : _Base(__n, __a) { }
133 deque(size_type __n,
const __type_identity_t<_Tp>& __value,
134 const _Allocator& __a = _Allocator())
135 : _Base(__n, __value, __a) { }
138 deque(size_type __n,
const _Tp& __value = _Tp(),
139 const _Allocator& __a = _Allocator())
140 : _Base(__n, __value, __a) { }
143#if __cplusplus >= 201103L
144 template<
class _InputIterator,
145 typename = std::_RequireInputIter<_InputIterator>>
147 template<
class _InputIterator>
149 deque(_InputIterator __first, _InputIterator __last,
150 const _Allocator& __a = _Allocator())
152 __glibcxx_check_valid_constructor_range(__first, __last)),
157 : _Base(__x._M_ref) { }
159#if __cplusplus < 201103L
161 operator=(
const deque& __x)
163 this->_M_safe() = __x;
169 operator=(
const deque&) =
default;
172 operator=(deque&&) =
default;
178 this->_M_invalidate_all();
183#if __cplusplus >= 201103L
184 template<
class _InputIterator,
185 typename = std::_RequireInputIter<_InputIterator>>
187 template<
class _InputIterator>
190 assign(_InputIterator __first, _InputIterator __last)
192 typename __gnu_debug::_Distance_traits<_InputIterator>::__type __dist;
193 __glibcxx_check_valid_range2(__first, __last, __dist);
194 if (__dist.second >= __gnu_debug::__dp_sign)
195 _Base::assign(__gnu_debug::__unsafe(__first),
196 __gnu_debug::__unsafe(__last));
198 _Base::assign(__first, __last);
200 this->_M_invalidate_all();
204 assign(size_type __n,
const _Tp& __t)
206 _Base::assign(__n, __t);
207 this->_M_invalidate_all();
210#if __cplusplus >= 201103L
215 this->_M_invalidate_all();
219 using _Base::get_allocator;
223 begin() _GLIBCXX_NOEXCEPT
224 {
return iterator(_Base::begin(),
this); }
227 begin()
const _GLIBCXX_NOEXCEPT
228 {
return const_iterator(_Base::begin(),
this); }
231 end() _GLIBCXX_NOEXCEPT
232 {
return iterator(_Base::end(),
this); }
235 end()
const _GLIBCXX_NOEXCEPT
236 {
return const_iterator(_Base::end(),
this); }
239 rbegin() _GLIBCXX_NOEXCEPT
240 {
return reverse_iterator(end()); }
242 const_reverse_iterator
243 rbegin()
const _GLIBCXX_NOEXCEPT
244 {
return const_reverse_iterator(end()); }
247 rend() _GLIBCXX_NOEXCEPT
248 {
return reverse_iterator(begin()); }
250 const_reverse_iterator
251 rend()
const _GLIBCXX_NOEXCEPT
252 {
return const_reverse_iterator(begin()); }
254#if __cplusplus >= 201103L
256 cbegin()
const noexcept
257 {
return const_iterator(_Base::begin(),
this); }
260 cend()
const noexcept
261 {
return const_iterator(_Base::end(),
this); }
263 const_reverse_iterator
264 crbegin()
const noexcept
265 {
return const_reverse_iterator(end()); }
267 const_reverse_iterator
268 crend()
const noexcept
269 {
return const_reverse_iterator(begin()); }
274 _M_invalidate_after_nth(difference_type __n)
277 this->_M_invalidate_if(_After_nth(__n, _Base::begin()));
283 using _Base::max_size;
285#if __cplusplus >= 201103L
287 resize(size_type __sz)
289 bool __invalidate_all = __sz > this->
size();
290 if (__sz < this->
size())
291 this->_M_invalidate_after_nth(__sz);
295 if (__invalidate_all)
296 this->_M_invalidate_all();
300 resize(size_type __sz,
const _Tp& __c)
302 bool __invalidate_all = __sz > this->
size();
303 if (__sz < this->
size())
304 this->_M_invalidate_after_nth(__sz);
306 _Base::resize(__sz, __c);
308 if (__invalidate_all)
309 this->_M_invalidate_all();
313 resize(size_type __sz, _Tp __c = _Tp())
315 bool __invalidate_all = __sz > this->
size();
316 if (__sz < this->
size())
317 this->_M_invalidate_after_nth(__sz);
319 _Base::resize(__sz, __c);
321 if (__invalidate_all)
322 this->_M_invalidate_all();
326#if __cplusplus >= 201103L
328 shrink_to_fit()
noexcept
330 if (_Base::_M_shrink_to_fit())
331 this->_M_invalidate_all();
339 operator[](size_type __n) _GLIBCXX_NOEXCEPT
341 __glibcxx_check_subscript(__n);
342 return _M_base()[__n];
346 operator[](size_type __n)
const _GLIBCXX_NOEXCEPT
348 __glibcxx_check_subscript(__n);
349 return _M_base()[__n];
355 front() _GLIBCXX_NOEXCEPT
357 __glibcxx_check_nonempty();
358 return _Base::front();
362 front()
const _GLIBCXX_NOEXCEPT
364 __glibcxx_check_nonempty();
365 return _Base::front();
369 back() _GLIBCXX_NOEXCEPT
371 __glibcxx_check_nonempty();
372 return _Base::back();
376 back()
const _GLIBCXX_NOEXCEPT
378 __glibcxx_check_nonempty();
379 return _Base::back();
384 push_front(
const _Tp& __x)
386 _Base::push_front(__x);
387 this->_M_invalidate_all();
391 push_back(
const _Tp& __x)
393 _Base::push_back(__x);
394 this->_M_invalidate_all();
397#if __cplusplus >= 201103L
399 push_front(_Tp&& __x)
406 template<
typename... _Args>
407#if __cplusplus > 201402L
412 emplace_front(_Args&&... __args)
415 this->_M_invalidate_all();
416#if __cplusplus > 201402L
421 template<
typename... _Args>
422#if __cplusplus > 201402L
427 emplace_back(_Args&&... __args)
430 this->_M_invalidate_all();
431#if __cplusplus > 201402L
436 template<
typename... _Args>
438 emplace(const_iterator __position, _Args&&... __args)
441 _Base_iterator __res = _Base::emplace(__position.
base(),
443 this->_M_invalidate_all();
444 return iterator(__res,
this);
449#if __cplusplus >= 201103L
450 insert(const_iterator __position,
const _Tp& __x)
452 insert(iterator __position,
const _Tp& __x)
456 _Base_iterator __res = _Base::insert(__position.
base(), __x);
457 this->_M_invalidate_all();
458 return iterator(__res,
this);
461#if __cplusplus >= 201103L
463 insert(const_iterator __position, _Tp&& __x)
464 {
return emplace(__position,
std::move(__x)); }
470 _Base_iterator __res = _Base::insert(__position.
base(), __l);
471 this->_M_invalidate_all();
472 return iterator(__res,
this);
476#if __cplusplus >= 201103L
478 insert(const_iterator __position, size_type __n,
const _Tp& __x)
481 _Base_iterator __res = _Base::insert(__position.
base(), __n, __x);
482 this->_M_invalidate_all();
483 return iterator(__res,
this);
487 insert(iterator __position, size_type __n,
const _Tp& __x)
490 _Base::insert(__position.
base(), __n, __x);
491 this->_M_invalidate_all();
495#if __cplusplus >= 201103L
496 template<
class _InputIterator,
497 typename = std::_RequireInputIter<_InputIterator>>
499 insert(const_iterator __position,
500 _InputIterator __first, _InputIterator __last)
502 typename __gnu_debug::_Distance_traits<_InputIterator>::__type __dist;
504 _Base_iterator __res;
505 if (__dist.second >= __gnu_debug::__dp_sign)
506 __res = _Base::insert(__position.
base(),
507 __gnu_debug::__unsafe(__first),
508 __gnu_debug::__unsafe(__last));
510 __res = _Base::insert(__position.
base(), __first, __last);
512 this->_M_invalidate_all();
513 return iterator(__res,
this);
516 template<
class _InputIterator>
518 insert(iterator __position,
519 _InputIterator __first, _InputIterator __last)
521 typename __gnu_debug::_Distance_traits<_InputIterator>::__type __dist;
524 if (__dist.second >= __gnu_debug::__dp_sign)
525 _Base::insert(__position.
base(),
526 __gnu_debug::__unsafe(__first),
527 __gnu_debug::__unsafe(__last));
529 _Base::insert(__position.
base(), __first, __last);
531 this->_M_invalidate_all();
536 pop_front() _GLIBCXX_NOEXCEPT
538 __glibcxx_check_nonempty();
539 this->_M_invalidate_if(_Equal(_Base::begin()));
544 pop_back() _GLIBCXX_NOEXCEPT
546 __glibcxx_check_nonempty();
547 this->_M_invalidate_if(_Equal(--_Base::end()));
552#if __cplusplus >= 201103L
553 erase(const_iterator __position)
555 erase(iterator __position)
559#if __cplusplus >= 201103L
560 _Base_const_iterator __victim = __position.
base();
562 _Base_iterator __victim = __position.
base();
564 if (__victim == _Base::begin() || __victim == _Base::end() - 1)
566 this->_M_invalidate_if(_Equal(__victim));
567 return iterator(_Base::erase(__victim),
this);
571 _Base_iterator __res = _Base::erase(__victim);
572 this->_M_invalidate_all();
573 return iterator(__res,
this);
578#if __cplusplus >= 201103L
579 erase(const_iterator __first, const_iterator __last)
581 erase(iterator __first, iterator __last)
588 if (__first.base() == __last.base())
589#if __cplusplus >= 201103L
590 return iterator(__first.base()._M_const_cast(),
this);
594 else if (__first.base() == _Base::begin()
595 || __last.base() == _Base::end())
597 this->_M_detach_singular();
598 for (_Base_const_iterator __position = __first.
base();
599 __position != __last.
base(); ++__position)
601 this->_M_invalidate_if(_Equal(__position));
605 return iterator(_Base::erase(__first.base(), __last.base()),
610 this->_M_revalidate_singular();
611 __throw_exception_again;
616 _Base_iterator __res = _Base::erase(__first.base(),
618 this->_M_invalidate_all();
619 return iterator(__res,
this);
632 clear() _GLIBCXX_NOEXCEPT
635 this->_M_invalidate_all();
639 _M_base() _GLIBCXX_NOEXCEPT {
return *
this; }
642 _M_base()
const _GLIBCXX_NOEXCEPT {
return *
this; }