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;
53 typedef typename _Base::reference reference;
54 typedef typename _Base::const_reference const_reference;
61 typedef typename _Base::size_type size_type;
62 typedef typename _Base::difference_type difference_type;
64 typedef _Tp value_type;
65 typedef _Allocator allocator_type;
66 typedef typename _Base::pointer pointer;
67 typedef typename _Base::const_pointer const_pointer;
73 deque(
const _Allocator& __a = _Allocator())
76 #ifdef __GXX_EXPERIMENTAL_CXX0X__
81 deque(size_type __n,
const _Tp& __value,
82 const _Allocator& __a = _Allocator())
83 :
_Base(__n, __value, __a) { }
86 deque(size_type __n,
const _Tp& __value = _Tp(),
87 const _Allocator& __a = _Allocator())
88 :
_Base(__n, __value, __a) { }
91 template<
class _InputIterator>
92 deque(_InputIterator __first, _InputIterator __last,
93 const _Allocator& __a = _Allocator())
105 #ifdef __GXX_EXPERIMENTAL_CXX0X__
107 :
_Base(std::move(__x))
111 const allocator_type& __a = allocator_type())
112 :
_Base(__l, __a) { }
115 ~
deque() _GLIBCXX_NOEXCEPT { }
118 operator=(
const deque& __x)
120 *
static_cast<_Base*
>(
this) = __x;
125 #ifdef __GXX_EXPERIMENTAL_CXX0X__
127 operator=(
deque&& __x)
139 *
static_cast<_Base*
>(
this) = __l;
145 template<
class _InputIterator>
147 assign(_InputIterator __first, _InputIterator __last)
149 __glibcxx_check_valid_range(__first, __last);
156 assign(size_type __n,
const _Tp& __t)
158 _Base::assign(__n, __t);
162 #ifdef __GXX_EXPERIMENTAL_CXX0X__
171 using _Base::get_allocator;
175 begin() _GLIBCXX_NOEXCEPT
176 {
return iterator(_Base::begin(),
this); }
179 begin()
const _GLIBCXX_NOEXCEPT
183 end() _GLIBCXX_NOEXCEPT
184 {
return iterator(_Base::end(),
this); }
187 end()
const _GLIBCXX_NOEXCEPT
191 rbegin() _GLIBCXX_NOEXCEPT
195 rbegin()
const _GLIBCXX_NOEXCEPT
199 rend() _GLIBCXX_NOEXCEPT
203 rend()
const _GLIBCXX_NOEXCEPT
206 #ifdef __GXX_EXPERIMENTAL_CXX0X__
208 cbegin()
const noexcept
212 cend()
const noexcept
216 crbegin()
const noexcept
220 crend()
const noexcept
226 _M_invalidate_after_nth(difference_type __n)
235 using _Base::max_size;
237 #ifdef __GXX_EXPERIMENTAL_CXX0X__
239 resize(size_type __sz)
241 bool __invalidate_all = __sz > this->
size();
242 if (__sz < this->
size())
243 this->_M_invalidate_after_nth(__sz);
247 if (__invalidate_all)
252 resize(size_type __sz,
const _Tp& __c)
254 bool __invalidate_all = __sz > this->
size();
255 if (__sz < this->
size())
256 this->_M_invalidate_after_nth(__sz);
258 _Base::resize(__sz, __c);
260 if (__invalidate_all)
265 resize(size_type __sz, _Tp __c = _Tp())
267 bool __invalidate_all = __sz > this->
size();
268 if (__sz < this->
size())
269 this->_M_invalidate_after_nth(__sz);
271 _Base::resize(__sz, __c);
273 if (__invalidate_all)
278 #ifdef __GXX_EXPERIMENTAL_CXX0X__
282 if (_Base::_M_shrink_to_fit())
291 operator[](size_type __n)
293 __glibcxx_check_subscript(__n);
294 return _M_base()[__n];
298 operator[](size_type __n)
const
300 __glibcxx_check_subscript(__n);
301 return _M_base()[__n];
309 __glibcxx_check_nonempty();
310 return _Base::front();
316 __glibcxx_check_nonempty();
317 return _Base::front();
323 __glibcxx_check_nonempty();
324 return _Base::back();
330 __glibcxx_check_nonempty();
331 return _Base::back();
336 push_front(
const _Tp& __x)
338 _Base::push_front(__x);
343 push_back(
const _Tp& __x)
345 _Base::push_back(__x);
349 #ifdef __GXX_EXPERIMENTAL_CXX0X__
351 push_front(_Tp&& __x)
352 { emplace_front(std::move(__x)); }
356 { emplace_back(std::move(__x)); }
358 template<
typename... _Args>
360 emplace_front(_Args&&... __args)
362 _Base::emplace_front(std::forward<_Args>(__args)...);
366 template<
typename... _Args>
368 emplace_back(_Args&&... __args)
370 _Base::emplace_back(std::forward<_Args>(__args)...);
374 template<
typename... _Args>
376 emplace(
iterator __position, _Args&&... __args)
380 std::forward<_Args>(__args)...);
387 insert(
iterator __position,
const _Tp& __x)
395 #ifdef __GXX_EXPERIMENTAL_CXX0X__
397 insert(
iterator __position, _Tp&& __x)
398 {
return emplace(__position, std::move(__x)); }
403 _Base::insert(__p, __l);
409 insert(
iterator __position, size_type __n,
const _Tp& __x)
412 _Base::insert(__position.
base(), __n, __x);
416 template<
class _InputIterator>
419 _InputIterator __first, _InputIterator __last)
430 __glibcxx_check_nonempty();
438 __glibcxx_check_nonempty();
448 if (__victim == _Base::begin() || __victim == _Base::end()-1)
451 return iterator(_Base::erase(__victim),
this);
468 if (__first.
base() == __last.
base())
470 else if (__first.
base() == _Base::begin()
471 || __last.
base() == _Base::end())
475 __position != __last.
base(); ++__position)
487 __throw_exception_again;
507 clear() _GLIBCXX_NOEXCEPT
514 _M_base() _GLIBCXX_NOEXCEPT {
return *
this; }
517 _M_base()
const _GLIBCXX_NOEXCEPT {
return *
this; }
520 template<
typename _Tp,
typename _Alloc>
524 {
return __lhs._M_base() == __rhs._M_base(); }
526 template<
typename _Tp,
typename _Alloc>
530 {
return __lhs._M_base() != __rhs._M_base(); }
532 template<
typename _Tp,
typename _Alloc>
534 operator<(const deque<_Tp, _Alloc>& __lhs,
535 const deque<_Tp, _Alloc>& __rhs)
536 {
return __lhs._M_base() < __rhs._M_base(); }
538 template<
typename _Tp,
typename _Alloc>
540 operator<=(const deque<_Tp, _Alloc>& __lhs,
541 const deque<_Tp, _Alloc>& __rhs)
542 {
return __lhs._M_base() <= __rhs._M_base(); }
544 template<
typename _Tp,
typename _Alloc>
546 operator>=(
const deque<_Tp, _Alloc>& __lhs,
547 const deque<_Tp, _Alloc>& __rhs)
548 {
return __lhs._M_base() >= __rhs._M_base(); }
550 template<
typename _Tp,
typename _Alloc>
552 operator>(
const deque<_Tp, _Alloc>& __lhs,
553 const deque<_Tp, _Alloc>& __rhs)
554 {
return __lhs._M_base() > __rhs._M_base(); }
556 template<
typename _Tp,
typename _Alloc>
558 swap(deque<_Tp, _Alloc>& __lhs, deque<_Tp, _Alloc>& __rhs)
559 { __lhs.swap(__rhs); }
_Siter_base< _Iterator >::iterator_type __base(_Iterator __it)
void _M_revalidate_singular()
#define __glibcxx_check_erase_range(_First, _Last)
void _M_swap(_Safe_sequence_base &__x)
void _M_invalidate_if(_Predicate __pred)
_Iterator base() const
Return the underlying iterator.
#define __glibcxx_check_erase(_Position)
void _M_detach_singular()
A standard container using fixed-size memory allocation and constant-time manipulation of elements at...
void _M_invalidate_all() const
#define __glibcxx_check_insert_range(_Position, _First, _Last)
#define __glibcxx_check_insert(_Position)
Base class for constructing a safe sequence type that tracks iterators that reference it...
Class std::deque with safety/checking/debug instrumentation.
constexpr size_t size() const _GLIBCXX_NOEXCEPT
Returns the total number of bits.