30 #ifndef _GLIBCXX_DEBUG_DEQUE
31 #define _GLIBCXX_DEBUG_DEQUE 1
37 namespace std _GLIBCXX_VISIBILITY(default)
42 template<
typename _Tp,
typename _Allocator = std::allocator<_Tp> >
44 :
public _GLIBCXX_STD_C::deque<_Tp, _Allocator>,
47 typedef _GLIBCXX_STD_C::deque<_Tp, _Allocator>
_Base;
54 typedef typename _Base::reference reference;
55 typedef typename _Base::const_reference const_reference;
62 typedef typename _Base::size_type size_type;
63 typedef typename _Base::difference_type difference_type;
65 typedef _Tp value_type;
66 typedef _Allocator allocator_type;
67 typedef typename _Base::pointer pointer;
68 typedef typename _Base::const_pointer const_pointer;
74 deque(
const _Allocator& __a = _Allocator())
77 #ifdef __GXX_EXPERIMENTAL_CXX0X__
82 deque(size_type __n,
const _Tp& __value,
83 const _Allocator& __a = _Allocator())
84 :
_Base(__n, __value, __a) { }
87 deque(size_type __n,
const _Tp& __value = _Tp(),
88 const _Allocator& __a = _Allocator())
89 :
_Base(__n, __value, __a) { }
92 template<
class _InputIterator>
93 deque(_InputIterator __first, _InputIterator __last,
94 const _Allocator& __a = _Allocator())
106 #ifdef __GXX_EXPERIMENTAL_CXX0X__
112 const allocator_type& __a = allocator_type())
119 operator=(
const deque& __x)
121 *
static_cast<_Base*
>(
this) = __x;
126 #ifdef __GXX_EXPERIMENTAL_CXX0X__
128 operator=(
deque&& __x)
140 *
static_cast<_Base*
>(
this) = __l;
146 template<
class _InputIterator>
148 assign(_InputIterator __first, _InputIterator __last)
150 __glibcxx_check_valid_range(__first, __last);
157 assign(size_type __n,
const _Tp& __t)
159 _Base::assign(__n, __t);
163 #ifdef __GXX_EXPERIMENTAL_CXX0X__
172 using _Base::get_allocator;
177 {
return iterator(_Base::begin(),
this); }
185 {
return iterator(_Base::end(),
this); }
207 #ifdef __GXX_EXPERIMENTAL_CXX0X__
227 _M_invalidate_after_nth(difference_type __n)
236 using _Base::max_size;
238 #ifdef __GXX_EXPERIMENTAL_CXX0X__
240 resize(size_type __sz)
242 bool __invalidate_all = __sz > this->
size();
243 if (__sz < this->
size())
244 this->_M_invalidate_after_nth(__sz);
248 if (__invalidate_all)
253 resize(size_type __sz,
const _Tp& __c)
255 bool __invalidate_all = __sz > this->
size();
256 if (__sz < this->
size())
257 this->_M_invalidate_after_nth(__sz);
259 _Base::resize(__sz, __c);
261 if (__invalidate_all)
266 resize(size_type __sz, _Tp __c = _Tp())
268 bool __invalidate_all = __sz > this->
size();
269 if (__sz < this->
size())
270 this->_M_invalidate_after_nth(__sz);
272 _Base::resize(__sz, __c);
274 if (__invalidate_all)
279 #ifdef __GXX_EXPERIMENTAL_CXX0X__
280 using _Base::shrink_to_fit;
287 operator[](size_type __n)
289 __glibcxx_check_subscript(__n);
290 return _M_base()[__n];
294 operator[](size_type __n)
const
296 __glibcxx_check_subscript(__n);
297 return _M_base()[__n];
305 __glibcxx_check_nonempty();
306 return _Base::front();
312 __glibcxx_check_nonempty();
313 return _Base::front();
319 __glibcxx_check_nonempty();
320 return _Base::back();
326 __glibcxx_check_nonempty();
327 return _Base::back();
332 push_front(
const _Tp& __x)
334 _Base::push_front(__x);
339 push_back(
const _Tp& __x)
341 _Base::push_back(__x);
345 #ifdef __GXX_EXPERIMENTAL_CXX0X__
347 push_front(_Tp&& __x)
348 { emplace_front(std::move(__x)); }
352 { emplace_back(std::move(__x)); }
354 template<
typename... _Args>
356 emplace_front(_Args&&... __args)
358 _Base::emplace_front(std::forward<_Args>(__args)...);
362 template<
typename... _Args>
364 emplace_back(_Args&&... __args)
366 _Base::emplace_back(std::forward<_Args>(__args)...);
370 template<
typename... _Args>
372 emplace(
iterator __position, _Args&&... __args)
376 std::forward<_Args>(__args)...);
383 insert(
iterator __position,
const _Tp& __x)
391 #ifdef __GXX_EXPERIMENTAL_CXX0X__
393 insert(
iterator __position, _Tp&& __x)
394 {
return emplace(__position, std::move(__x)); }
399 _Base::insert(__p, __l);
405 insert(
iterator __position, size_type __n,
const _Tp& __x)
408 _Base::insert(__position.
base(), __n, __x);
412 template<
class _InputIterator>
415 _InputIterator __first, _InputIterator __last)
426 __glibcxx_check_nonempty();
434 __glibcxx_check_nonempty();
444 if (__victim == _Base::begin() || __victim == _Base::end()-1)
447 return iterator(_Base::erase(__victim),
this);
464 if (__first.
base() == __last.
base())
466 else if (__first.
base() == _Base::begin()
467 || __last.
base() == _Base::end())
471 __position != __last.
base(); ++__position)
483 __throw_exception_again;
510 _M_base() {
return *
this; }
513 _M_base()
const {
return *
this; }
516 template<
typename _Tp,
typename _Alloc>
520 {
return __lhs._M_base() == __rhs._M_base(); }
522 template<
typename _Tp,
typename _Alloc>
526 {
return __lhs._M_base() != __rhs._M_base(); }
528 template<
typename _Tp,
typename _Alloc>
530 operator<(const deque<_Tp, _Alloc>& __lhs,
531 const deque<_Tp, _Alloc>& __rhs)
532 {
return __lhs._M_base() < __rhs._M_base(); }
534 template<
typename _Tp,
typename _Alloc>
536 operator<=(const deque<_Tp, _Alloc>& __lhs,
537 const deque<_Tp, _Alloc>& __rhs)
538 {
return __lhs._M_base() <= __rhs._M_base(); }
540 template<
typename _Tp,
typename _Alloc>
542 operator>=(
const deque<_Tp, _Alloc>& __lhs,
543 const deque<_Tp, _Alloc>& __rhs)
544 {
return __lhs._M_base() >= __rhs._M_base(); }
546 template<
typename _Tp,
typename _Alloc>
548 operator>(
const deque<_Tp, _Alloc>& __lhs,
549 const deque<_Tp, _Alloc>& __rhs)
550 {
return __lhs._M_base() > __rhs._M_base(); }
552 template<
typename _Tp,
typename _Alloc>
554 swap(deque<_Tp, _Alloc>& __lhs, deque<_Tp, _Alloc>& __rhs)
555 { __lhs.swap(__rhs); }
#define __glibcxx_check_insert_range(_Position, _First, _Last)
void _M_swap(_Safe_sequence_base &__x)
#define __glibcxx_check_insert(_Position)
void _M_detach_singular()
void _M_invalidate_if(_Predicate __pred)
void _M_invalidate_all() const
_Siter_base< _Iterator >::iterator_type __base(_Iterator __it)
A standard container using fixed-size memory allocation and constant-time manipulation of elements at...
constexpr size_t size() const
Returns the total number of bits.
#define __glibcxx_check_erase(_Position)
void _M_revalidate_singular()
Base class for constructing a safe sequence type that tracks iterators that reference it...
_Iterator base() const
Return the underlying iterator.
#define __glibcxx_check_erase_range(_First, _Last)
Class std::deque with safety/checking/debug instrumentation.