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 __type_identity_t<_Allocator>& __a)
112 : _Base(__d, __a) { }
114 deque(deque&& __d,
const __type_identity_t<_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&) =
default;
164 operator=(deque&&) =
default;
169 _Base::operator=(__l);
170 this->_M_invalidate_all();
175#if __cplusplus >= 201103L
176 template<
class _InputIterator,
177 typename = std::_RequireInputIter<_InputIterator>>
179 template<
class _InputIterator>
182 assign(_InputIterator __first, _InputIterator __last)
184 typename __gnu_debug::_Distance_traits<_InputIterator>::__type __dist;
185 __glibcxx_check_valid_range2(__first, __last, __dist);
186 if (__dist.second >= __gnu_debug::__dp_sign)
187 _Base::assign(__gnu_debug::__unsafe(__first),
188 __gnu_debug::__unsafe(__last));
190 _Base::assign(__first, __last);
192 this->_M_invalidate_all();
196 assign(size_type __n,
const _Tp& __t)
198 _Base::assign(__n, __t);
199 this->_M_invalidate_all();
202#if __cplusplus >= 201103L
207 this->_M_invalidate_all();
211 using _Base::get_allocator;
216 begin() _GLIBCXX_NOEXCEPT
217 {
return iterator(_Base::begin(),
this); }
221 begin()
const _GLIBCXX_NOEXCEPT
222 {
return const_iterator(_Base::begin(),
this); }
226 end() _GLIBCXX_NOEXCEPT
227 {
return iterator(_Base::end(),
this); }
231 end()
const _GLIBCXX_NOEXCEPT
232 {
return const_iterator(_Base::end(),
this); }
236 rbegin() _GLIBCXX_NOEXCEPT
237 {
return reverse_iterator(end()); }
240 const_reverse_iterator
241 rbegin()
const _GLIBCXX_NOEXCEPT
242 {
return const_reverse_iterator(end()); }
246 rend() _GLIBCXX_NOEXCEPT
247 {
return reverse_iterator(begin()); }
250 const_reverse_iterator
251 rend()
const _GLIBCXX_NOEXCEPT
252 {
return const_reverse_iterator(begin()); }
254#if __cplusplus >= 201103L
257 cbegin()
const noexcept
258 {
return const_iterator(_Base::begin(),
this); }
262 cend()
const noexcept
263 {
return const_iterator(_Base::end(),
this); }
266 const_reverse_iterator
267 crbegin()
const noexcept
268 {
return const_reverse_iterator(end()); }
271 const_reverse_iterator
272 crend()
const noexcept
273 {
return const_reverse_iterator(begin()); }
278 _M_invalidate_after_nth(difference_type __n)
281 this->_M_invalidate_if(_After_nth(__n, _Base::begin()));
287 using _Base::max_size;
289#if __cplusplus >= 201103L
291 resize(size_type __sz)
293 bool __invalidate_all = __sz > this->
size();
294 if (__sz < this->
size())
295 this->_M_invalidate_after_nth(__sz);
299 if (__invalidate_all)
300 this->_M_invalidate_all();
304 resize(size_type __sz,
const _Tp& __c)
306 bool __invalidate_all = __sz > this->
size();
307 if (__sz < this->
size())
308 this->_M_invalidate_after_nth(__sz);
310 _Base::resize(__sz, __c);
312 if (__invalidate_all)
313 this->_M_invalidate_all();
317 resize(size_type __sz, _Tp __c = _Tp())
319 bool __invalidate_all = __sz > this->
size();
320 if (__sz < this->
size())
321 this->_M_invalidate_after_nth(__sz);
323 _Base::resize(__sz, __c);
325 if (__invalidate_all)
326 this->_M_invalidate_all();
330#if __cplusplus >= 201103L
332 shrink_to_fit()
noexcept
334 if (_Base::_M_shrink_to_fit())
335 this->_M_invalidate_all();
344 operator[](size_type __n) _GLIBCXX_NOEXCEPT
346 __glibcxx_check_subscript(__n);
347 return _Base::operator[](__n);
352 operator[](size_type __n)
const _GLIBCXX_NOEXCEPT
354 __glibcxx_check_subscript(__n);
355 return _Base::operator[](__n);
362 front() _GLIBCXX_NOEXCEPT
364 __glibcxx_check_nonempty();
365 return _Base::front();
370 front()
const _GLIBCXX_NOEXCEPT
372 __glibcxx_check_nonempty();
373 return _Base::front();
378 back() _GLIBCXX_NOEXCEPT
380 __glibcxx_check_nonempty();
381 return _Base::back();
386 back()
const _GLIBCXX_NOEXCEPT
388 __glibcxx_check_nonempty();
389 return _Base::back();
394 push_front(
const _Tp& __x)
396 _Base::push_front(__x);
397 this->_M_invalidate_all();
401 push_back(
const _Tp& __x)
403 _Base::push_back(__x);
404 this->_M_invalidate_all();
407#if __cplusplus >= 201103L
409 push_front(_Tp&& __x)
416 template<
typename... _Args>
417#if __cplusplus > 201402L
422 emplace_front(_Args&&... __args)
425 this->_M_invalidate_all();
426#if __cplusplus > 201402L
431 template<
typename... _Args>
432#if __cplusplus > 201402L
437 emplace_back(_Args&&... __args)
440 this->_M_invalidate_all();
441#if __cplusplus > 201402L
446 template<
typename... _Args>
448 emplace(const_iterator __position, _Args&&... __args)
451 _Base_iterator __res = _Base::emplace(__position.
base(),
453 this->_M_invalidate_all();
454 return iterator(__res,
this);
459#if __cplusplus >= 201103L
460 insert(const_iterator __position,
const _Tp& __x)
462 insert(iterator __position,
const _Tp& __x)
466 _Base_iterator __res = _Base::insert(__position.
base(), __x);
467 this->_M_invalidate_all();
468 return iterator(__res,
this);
471#if __cplusplus >= 201103L
473 insert(const_iterator __position, _Tp&& __x)
474 {
return emplace(__position,
std::move(__x)); }
480 _Base_iterator __res = _Base::insert(__position.
base(), __l);
481 this->_M_invalidate_all();
482 return iterator(__res,
this);
486#if __cplusplus >= 201103L
488 insert(const_iterator __position, size_type __n,
const _Tp& __x)
491 _Base_iterator __res = _Base::insert(__position.
base(), __n, __x);
492 this->_M_invalidate_all();
493 return iterator(__res,
this);
497 insert(iterator __position, size_type __n,
const _Tp& __x)
500 _Base::insert(__position.
base(), __n, __x);
501 this->_M_invalidate_all();
505#if __cplusplus >= 201103L
506 template<
class _InputIterator,
507 typename = std::_RequireInputIter<_InputIterator>>
509 insert(const_iterator __position,
510 _InputIterator __first, _InputIterator __last)
512 typename __gnu_debug::_Distance_traits<_InputIterator>::__type __dist;
514 _Base_iterator __res;
515 if (__dist.second >= __gnu_debug::__dp_sign)
516 __res = _Base::insert(__position.
base(),
517 __gnu_debug::__unsafe(__first),
518 __gnu_debug::__unsafe(__last));
520 __res = _Base::insert(__position.
base(), __first, __last);
522 this->_M_invalidate_all();
523 return iterator(__res,
this);
526 template<
class _InputIterator>
528 insert(iterator __position,
529 _InputIterator __first, _InputIterator __last)
531 typename __gnu_debug::_Distance_traits<_InputIterator>::__type __dist;
534 if (__dist.second >= __gnu_debug::__dp_sign)
535 _Base::insert(__position.
base(),
536 __gnu_debug::__unsafe(__first),
537 __gnu_debug::__unsafe(__last));
539 _Base::insert(__position.
base(), __first, __last);
541 this->_M_invalidate_all();
546 pop_front() _GLIBCXX_NOEXCEPT
548 __glibcxx_check_nonempty();
549 this->_M_invalidate_if(_Equal(_Base::begin()));
554 pop_back() _GLIBCXX_NOEXCEPT
556 __glibcxx_check_nonempty();
557 this->_M_invalidate_if(_Equal(--_Base::end()));
562#if __cplusplus >= 201103L
563 erase(const_iterator __position)
565 erase(iterator __position)
569#if __cplusplus >= 201103L
570 _Base_const_iterator __victim = __position.
base();
572 _Base_iterator __victim = __position.
base();
574 if (__victim == _Base::begin() || __victim == _Base::end() - 1)
576 this->_M_invalidate_if(_Equal(__victim));
577 return iterator(_Base::erase(__victim),
this);
581 _Base_iterator __res = _Base::erase(__victim);
582 this->_M_invalidate_all();
583 return iterator(__res,
this);
588#if __cplusplus >= 201103L
589 erase(const_iterator __first, const_iterator __last)
591 erase(iterator __first, iterator __last)
598 if (__first.base() == __last.base())
599#if __cplusplus >= 201103L
600 return iterator(__first.base()._M_const_cast(),
this);
604 else if (__first.base() == _Base::begin()
605 || __last.base() == _Base::end())
607 this->_M_detach_singular();
608 for (_Base_const_iterator __position = __first.
base();
609 __position != __last.
base(); ++__position)
611 this->_M_invalidate_if(_Equal(__position));
615 return iterator(_Base::erase(__first.base(), __last.base()),
620 this->_M_revalidate_singular();
621 __throw_exception_again;
626 _Base_iterator __res = _Base::erase(__first.base(),
628 this->_M_invalidate_all();
629 return iterator(__res,
this);
642 clear() _GLIBCXX_NOEXCEPT
645 this->_M_invalidate_all();
649 _M_base() _GLIBCXX_NOEXCEPT {
return *
this; }
652 _M_base()
const _GLIBCXX_NOEXCEPT {
return *
this; }