29 #ifndef _GLIBCXX_DEBUG_DEQUE
30 #define _GLIBCXX_DEBUG_DEQUE 1
36 namespace std _GLIBCXX_VISIBILITY(default)
41 template<
typename _Tp,
typename _Allocator = std::allocator<_Tp> >
43 :
public _GLIBCXX_STD_C::deque<_Tp, _Allocator>,
46 typedef _GLIBCXX_STD_C::deque<_Tp, _Allocator>
_Base;
52 typedef typename _Base::reference reference;
53 typedef typename _Base::const_reference const_reference;
60 typedef typename _Base::size_type size_type;
61 typedef typename _Base::difference_type difference_type;
63 typedef _Tp value_type;
64 typedef _Allocator allocator_type;
65 typedef typename _Base::pointer pointer;
66 typedef typename _Base::const_pointer const_pointer;
72 deque(
const _Allocator& __a = _Allocator())
75 #if __cplusplus >= 201103L
80 deque(size_type __n,
const _Tp& __value,
81 const _Allocator& __a = _Allocator())
82 :
_Base(__n, __value, __a) { }
85 deque(size_type __n,
const _Tp& __value = _Tp(),
86 const _Allocator& __a = _Allocator())
87 :
_Base(__n, __value, __a) { }
90 #if __cplusplus >= 201103L
91 template<
class _InputIterator,
92 typename = std::_RequireInputIter<_InputIterator>>
94 template<
class _InputIterator>
96 deque(_InputIterator __first, _InputIterator __last,
97 const _Allocator& __a = _Allocator())
103 deque(
const deque& __x)
106 deque(
const _Base& __x)
109 #if __cplusplus >= 201103L
111 :
_Base(std::move(__x))
115 const allocator_type& __a = allocator_type())
116 :
_Base(__l, __a) { }
119 ~deque() _GLIBCXX_NOEXCEPT { }
122 operator=(
const deque& __x)
124 *
static_cast<_Base*
>(
this) = __x;
129 #if __cplusplus >= 201103L
131 operator=(deque&& __x)
135 __glibcxx_check_self_move_assign(__x);
144 *
static_cast<_Base*
>(
this) = __l;
150 #if __cplusplus >= 201103L
151 template<
class _InputIterator,
152 typename = std::_RequireInputIter<_InputIterator>>
154 template<
class _InputIterator>
157 assign(_InputIterator __first, _InputIterator __last)
159 __glibcxx_check_valid_range(__first, __last);
166 assign(size_type __n,
const _Tp& __t)
168 _Base::assign(__n, __t);
172 #if __cplusplus >= 201103L
181 using _Base::get_allocator;
185 begin() _GLIBCXX_NOEXCEPT
186 {
return iterator(_Base::begin(),
this); }
189 begin()
const _GLIBCXX_NOEXCEPT
193 end() _GLIBCXX_NOEXCEPT
194 {
return iterator(_Base::end(),
this); }
197 end()
const _GLIBCXX_NOEXCEPT
201 rbegin() _GLIBCXX_NOEXCEPT
205 rbegin()
const _GLIBCXX_NOEXCEPT
209 rend() _GLIBCXX_NOEXCEPT
213 rend()
const _GLIBCXX_NOEXCEPT
216 #if __cplusplus >= 201103L
218 cbegin()
const noexcept
222 cend()
const noexcept
226 crbegin()
const noexcept
230 crend()
const noexcept
236 _M_invalidate_after_nth(difference_type __n)
245 using _Base::max_size;
247 #if __cplusplus >= 201103L
249 resize(size_type __sz)
251 bool __invalidate_all = __sz > this->
size();
252 if (__sz < this->
size())
253 this->_M_invalidate_after_nth(__sz);
257 if (__invalidate_all)
262 resize(size_type __sz,
const _Tp& __c)
264 bool __invalidate_all = __sz > this->
size();
265 if (__sz < this->
size())
266 this->_M_invalidate_after_nth(__sz);
268 _Base::resize(__sz, __c);
270 if (__invalidate_all)
275 resize(size_type __sz, _Tp __c = _Tp())
277 bool __invalidate_all = __sz > this->
size();
278 if (__sz < this->
size())
279 this->_M_invalidate_after_nth(__sz);
281 _Base::resize(__sz, __c);
283 if (__invalidate_all)
288 #if __cplusplus >= 201103L
292 if (_Base::_M_shrink_to_fit())
301 operator[](size_type __n)
303 __glibcxx_check_subscript(__n);
304 return _M_base()[__n];
308 operator[](size_type __n)
const
310 __glibcxx_check_subscript(__n);
311 return _M_base()[__n];
319 __glibcxx_check_nonempty();
320 return _Base::front();
326 __glibcxx_check_nonempty();
327 return _Base::front();
333 __glibcxx_check_nonempty();
334 return _Base::back();
340 __glibcxx_check_nonempty();
341 return _Base::back();
346 push_front(
const _Tp& __x)
348 _Base::push_front(__x);
353 push_back(
const _Tp& __x)
355 _Base::push_back(__x);
359 #if __cplusplus >= 201103L
361 push_front(_Tp&& __x)
362 { emplace_front(std::move(__x)); }
366 { emplace_back(std::move(__x)); }
368 template<
typename... _Args>
370 emplace_front(_Args&&... __args)
372 _Base::emplace_front(std::forward<_Args>(__args)...);
376 template<
typename... _Args>
378 emplace_back(_Args&&... __args)
380 _Base::emplace_back(std::forward<_Args>(__args)...);
384 template<
typename... _Args>
386 emplace(
iterator __position, _Args&&... __args)
390 std::forward<_Args>(__args)...);
397 insert(
iterator __position,
const _Tp& __x)
405 #if __cplusplus >= 201103L
407 insert(
iterator __position, _Tp&& __x)
408 {
return emplace(__position, std::move(__x)); }
413 _Base::insert(__p, __l);
419 insert(
iterator __position, size_type __n,
const _Tp& __x)
422 _Base::insert(__position.
base(), __n, __x);
426 #if __cplusplus >= 201103L
427 template<
class _InputIterator,
428 typename = std::_RequireInputIter<_InputIterator>>
430 template<
class _InputIterator>
434 _InputIterator __first, _InputIterator __last)
445 __glibcxx_check_nonempty();
453 __glibcxx_check_nonempty();
463 if (__victim == _Base::begin() || __victim == _Base::end()-1)
466 return iterator(_Base::erase(__victim),
this);
483 if (__first.
base() == __last.
base())
485 else if (__first.
base() == _Base::begin()
486 || __last.
base() == _Base::end())
490 __position != __last.
base(); ++__position)
502 __throw_exception_again;
522 clear() _GLIBCXX_NOEXCEPT
529 _M_base() _GLIBCXX_NOEXCEPT {
return *
this; }
532 _M_base()
const _GLIBCXX_NOEXCEPT {
return *
this; }
535 template<
typename _Tp,
typename _Alloc>
539 {
return __lhs._M_base() == __rhs._M_base(); }
541 template<
typename _Tp,
typename _Alloc>
545 {
return __lhs._M_base() != __rhs._M_base(); }
547 template<
typename _Tp,
typename _Alloc>
549 operator<(const deque<_Tp, _Alloc>& __lhs,
550 const deque<_Tp, _Alloc>& __rhs)
551 {
return __lhs._M_base() < __rhs._M_base(); }
553 template<
typename _Tp,
typename _Alloc>
555 operator<=(const deque<_Tp, _Alloc>& __lhs,
556 const deque<_Tp, _Alloc>& __rhs)
557 {
return __lhs._M_base() <= __rhs._M_base(); }
559 template<
typename _Tp,
typename _Alloc>
561 operator>=(
const deque<_Tp, _Alloc>& __lhs,
562 const deque<_Tp, _Alloc>& __rhs)
563 {
return __lhs._M_base() >= __rhs._M_base(); }
565 template<
typename _Tp,
typename _Alloc>
567 operator>(
const deque<_Tp, _Alloc>& __lhs,
568 const deque<_Tp, _Alloc>& __rhs)
569 {
return __lhs._M_base() > __rhs._M_base(); }
571 template<
typename _Tp,
typename _Alloc>
573 swap(deque<_Tp, _Alloc>& __lhs, deque<_Tp, _Alloc>& __rhs)
574 { __lhs.swap(__rhs); }
A standard container using fixed-size memory allocation and constant-time manipulation of elements at...
void _M_revalidate_singular()
void _M_swap(_Safe_sequence_base &__x)
void _M_invalidate_if(_Predicate __pred)
#define __glibcxx_check_insert_range(_Position, _First, _Last)
_Iterator base() const
Return the underlying iterator.
void _M_detach_singular()
void _M_invalidate_all() const
#define __glibcxx_check_insert(_Position)
_Siter_base< _Iterator >::iterator_type __base(_Iterator __it)
Class std::deque with safety/checking/debug instrumentation.
constexpr size_t size() const noexcept
Returns the total number of bits.
#define __glibcxx_check_erase(_Position)
void swap(function< _Res(_Args...)> &__x, function< _Res(_Args...)> &__y)
Swap the targets of two polymorphic function object wrappers.
Base class for constructing a safe sequence type that tracks iterators that reference it...
#define __glibcxx_check_erase_range(_First, _Last)