127 vector<_Tp, _Allocator>, _Allocator, __gnu_debug::_Safe_sequence>,
128 public _GLIBCXX_STD_C::vector<_Tp, _Allocator>,
130 vector<_Tp, _Allocator>,
131 _GLIBCXX_STD_C::vector<_Tp, _Allocator> >
133 typedef _GLIBCXX_STD_C::vector<_Tp, _Allocator>
_Base;
142 template<
typename _ItT,
typename _SeqT,
typename _CatT>
143 friend class ::__gnu_debug::_Safe_iterator;
150 _Base_ref(
const _Base& __r) : _M_ref(__r) { }
156 typedef typename _Base::reference reference;
157 typedef typename _Base::const_reference const_reference;
164 typedef typename _Base::size_type size_type;
165 typedef typename _Base::difference_type difference_type;
167 typedef _Tp value_type;
168 typedef _Allocator allocator_type;
169 typedef typename _Base::pointer pointer;
170 typedef typename _Base::const_pointer const_pointer;
176#if __cplusplus < 201103L
177 vector() _GLIBCXX_NOEXCEPT
185 vector(
const _Allocator& __a) _GLIBCXX_NOEXCEPT
188#if __cplusplus >= 201103L
191 vector(size_type __n,
const _Allocator& __a = _Allocator())
195 vector(size_type __n,
const __type_identity_t<_Tp>& __value,
196 const _Allocator& __a = _Allocator())
197 :
_Base(__n, __value, __a) { }
200 vector(size_type __n,
const _Tp& __value = _Tp(),
201 const _Allocator& __a = _Allocator())
202 :
_Base(__n, __value, __a) { }
205#if __cplusplus >= 201103L
206 template<
class _InputIterator,
207 typename = std::_RequireInputIter<_InputIterator>>
209 template<
class _InputIterator>
212 vector(_InputIterator __first, _InputIterator __last,
213 const _Allocator& __a = _Allocator())
215 : __glibcxx_check_valid_constructor_range(__first, __last)),
218#if __cplusplus < 201103L
222 ~vector() _GLIBCXX_NOEXCEPT { }
228 vector(
const vector& __x,
const __type_identity_t<allocator_type>& __a)
229 :
_Base(__x, __a) { }
232 vector(
vector&& __x,
const __type_identity_t<allocator_type>& __a)
235 _Base,
const allocator_type&>::value )
242 const allocator_type& __a = allocator_type())
243 :
_Base(__l, __a) { }
251 :
_Base(__x._M_ref) { }
253#if __cplusplus >= 201103L
255 operator=(
const vector&) =
default;
258 operator=(
vector&&) =
default;
264 _Base::operator=(__l);
265 if (!std::__is_constant_evaluated())
267 this->_M_invalidate_all();
268 this->_M_update_guaranteed_capacity();
274#if __cplusplus >= 201103L
275 template<
typename _InputIterator,
276 typename = std::_RequireInputIter<_InputIterator>>
278 template<
typename _InputIterator>
282 assign(_InputIterator __first, _InputIterator __last)
284 if (std::__is_constant_evaluated())
285 return _Base::assign(__gnu_debug::__unsafe(__first),
286 __gnu_debug::__unsafe(__last));
289 __glibcxx_check_valid_range2(__first, __last, __dist);
291 if (__dist.
second >= __gnu_debug::__dp_sign)
292 _Base::assign(__gnu_debug::__unsafe(__first),
293 __gnu_debug::__unsafe(__last));
295 _Base::assign(__first, __last);
297 this->_M_invalidate_all();
298 this->_M_update_guaranteed_capacity();
303 assign(size_type __n,
const _Tp& __u)
305 _Base::assign(__n, __u);
306 if (!std::__is_constant_evaluated())
308 this->_M_invalidate_all();
309 this->_M_update_guaranteed_capacity();
313#if __cplusplus >= 201103L
316 assign(initializer_list<value_type> __l)
319 if (!std::__is_constant_evaluated())
321 this->_M_invalidate_all();
322 this->_M_update_guaranteed_capacity();
327 using _Base::get_allocator;
333 begin() _GLIBCXX_NOEXCEPT
334 {
return iterator(_Base::begin(),
this); }
339 begin() const _GLIBCXX_NOEXCEPT
340 {
return const_iterator(_Base::begin(),
this); }
345 end() _GLIBCXX_NOEXCEPT
346 {
return iterator(_Base::end(),
this); }
351 end() const _GLIBCXX_NOEXCEPT
352 {
return const_iterator(_Base::end(),
this); }
357 rbegin() _GLIBCXX_NOEXCEPT
358 {
return reverse_iterator(end()); }
362 const_reverse_iterator
363 rbegin() const _GLIBCXX_NOEXCEPT
364 {
return const_reverse_iterator(end()); }
369 rend() _GLIBCXX_NOEXCEPT
370 {
return reverse_iterator(begin()); }
374 const_reverse_iterator
375 rend() const _GLIBCXX_NOEXCEPT
376 {
return const_reverse_iterator(begin()); }
378#if __cplusplus >= 201103L
382 cbegin() const noexcept
383 {
return const_iterator(_Base::begin(),
this); }
388 cend() const noexcept
389 {
return const_iterator(_Base::end(),
this); }
393 const_reverse_iterator
394 crbegin() const noexcept
395 {
return const_reverse_iterator(end()); }
399 const_reverse_iterator
400 crend() const noexcept
401 {
return const_reverse_iterator(begin()); }
406 using _Base::max_size;
408#if __cplusplus >= 201103L
411 resize(size_type __sz)
413 if (std::__is_constant_evaluated())
414 return _Base::resize(__sz);
416 bool __realloc = this->_M_requires_reallocation(__sz);
417 if (__sz < this->
size())
418 this->_M_invalidate_after_nth(__sz);
421 this->_M_invalidate_all();
422 this->_M_update_guaranteed_capacity();
427 resize(size_type __sz,
const _Tp& __c)
429 if (std::__is_constant_evaluated())
430 return _Base::resize(__sz, __c);
432 bool __realloc = this->_M_requires_reallocation(__sz);
433 if (__sz < this->
size())
434 this->_M_invalidate_after_nth(__sz);
435 _Base::resize(__sz, __c);
437 this->_M_invalidate_all();
438 this->_M_update_guaranteed_capacity();
442 resize(size_type __sz, _Tp __c = _Tp())
444 bool __realloc = this->_M_requires_reallocation(__sz);
445 if (__sz < this->
size())
446 this->_M_invalidate_after_nth(__sz);
447 _Base::resize(__sz, __c);
449 this->_M_invalidate_all();
450 this->_M_update_guaranteed_capacity();
454#if __cplusplus >= 201103L
459 if (std::__is_constant_evaluated())
460 return _Base::shrink_to_fit();
462 if (_Base::_M_shrink_to_fit())
464 this->_M_guaranteed_capacity = _Base::capacity();
465 this->_M_invalidate_all();
473 capacity() const _GLIBCXX_NOEXCEPT
475 if (std::__is_constant_evaluated())
476 return _Base::capacity();
478#ifdef _GLIBCXX_DEBUG_PEDANTIC
479 return this->_M_guaranteed_capacity;
481 return _Base::capacity();
489 reserve(size_type __n)
491 if (std::__is_constant_evaluated())
492 return _Base::reserve(__n);
494 bool __realloc = this->_M_requires_reallocation(__n);
496 if (__n > this->_M_guaranteed_capacity)
497 this->_M_guaranteed_capacity = __n;
499 this->_M_invalidate_all();
506 operator[](size_type __n) _GLIBCXX_NOEXCEPT
508 __glibcxx_check_subscript(__n);
509 return _Base::operator[](__n);
515 operator[](size_type __n)
const _GLIBCXX_NOEXCEPT
517 __glibcxx_check_subscript(__n);
518 return _Base::operator[](__n);
526 front() _GLIBCXX_NOEXCEPT
528 __glibcxx_check_nonempty();
529 return _Base::front();
535 front() const _GLIBCXX_NOEXCEPT
537 __glibcxx_check_nonempty();
538 return _Base::front();
544 back() _GLIBCXX_NOEXCEPT
546 __glibcxx_check_nonempty();
547 return _Base::back();
553 back() const _GLIBCXX_NOEXCEPT
555 __glibcxx_check_nonempty();
556 return _Base::back();
566 push_back(
const _Tp& __x)
568 if (std::__is_constant_evaluated())
569 return _Base::push_back(__x);
571 bool __realloc = this->_M_requires_reallocation(this->
size() + 1);
572 _Base::push_back(__x);
574 this->_M_invalidate_all();
575 this->_M_update_guaranteed_capacity();
578#if __cplusplus >= 201103L
579 template<
typename _Up = _Tp>
581 typename __gnu_cxx::__enable_if<!std::__are_same<_Up, bool>::__value,
586 template<
typename... _Args>
588#if __cplusplus > 201402L
593 emplace_back(_Args&&... __args)
595 if (std::__is_constant_evaluated())
596 return _Base::emplace_back(std::forward<_Args>(__args)...);
598 bool __realloc = this->_M_requires_reallocation(this->
size() + 1);
599 _Base::emplace_back(std::forward<_Args>(__args)...);
601 this->_M_invalidate_all();
602 this->_M_update_guaranteed_capacity();
603#if __cplusplus > 201402L
611 pop_back() _GLIBCXX_NOEXCEPT
613 if (!std::__is_constant_evaluated())
615 __glibcxx_check_nonempty();
616 this->_M_invalidate_if(_Equal(--_Base::end()));
621#if __cplusplus >= 201103L
622 template<
typename... _Args>
625 emplace(const_iterator __position, _Args&&... __args)
627 if (std::__is_constant_evaluated())
628 return iterator(_Base::emplace(__position.base(),
629 std::forward<_Args>(__args)...),
633 bool __realloc = this->_M_requires_reallocation(this->
size() + 1);
634 difference_type __offset = __position.base() - _Base::cbegin();
635 _Base_iterator __res = _Base::emplace(__position.base(),
636 std::forward<_Args>(__args)...);
638 this->_M_invalidate_all();
640 this->_M_invalidate_after_nth(__offset);
641 this->_M_update_guaranteed_capacity();
642 return { __res,
this };
648#if __cplusplus >= 201103L
649 insert(const_iterator __position,
const _Tp& __x)
651 insert(iterator __position,
const _Tp& __x)
654 if (std::__is_constant_evaluated())
655 return iterator(_Base::insert(__position.base(), __x),
this);
658 bool __realloc = this->_M_requires_reallocation(this->
size() + 1);
659 difference_type __offset = __position.base() - _Base::begin();
660 _Base_iterator __res = _Base::insert(__position.base(), __x);
662 this->_M_invalidate_all();
664 this->_M_invalidate_after_nth(__offset);
665 this->_M_update_guaranteed_capacity();
666 return iterator(__res,
this);
669#if __cplusplus >= 201103L
670 template<
typename _Up = _Tp>
672 typename __gnu_cxx::__enable_if<!std::__are_same<_Up, bool>::__value,
674 insert(const_iterator __position, _Tp&& __x)
675 {
return emplace(__position,
std::move(__x)); }
679 insert(const_iterator __position, initializer_list<value_type> __l)
680 {
return this->insert(__position, __l.begin(), __l.end()); }
683#if __cplusplus >= 201103L
686 insert(const_iterator __position, size_type __n,
const _Tp& __x)
688 if (std::__is_constant_evaluated())
689 return iterator(_Base::insert(__position.base(), __n, __x),
this);
692 bool __realloc = this->_M_requires_reallocation(this->
size() + __n);
693 difference_type __offset = __position.base() - _Base::cbegin();
694 _Base_iterator __res = _Base::insert(__position.base(), __n, __x);
696 this->_M_invalidate_all();
698 this->_M_invalidate_after_nth(__offset);
699 this->_M_update_guaranteed_capacity();
700 return { __res,
this };
704 insert(iterator __position, size_type __n,
const _Tp& __x)
707 bool __realloc = this->_M_requires_reallocation(this->
size() + __n);
708 difference_type __offset = __position.base() - _Base::begin();
709 _Base::insert(__position.base(), __n, __x);
711 this->_M_invalidate_all();
713 this->_M_invalidate_after_nth(__offset);
714 this->_M_update_guaranteed_capacity();
718#if __cplusplus >= 201103L
719 template<
class _InputIterator,
720 typename = std::_RequireInputIter<_InputIterator>>
723 insert(const_iterator __position,
724 _InputIterator __first, _InputIterator __last)
726 if (std::__is_constant_evaluated())
727 return iterator(_Base::insert(__position.base(),
728 __gnu_debug::__unsafe(__first),
729 __gnu_debug::__unsafe(__last)),
this);
737 _Base_iterator __old_begin = _M_base().begin();
738 difference_type __offset = __position.base() - _Base::cbegin();
739 _Base_iterator __res;
740 if (__dist.
second >= __gnu_debug::__dp_sign)
741 __res = _Base::insert(__position.base(),
742 __gnu_debug::__unsafe(__first),
743 __gnu_debug::__unsafe(__last));
745 __res = _Base::insert(__position.base(), __first, __last);
747 if (_M_base().begin() != __old_begin)
748 this->_M_invalidate_all();
750 this->_M_invalidate_after_nth(__offset);
751 this->_M_update_guaranteed_capacity();
752 return { __res,
this };
755 template<
class _InputIterator>
757 insert(iterator __position,
758 _InputIterator __first, _InputIterator __last)
766 _Base_iterator __old_begin = _M_base().begin();
767 difference_type __offset = __position.base() - _Base::begin();
768 if (__dist.
second >= __gnu_debug::__dp_sign)
769 _Base::insert(__position.base(), __gnu_debug::__unsafe(__first),
770 __gnu_debug::__unsafe(__last));
772 _Base::insert(__position.base(), __first, __last);
774 if (_M_base().begin() != __old_begin)
775 this->_M_invalidate_all();
777 this->_M_invalidate_after_nth(__offset);
778 this->_M_update_guaranteed_capacity();
784#if __cplusplus >= 201103L
785 erase(const_iterator __position)
787 erase(iterator __position)
790 if (std::__is_constant_evaluated())
791 return iterator(_Base::erase(__position.base()),
this);
794 difference_type __offset = __position.base() - _Base::begin();
795 _Base_iterator __res = _Base::erase(__position.base());
796 this->_M_invalidate_after_nth(__offset);
797 return iterator(__res,
this);
802#if __cplusplus >= 201103L
803 erase(const_iterator __first, const_iterator __last)
805 erase(iterator __first, iterator __last)
808 if (std::__is_constant_evaluated())
809 return iterator(_Base::erase(__first.base(), __last.base()),
this);
815 if (__first.base() != __last.base())
817 difference_type __offset = __first.base() - _Base::begin();
818 _Base_iterator __res = _Base::erase(__first.base(),
820 this->_M_invalidate_after_nth(__offset);
821 return iterator(__res,
this);
824#if __cplusplus >= 201103L
825 return { _Base::begin() + (__first.base() - _Base::cbegin()),
this };
834 _GLIBCXX_NOEXCEPT_IF(
noexcept(declval<_Base&>().swap(__x)) )
836 if (!std::__is_constant_evaluated())
839 std::swap(this->_M_guaranteed_capacity, __x._M_guaranteed_capacity);
844 clear() _GLIBCXX_NOEXCEPT
847 if (!std::__is_constant_evaluated())
848 this->_M_invalidate_all();
853 _M_base() _GLIBCXX_NOEXCEPT {
return *
this; }
857 _M_base() const _GLIBCXX_NOEXCEPT {
return *
this; }
861 _M_invalidate_after_nth(difference_type __n) _GLIBCXX_NOEXCEPT
864 this->_M_invalidate_if(_After_nth(__n, _Base::begin()));