57#define _STL_VECTOR_H 1
62#if __cplusplus >= 201103L
65#if __cplusplus >= 202002L
67#define __cpp_lib_constexpr_vector 201907L
72#if _GLIBCXX_SANITIZE_STD_ALLOCATOR && _GLIBCXX_SANITIZE_VECTOR
74__sanitizer_annotate_contiguous_container(
const void*,
const void*,
75 const void*,
const void*);
78namespace std _GLIBCXX_VISIBILITY(default)
80_GLIBCXX_BEGIN_NAMESPACE_VERSION
81_GLIBCXX_BEGIN_NAMESPACE_CONTAINER
84 template<
typename _Tp,
typename _Alloc>
88 rebind<_Tp>::other _Tp_alloc_type;
89 typedef typename __gnu_cxx::__alloc_traits<_Tp_alloc_type>::pointer
92 struct _Vector_impl_data
96 pointer _M_end_of_storage;
100 : _M_start(), _M_finish(), _M_end_of_storage()
103#if __cplusplus >= 201103L
105 _Vector_impl_data(_Vector_impl_data&& __x) noexcept
106 : _M_start(__x._M_start), _M_finish(__x._M_finish),
107 _M_end_of_storage(__x._M_end_of_storage)
108 { __x._M_start = __x._M_finish = __x._M_end_of_storage = pointer(); }
115 _M_start = __x._M_start;
116 _M_finish = __x._M_finish;
117 _M_end_of_storage = __x._M_end_of_storage;
126 _Vector_impl_data
__tmp;
127 __tmp._M_copy_data(*
this);
129 __x._M_copy_data(
__tmp);
134 :
public _Tp_alloc_type,
public _Vector_impl_data
139#if __cpp_lib_concepts
147 : _Tp_alloc_type(__a)
150#if __cplusplus >= 201103L
154 _Vector_impl(_Vector_impl&& __x) noexcept
159 _Vector_impl(_Tp_alloc_type&& __a) noexcept
164 _Vector_impl(_Tp_alloc_type&& __a, _Vector_impl&&
__rv) noexcept
169#if _GLIBCXX_SANITIZE_STD_ALLOCATOR && _GLIBCXX_SANITIZE_VECTOR
170 template<
typename = _Tp_alloc_type>
174 ::size_type size_type;
191 template<
typename _Up>
195 ::size_type size_type;
202#if __cpp_lib_is_constant_evaluated
211 _S_grow(_Vector_impl& __impl, size_type __n)
212 {
_S_adjust(__impl, __impl._M_finish, __impl._M_finish + __n); }
215 _S_shrink(_Vector_impl& __impl, size_type __n)
216 {
_S_adjust(__impl, __impl._M_finish + __n, __impl._M_finish); }
222 _S_adjust(__impl, __impl._M_finish, __impl._M_end_of_storage);
229 _Reinit(_Vector_impl& __impl) : _M_impl(__impl)
239 if (_M_impl._M_start)
240 _S_adjust(_M_impl, _M_impl._M_end_of_storage,
244 _Vector_impl& _M_impl;
246#if __cplusplus >= 201103L
256 _Grow(_Vector_impl& __impl, size_type __n)
257 : _M_impl(__impl), _M_n(__n)
264 void _M_grew(size_type __n) { _M_n -= __n; }
266#if __cplusplus >= 201103L
271 _Vector_impl& _M_impl;
276#define _GLIBCXX_ASAN_ANNOTATE_REINIT \
277 typename _Base::_Vector_impl::template _Asan<>::_Reinit const \
278 __attribute__((__unused__)) __reinit_guard(this->_M_impl)
279#define _GLIBCXX_ASAN_ANNOTATE_GROW(n) \
280 typename _Base::_Vector_impl::template _Asan<>::_Grow \
281 __attribute__((__unused__)) __grow_guard(this->_M_impl, (n))
282#define _GLIBCXX_ASAN_ANNOTATE_GREW(n) __grow_guard._M_grew(n)
283#define _GLIBCXX_ASAN_ANNOTATE_SHRINK(n) \
284 _Base::_Vector_impl::template _Asan<>::_S_shrink(this->_M_impl, n)
285#define _GLIBCXX_ASAN_ANNOTATE_BEFORE_DEALLOC \
286 _Base::_Vector_impl::template _Asan<>::_S_on_dealloc(this->_M_impl)
288#define _GLIBCXX_ASAN_ANNOTATE_REINIT
289#define _GLIBCXX_ASAN_ANNOTATE_GROW(n)
290#define _GLIBCXX_ASAN_ANNOTATE_GREW(n)
291#define _GLIBCXX_ASAN_ANNOTATE_SHRINK(n)
292#define _GLIBCXX_ASAN_ANNOTATE_BEFORE_DEALLOC
297 typedef _Alloc allocator_type;
302 {
return this->_M_impl; }
305 const _Tp_alloc_type&
307 {
return this->_M_impl; }
312 {
return allocator_type(_M_get_Tp_allocator()); }
314#if __cplusplus >= 201103L
321 _Vector_base(
const allocator_type& __a) _GLIBCXX_NOEXCEPT
325#if !_GLIBCXX_INLINE_VERSION
327 _Vector_base(
size_t __n)
329 { _M_create_storage(__n); }
333 _Vector_base(
size_t __n,
const allocator_type& __a)
335 { _M_create_storage(__n); }
337#if __cplusplus >= 201103L
338 _Vector_base(_Vector_base&&) =
default;
341# if !_GLIBCXX_INLINE_VERSION
343 _Vector_base(_Tp_alloc_type&& __a) noexcept
347 _Vector_base(_Vector_base&& __x,
const allocator_type& __a)
350 if (__x.get_allocator() == __a)
351 this->_M_impl._M_swap_data(__x._M_impl);
354 size_t __n = __x._M_impl._M_finish - __x._M_impl._M_start;
355 _M_create_storage(__n);
361 _Vector_base(
const allocator_type& __a, _Vector_base&& __x)
362 : _M_impl(_Tp_alloc_type(__a),
std::
move(__x._M_impl))
367 ~_Vector_base() _GLIBCXX_NOEXCEPT
369 _M_deallocate(_M_impl._M_start,
370 _M_impl._M_end_of_storage - _M_impl._M_start);
374 _Vector_impl _M_impl;
378 _M_allocate(
size_t __n)
381 return __n != 0 ? _Tr::allocate(_M_impl, __n) : pointer();
386 _M_deallocate(pointer __p,
size_t __n)
390 _Tr::deallocate(_M_impl, __p, __n);
396 _M_create_storage(
size_t __n)
398 this->_M_impl._M_start = this->_M_allocate(__n);
399 this->_M_impl._M_finish = this->_M_impl._M_start;
400 this->_M_impl._M_end_of_storage = this->_M_impl._M_start + __n;
427 template<
typename _Tp,
typename _Alloc = std::allocator<_Tp> >
430#ifdef _GLIBCXX_CONCEPT_CHECKS
433# if __cplusplus < 201103L
434 __glibcxx_class_requires(_Tp, _SGIAssignableConcept)
439#if __cplusplus >= 201103L
441 "std::vector must have a non-const, non-volatile value_type");
442# if __cplusplus > 201703L || defined __STRICT_ANSI__
444 "std::vector must have the same value_type as its allocator");
449 typedef typename _Base::_Tp_alloc_type _Tp_alloc_type;
453 typedef _Tp value_type;
454 typedef typename _Base::pointer pointer;
455 typedef typename _Alloc_traits::const_pointer const_pointer;
456 typedef typename _Alloc_traits::reference reference;
457 typedef typename _Alloc_traits::const_reference const_reference;
458 typedef __gnu_cxx::__normal_iterator<pointer, vector> iterator;
459 typedef __gnu_cxx::__normal_iterator<const_pointer, vector>
463 typedef size_t size_type;
464 typedef ptrdiff_t difference_type;
465 typedef _Alloc allocator_type;
468#if __cplusplus >= 201103L
469 static constexpr bool
478 static constexpr bool
482 static constexpr bool
492 _S_do_relocate(pointer __first, pointer __last, pointer __result,
499 _S_do_relocate(pointer, pointer, pointer __result,
504 _S_relocate(pointer __first, pointer __last, pointer __result,
505 _Tp_alloc_type&
__alloc)
noexcept
507#if __cpp_if_constexpr
511 using __do_it = __bool_constant<_S_use_relocate()>;
512 return _S_do_relocate(__first, __last, __result,
__alloc,
__do_it{});
518 using _Base::_M_allocate;
519 using _Base::_M_deallocate;
520 using _Base::_M_impl;
521 using _Base::_M_get_Tp_allocator;
530#if __cplusplus >= 201103L
545#if __cplusplus >= 201103L
556 vector(size_type __n,
const allocator_type& __a = allocator_type())
557 :
_Base(_S_check_init_len(__n, __a), __a)
558 { _M_default_initialize(__n); }
569 vector(size_type __n,
const value_type& __value,
570 const allocator_type& __a = allocator_type())
571 :
_Base(_S_check_init_len(__n, __a), __a)
572 { _M_fill_initialize(__n, __value); }
583 vector(size_type __n,
const value_type& __value = value_type(),
584 const allocator_type& __a = allocator_type())
585 : _Base(_S_check_init_len(__n, __a), __a)
586 { _M_fill_initialize(__n, __value); }
605 this->_M_impl._M_finish =
607 this->_M_impl._M_start,
608 _M_get_Tp_allocator());
611#if __cplusplus >= 201103L
627 this->_M_impl._M_finish =
629 this->_M_impl._M_start,
630 _M_get_Tp_allocator());
643 if (__rv.get_allocator() == __m)
644 this->_M_impl._M_swap_data(__rv._M_impl);
645 else if (!__rv.empty())
647 this->_M_create_storage(__rv.size());
648 this->_M_impl._M_finish =
650 this->_M_impl._M_start,
651 _M_get_Tp_allocator());
679 const allocator_type& __a = allocator_type())
682 _M_range_initialize(
__l.begin(),
__l.end(),
703#if __cplusplus >= 201103L
708 const allocator_type& __a = allocator_type())
711 _M_range_initialize(__first, __last,
715 template<
typename _InputIterator>
717 const allocator_type& __a = allocator_type())
721 typedef typename std::__is_integer<_InputIterator>::__type
_Integral;
722 _M_initialize_dispatch(__first, __last,
_Integral());
736 _M_get_Tp_allocator());
737 _GLIBCXX_ASAN_ANNOTATE_BEFORE_DEALLOC;
753#if __cplusplus >= 201103L
769 _Alloc_traits::_S_propagate_on_move_assign()
770 || _Alloc_traits::_S_always_equal();
790 this->_M_assign_aux(
__l.begin(),
__l.end(),
808 assign(size_type __n,
const value_type& __val)
809 { _M_fill_assign(__n, __val); }
823#if __cplusplus >= 201103L
831 template<
typename _InputIterator>
836 typedef typename std::__is_integer<_InputIterator>::__type
_Integral;
837 _M_assign_dispatch(__first, __last,
_Integral());
841#if __cplusplus >= 201103L
857 this->_M_assign_aux(
__l.begin(),
__l.end(),
863 using _Base::get_allocator;
874 {
return iterator(this->_M_impl._M_start); }
884 {
return const_iterator(this->_M_impl._M_start); }
894 {
return iterator(this->_M_impl._M_finish); }
904 {
return const_iterator(this->_M_impl._M_finish); }
922 const_reverse_iterator
942 const_reverse_iterator
946#if __cplusplus >= 201103L
955 {
return const_iterator(this->_M_impl._M_start); }
965 {
return const_iterator(this->_M_impl._M_finish); }
973 const_reverse_iterator
983 const_reverse_iterator
993 {
return size_type(this->_M_impl._M_finish -
this->_M_impl._M_start); }
999 {
return _S_max_size(_M_get_Tp_allocator()); }
1001#if __cplusplus >= 201103L
1018 _M_erase_at_end(this->_M_impl._M_start +
__new_size);
1039 _M_erase_at_end(this->_M_impl._M_start +
__new_size);
1060 _M_erase_at_end(this->_M_impl._M_start +
__new_size);
1064#if __cplusplus >= 201103L
1066 _GLIBCXX20_CONSTEXPR
1069 { _M_shrink_to_fit(); }
1079 {
return size_type(this->_M_impl._M_end_of_storage
1080 -
this->_M_impl._M_start); }
1128 __glibcxx_requires_subscript(__n);
1129 return *(this->_M_impl._M_start + __n);
1147 __glibcxx_requires_subscript(__n);
1148 return *(this->_M_impl._M_start + __n);
1157 if (__n >= this->
size())
1158 __throw_out_of_range_fmt(__N(
"vector::_M_range_check: __n "
1159 "(which is %zu) >= this->size() "
1181 return (*
this)[__n];
1200 return (*
this)[__n];
1211 __glibcxx_requires_nonempty();
1223 __glibcxx_requires_nonempty();
1235 __glibcxx_requires_nonempty();
1236 return *(
end() - 1);
1247 __glibcxx_requires_nonempty();
1248 return *(
end() - 1);
1261 {
return _M_data_ptr(this->_M_impl._M_start); }
1266 {
return _M_data_ptr(this->_M_impl._M_start); }
1279 _GLIBCXX20_CONSTEXPR
1283 if (this->_M_impl._M_finish !=
this->_M_impl._M_end_of_storage)
1285 _GLIBCXX_ASAN_ANNOTATE_GROW(1);
1286 _Alloc_traits::construct(this->_M_impl, this->_M_impl._M_finish,
1288 ++this->_M_impl._M_finish;
1289 _GLIBCXX_ASAN_ANNOTATE_GREW(1);
1292 _M_realloc_insert(
end(), __x);
1295#if __cplusplus >= 201103L
1301 template<
typename... _Args>
1302#if __cplusplus > 201402L
1303 _GLIBCXX20_CONSTEXPR
1308 emplace_back(_Args&&... __args);
1320 _GLIBCXX20_CONSTEXPR
1324 __glibcxx_requires_nonempty();
1325 --this->_M_impl._M_finish;
1326 _Alloc_traits::destroy(this->_M_impl, this->_M_impl._M_finish);
1327 _GLIBCXX_ASAN_ANNOTATE_SHRINK(1);
1330#if __cplusplus >= 201103L
1343 template<
typename...
_Args>
1379#if __cplusplus >= 201103L
1414 _M_range_insert(
begin() + __offset,
__l.begin(),
__l.end(),
1416 return begin() + __offset;
1420#if __cplusplus >= 201103L
1440 _M_fill_insert(
begin() + __offset, __n, __x);
1441 return begin() + __offset;
1462#if __cplusplus >= 201103L
1478 template<
typename _InputIterator,
1480 _GLIBCXX20_CONSTEXPR
1486 _M_range_insert(
begin() + __offset, __first, __last,
1488 return begin() + __offset;
1505 template<
typename _InputIterator>
1511 typedef typename std::__is_integer<_InputIterator>::__type
_Integral;
1531 _GLIBCXX20_CONSTEXPR
1533#if __cplusplus >= 201103L
1559 _GLIBCXX20_CONSTEXPR
1561#if __cplusplus >= 201103L
1562 erase(const_iterator __first, const_iterator __last)
1570 {
return _M_erase(__first, __last); }
1584 _GLIBCXX20_CONSTEXPR
1588#if __cplusplus >= 201103L
1589 __glibcxx_assert(_Alloc_traits::propagate_on_container_swap::value
1590 || _M_get_Tp_allocator() == __x._M_get_Tp_allocator());
1592 this->_M_impl._M_swap_data(__x._M_impl);
1593 _Alloc_traits::_S_on_swap(_M_get_Tp_allocator(),
1594 __x._M_get_Tp_allocator());
1606 { _M_erase_at_end(this->_M_impl._M_start); }
1613 template<
typename _ForwardIterator>
1619 pointer __result = this->_M_allocate(__n);
1623 _M_get_Tp_allocator());
1628 _M_deallocate(__result, __n);
1629 __throw_exception_again;
1638#if __cplusplus < 201103L
1641 template<
typename _Integer>
1645 this->_M_impl._M_start = _M_allocate(_S_check_init_len(
1646 static_cast<size_type
>(__n), _M_get_Tp_allocator()));
1647 this->_M_impl._M_end_of_storage =
1648 this->_M_impl._M_start +
static_cast<size_type
>(__n);
1649 _M_fill_initialize(
static_cast<size_type
>(__n), __value);
1653 template<
typename _InputIterator>
1655 _M_initialize_dispatch(_InputIterator __first, _InputIterator __last,
1658 _M_range_initialize(__first, __last,
1664 template<
typename _InputIterator>
1665 _GLIBCXX20_CONSTEXPR
1667 _M_range_initialize(_InputIterator __first, _InputIterator __last,
1671 for (; __first != __last; ++__first)
1672#
if __cplusplus >= 201103L
1673 emplace_back(*__first);
1679 __throw_exception_again;
1684 template<
typename _ForwardIterator>
1685 _GLIBCXX20_CONSTEXPR
1687 _M_range_initialize(_ForwardIterator __first, _ForwardIterator __last,
1691 this->_M_impl._M_start
1692 = this->_M_allocate(_S_check_init_len(__n, _M_get_Tp_allocator()));
1693 this->_M_impl._M_end_of_storage = this->_M_impl._M_start + __n;
1694 this->_M_impl._M_finish =
1696 this->_M_impl._M_start,
1697 _M_get_Tp_allocator());
1702 _GLIBCXX20_CONSTEXPR
1704 _M_fill_initialize(size_type __n,
const value_type& __value)
1706 this->_M_impl._M_finish =
1708 _M_get_Tp_allocator());
1711#if __cplusplus >= 201103L
1713 _GLIBCXX20_CONSTEXPR
1715 _M_default_initialize(size_type __n)
1717 this->_M_impl._M_finish =
1719 _M_get_Tp_allocator());
1730 template<
typename _Integer>
1731 _GLIBCXX20_CONSTEXPR
1733 _M_assign_dispatch(_Integer __n, _Integer __val, __true_type)
1734 { _M_fill_assign(__n, __val); }
1737 template<
typename _InputIterator>
1738 _GLIBCXX20_CONSTEXPR
1740 _M_assign_dispatch(_InputIterator __first, _InputIterator __last,
1745 template<
typename _InputIterator>
1746 _GLIBCXX20_CONSTEXPR
1748 _M_assign_aux(_InputIterator __first, _InputIterator __last,
1752 template<
typename _ForwardIterator>
1753 _GLIBCXX20_CONSTEXPR
1755 _M_assign_aux(_ForwardIterator __first, _ForwardIterator __last,
1760 _GLIBCXX20_CONSTEXPR
1762 _M_fill_assign(size_type __n,
const value_type& __val);
1770 template<
typename _Integer>
1771 _GLIBCXX20_CONSTEXPR
1773 _M_insert_dispatch(iterator __pos, _Integer __n, _Integer __val,
1775 { _M_fill_insert(__pos, __n, __val); }
1778 template<
typename _InputIterator>
1779 _GLIBCXX20_CONSTEXPR
1781 _M_insert_dispatch(iterator __pos, _InputIterator __first,
1782 _InputIterator __last, __false_type)
1784 _M_range_insert(__pos, __first, __last,
1789 template<
typename _InputIterator>
1790 _GLIBCXX20_CONSTEXPR
1792 _M_range_insert(iterator __pos, _InputIterator __first,
1796 template<
typename _ForwardIterator>
1797 _GLIBCXX20_CONSTEXPR
1799 _M_range_insert(iterator __pos, _ForwardIterator __first,
1804 _GLIBCXX20_CONSTEXPR
1806 _M_fill_insert(iterator __pos, size_type __n,
const value_type& __x);
1808#if __cplusplus >= 201103L
1810 _GLIBCXX20_CONSTEXPR
1812 _M_default_append(size_type __n);
1814 _GLIBCXX20_CONSTEXPR
1819#if __cplusplus < 201103L
1822 _M_insert_aux(iterator __position,
const value_type& __x);
1825 _M_realloc_insert(iterator __position,
const value_type& __x);
1829 struct _Temporary_value
1831 template<
typename... _Args>
1832 _GLIBCXX20_CONSTEXPR
explicit
1833 _Temporary_value(
vector* __vec, _Args&&... __args) : _M_this(__vec)
1835 _Alloc_traits::construct(_M_this->_M_impl, _M_ptr(),
1839 _GLIBCXX20_CONSTEXPR
1841 { _Alloc_traits::destroy(_M_this->_M_impl, _M_ptr()); }
1843 _GLIBCXX20_CONSTEXPR value_type&
1844 _M_val() noexcept {
return _M_storage._M_val; }
1847 _GLIBCXX20_CONSTEXPR _Tp*
1852 constexpr _Storage() : _M_byte() { }
1853 _GLIBCXX20_CONSTEXPR ~_Storage() { }
1854 _Storage& operator=(
const _Storage&) =
delete;
1855 unsigned char _M_byte;
1860 _Storage _M_storage;
1865 template<
typename _Arg>
1866 _GLIBCXX20_CONSTEXPR
1868 _M_insert_aux(iterator __position, _Arg&& __arg);
1870 template<
typename... _Args>
1871 _GLIBCXX20_CONSTEXPR
1873 _M_realloc_insert(iterator __position, _Args&&... __args);
1876 _GLIBCXX20_CONSTEXPR
1878 _M_insert_rval(const_iterator __position, value_type&& __v);
1881 template<
typename... _Args>
1882 _GLIBCXX20_CONSTEXPR
1884 _M_emplace_aux(const_iterator __position, _Args&&... __args);
1887 _GLIBCXX20_CONSTEXPR
1889 _M_emplace_aux(const_iterator __position, value_type&& __v)
1890 {
return _M_insert_rval(__position,
std::move(__v)); }
1894 _GLIBCXX20_CONSTEXPR
1896 _M_check_len(size_type __n,
const char* __s)
const
1899 __throw_length_error(__N(__s));
1906 static _GLIBCXX20_CONSTEXPR size_type
1907 _S_check_init_len(size_type __n,
const allocator_type& __a)
1909 if (__n > _S_max_size(_Tp_alloc_type(__a)))
1910 __throw_length_error(
1911 __N(
"cannot create std::vector larger than max_size()"));
1915 static _GLIBCXX20_CONSTEXPR size_type
1916 _S_max_size(
const _Tp_alloc_type& __a) _GLIBCXX_NOEXCEPT
1921 const size_t __diffmax
1922 = __gnu_cxx::__numeric_traits<ptrdiff_t>::__max /
sizeof(_Tp);
1924 return (
std::min)(__diffmax, __allocmax);
1931 _GLIBCXX20_CONSTEXPR
1933 _M_erase_at_end(pointer __pos) _GLIBCXX_NOEXCEPT
1935 if (size_type __n = this->_M_impl._M_finish - __pos)
1938 _M_get_Tp_allocator());
1939 this->_M_impl._M_finish = __pos;
1940 _GLIBCXX_ASAN_ANNOTATE_SHRINK(__n);
1944 _GLIBCXX20_CONSTEXPR
1946 _M_erase(iterator __position);
1948 _GLIBCXX20_CONSTEXPR
1950 _M_erase(iterator __first, iterator __last);
1952#if __cplusplus >= 201103L
1957 _GLIBCXX20_CONSTEXPR
1962 this->_M_impl._M_swap_data(__x._M_impl);
1963 __tmp._M_impl._M_swap_data(__x._M_impl);
1969 _GLIBCXX20_CONSTEXPR
1973 if (__x._M_get_Tp_allocator() == this->_M_get_Tp_allocator())
1979 this->_M_assign_aux(std::make_move_iterator(__x.begin()),
1980 std::make_move_iterator(__x.end()),
1987 template<
typename _Up>
1988 _GLIBCXX20_CONSTEXPR
1990 _M_data_ptr(_Up* __ptr)
const _GLIBCXX_NOEXCEPT
1993#if __cplusplus >= 201103L
1994 template<
typename _Ptr>
1995 _GLIBCXX20_CONSTEXPR
1997 _M_data_ptr(_Ptr __ptr)
const
1998 {
return empty() ? nullptr : std::__to_address(__ptr); }
2000 template<
typename _Up>
2002 _M_data_ptr(_Up* __ptr) _GLIBCXX_NOEXCEPT
2005 template<
typename _Ptr>
2007 _M_data_ptr(_Ptr __ptr)
2008 {
return empty() ? (value_type*)0 : __ptr.operator->(); }
2010 template<
typename _Ptr>
2012 _M_data_ptr(_Ptr __ptr)
const
2013 {
return empty() ? (
const value_type*)0 : __ptr.operator->(); }
2017#if __cpp_deduction_guides >= 201606
2018 template<
typename _InputIterator,
typename _ValT
2019 =
typename iterator_traits<_InputIterator>::value_type,
2020 typename _Allocator = allocator<_ValT>,
2021 typename = _RequireInputIter<_InputIterator>,
2022 typename = _RequireAllocator<_Allocator>>
2023 vector(_InputIterator, _InputIterator, _Allocator = _Allocator())
2024 -> vector<_ValT, _Allocator>;
2037 template<
typename _Tp,
typename _Alloc>
2038 _GLIBCXX20_CONSTEXPR
2041 {
return (__x.size() == __y.size()
2042 && std::equal(__x.begin(), __x.end(), __y.begin())); }
2044#if __cpp_lib_three_way_comparison
2056 template<
typename _Tp,
typename _Alloc>
2057 _GLIBCXX20_CONSTEXPR
2058 inline __detail::__synth3way_t<_Tp>
2059 operator<=>(
const vector<_Tp, _Alloc>& __x,
const vector<_Tp, _Alloc>& __y)
2062 __y.begin(), __y.end(),
2063 __detail::__synth3way);
2077 template<
typename _Tp,
typename _Alloc>
2080 {
return std::lexicographical_compare(__x.begin(), __x.end(),
2081 __y.begin(), __y.end()); }
2084 template<
typename _Tp,
typename _Alloc>
2087 {
return !(__x == __y); }
2090 template<
typename _Tp,
typename _Alloc>
2093 {
return __y < __x; }
2096 template<
typename _Tp,
typename _Alloc>
2099 {
return !(__y < __x); }
2102 template<
typename _Tp,
typename _Alloc>
2105 {
return !(__x < __y); }
2109 template<
typename _Tp,
typename _Alloc>
2110 _GLIBCXX20_CONSTEXPR
2116_GLIBCXX_END_NAMESPACE_CONTAINER
2118#if __cplusplus >= 201703L
2119 namespace __detail::__variant
2121 template<
typename>
struct _Never_valueless_alt;
2125 template<
typename _Tp,
typename _Alloc>
2126 struct _Never_valueless_alt<_GLIBCXX_STD_C::vector<_Tp, _Alloc>>
2132_GLIBCXX_END_NAMESPACE_VERSION
integral_constant< bool, true > true_type
The type used as a compile-time boolean with true value.
integral_constant< bool, false > false_type
The type used as a compile-time boolean with false value.
constexpr bool is_constant_evaluated() noexcept
Returns true only when called during constant evaluation.
constexpr std::remove_reference< _Tp >::type && move(_Tp &&__t) noexcept
Convert a value to an rvalue.
constexpr _Tp * __addressof(_Tp &__r) noexcept
Same as C++11 std::addressof.
constexpr const _Tp & max(const _Tp &, const _Tp &)
This does what you think it does.
constexpr const _Tp & min(const _Tp &, const _Tp &)
This does what you think it does.
constexpr iterator_traits< _Iter >::iterator_category __iterator_category(const _Iter &)
ISO C++ entities toplevel namespace is std.
constexpr iterator_traits< _InputIterator >::difference_type distance(_InputIterator __first, _InputIterator __last)
A generalization of pointer arithmetic.
constexpr void _Destroy(_ForwardIterator __first, _ForwardIterator __last)
is_nothrow_default_constructible
is_nothrow_move_assignable
typename __detected_or_t< is_empty< _Alloc >, __equal, _Alloc >::type is_always_equal
Whether all instances of the allocator type compare equal.
The standard allocator, as per C++03 [20.4.1].
Forward iterators support a superset of input iterator operations.
Random-access iterators support a superset of bidirectional iterator operations.
See bits/stl_deque.h's _Deque_base for an explanation.
A standard container which offers fixed time access to individual elements in any order.
constexpr iterator insert(const_iterator __position, const value_type &__x)
Inserts given value into vector before specified iterator.
constexpr void push_back(const value_type &__x)
Add data to the end of the vector.
constexpr void resize(size_type __new_size, const value_type &__x)
Resizes the vector to the specified number of elements.
constexpr vector & operator=(initializer_list< value_type > __l)
Vector list assignment operator.
constexpr reverse_iterator rbegin() noexcept
constexpr iterator end() noexcept
constexpr vector(const vector &__x)
Vector copy constructor.
vector()=default
Creates a vector with no elements.
constexpr iterator emplace(const_iterator __position, _Args &&... __args)
Inserts an object in vector before specified iterator.
constexpr iterator insert(const_iterator __position, value_type &&__x)
Inserts given rvalue into vector before specified iterator.
constexpr const_reverse_iterator rend() const noexcept
constexpr iterator begin() noexcept
constexpr size_type capacity() const noexcept
constexpr iterator insert(const_iterator __position, initializer_list< value_type > __l)
Inserts an initializer_list into the vector.
constexpr ~vector() noexcept
constexpr const_iterator begin() const noexcept
constexpr void assign(_InputIterator __first, _InputIterator __last)
Assigns a range to a vector.
constexpr void assign(size_type __n, const value_type &__val)
Assigns a given value to a vector.
constexpr iterator erase(const_iterator __first, const_iterator __last)
Remove a range of elements.
constexpr void swap(vector &__x) noexcept
Swaps data with another vector.
constexpr vector(vector &&__rv, const __type_identity_t< allocator_type > &__m) noexcept(noexcept(vector(std::declval< vector && >(), std::declval< const allocator_type & >(), std::declval< typename _Alloc_traits::is_always_equal >())))
Move constructor with alternative allocator.
constexpr _Tp * data() noexcept
constexpr vector(size_type __n, const allocator_type &__a=allocator_type())
Creates a vector with default constructed elements.
constexpr const_reference front() const noexcept
constexpr vector & operator=(const vector &__x)
Vector assignment operator.
constexpr void pop_back() noexcept
Removes last element.
constexpr vector & operator=(vector &&__x) noexcept(_Alloc_traits::_S_nothrow_move())
Vector move assignment operator.
constexpr const_reference back() const noexcept
constexpr void reserve(size_type __n)
Attempt to preallocate enough memory for specified number of elements.
constexpr reference at(size_type __n)
Provides access to the data contained in the vector.
constexpr void resize(size_type __new_size)
Resizes the vector to the specified number of elements.
constexpr void _M_range_check(size_type __n) const
Safety check used only from at().
constexpr reference front() noexcept
constexpr iterator insert(const_iterator __position, size_type __n, const value_type &__x)
Inserts a number of copies of given data into the vector.
constexpr const_reference operator[](size_type __n) const noexcept
Subscript access to the data contained in the vector.
constexpr vector(const allocator_type &__a) noexcept
Creates a vector with no elements.
constexpr iterator erase(const_iterator __position)
Remove element at given position.
constexpr pointer _M_allocate_and_copy(size_type __n, _ForwardIterator __first, _ForwardIterator __last)
constexpr bool empty() const noexcept
constexpr reverse_iterator rend() noexcept
constexpr const_reverse_iterator rbegin() const noexcept
constexpr const_reverse_iterator crbegin() const noexcept
constexpr const_reference at(size_type __n) const
Provides access to the data contained in the vector.
constexpr const_iterator cbegin() const noexcept
constexpr vector(_InputIterator __first, _InputIterator __last, const allocator_type &__a=allocator_type())
Builds a vector from a range.
constexpr vector(initializer_list< value_type > __l, const allocator_type &__a=allocator_type())
Builds a vector from an initializer list.
constexpr const_iterator end() const noexcept
vector(vector &&) noexcept=default
Vector move constructor.
constexpr iterator insert(const_iterator __position, _InputIterator __first, _InputIterator __last)
Inserts a range into the vector.
constexpr void clear() noexcept
constexpr void assign(initializer_list< value_type > __l)
Assigns an initializer list to a vector.
constexpr allocator_type get_allocator() const noexcept
Get a copy of the memory allocation object.
constexpr size_type size() const noexcept
constexpr vector(size_type __n, const value_type &__value, const allocator_type &__a=allocator_type())
Creates a vector with copies of an exemplar element.
constexpr reference back() noexcept
constexpr const_reverse_iterator crend() const noexcept
constexpr const_iterator cend() const noexcept
constexpr reference operator[](size_type __n) noexcept
Subscript access to the data contained in the vector.
constexpr void shrink_to_fit()
constexpr size_type max_size() const noexcept
Uniform interface to C++98 and C++11 allocators.
static constexpr size_type max_size(const _Tp_alloc_type &__a) noexcept
The maximum supported allocation size.