860 using _Base::get_allocator;
868 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
871 {
return iterator(this->_M_impl._M_start); }
878 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
881 {
return const_iterator(this->_M_impl._M_start); }
888 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
891 {
return iterator(this->_M_impl._M_finish); }
898 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
900 end() const _GLIBCXX_NOEXCEPT
901 {
return const_iterator(this->_M_impl._M_finish); }
908 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
918 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
919 const_reverse_iterator
928 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
938 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
939 const_reverse_iterator
943#if __cplusplus >= 201103L
949 [[__nodiscard__]] _GLIBCXX20_CONSTEXPR
952 {
return const_iterator(this->_M_impl._M_start); }
959 [[__nodiscard__]] _GLIBCXX20_CONSTEXPR
962 {
return const_iterator(this->_M_impl._M_finish); }
969 [[__nodiscard__]] _GLIBCXX20_CONSTEXPR
970 const_reverse_iterator
979 [[__nodiscard__]] _GLIBCXX20_CONSTEXPR
980 const_reverse_iterator
987 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
990 {
return size_type(this->_M_impl._M_finish - this->_M_impl._M_start); }
993 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
996 {
return _S_max_size(_M_get_Tp_allocator()); }
998#if __cplusplus >= 201103L
1008 _GLIBCXX20_CONSTEXPR
1012 if (__new_size >
size())
1013 _M_default_append(__new_size -
size());
1014 else if (__new_size <
size())
1015 _M_erase_at_end(this->_M_impl._M_start + __new_size);
1029 _GLIBCXX20_CONSTEXPR
1031 resize(size_type __new_size,
const value_type& __x)
1033 if (__new_size >
size())
1034 _M_fill_insert(
end(), __new_size -
size(), __x);
1035 else if (__new_size <
size())
1036 _M_erase_at_end(this->_M_impl._M_start + __new_size);
1050 _GLIBCXX20_CONSTEXPR
1052 resize(size_type __new_size, value_type __x = value_type())
1054 if (__new_size >
size())
1055 _M_fill_insert(
end(), __new_size -
size(), __x);
1056 else if (__new_size <
size())
1057 _M_erase_at_end(this->_M_impl._M_start + __new_size);
1061#if __cplusplus >= 201103L
1063 _GLIBCXX20_CONSTEXPR
1066 { _M_shrink_to_fit(); }
1073 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
1076 {
return size_type(this->_M_impl._M_end_of_storage
1077 - this->_M_impl._M_start); }
1083 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
1105 _GLIBCXX20_CONSTEXPR
1121 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
1125 __glibcxx_requires_subscript(__n);
1126 return *(this->_M_impl._M_start + __n);
1140 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
1144 __glibcxx_requires_subscript(__n);
1145 return *(this->_M_impl._M_start + __n);
1150 _GLIBCXX20_CONSTEXPR
1154 if (__n >= this->
size())
1155 __throw_out_of_range_fmt(__N(
"vector::_M_range_check: __n "
1156 "(which is %zu) >= this->size() "
1173 _GLIBCXX20_CONSTEXPR
1178 return (*
this)[__n];
1192 _GLIBCXX20_CONSTEXPR
1197 return (*
this)[__n];
1204 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
1208 __glibcxx_requires_nonempty();
1216 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
1220 __glibcxx_requires_nonempty();
1228 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
1232 __glibcxx_requires_nonempty();
1233 return *(
end() - 1);
1240 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
1244 __glibcxx_requires_nonempty();
1245 return *(
end() - 1);
1255 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
1258 {
return _M_data_ptr(this->_M_impl._M_start); }
1260 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
1262 data() const _GLIBCXX_NOEXCEPT
1263 {
return _M_data_ptr(this->_M_impl._M_start); }
1276 _GLIBCXX20_CONSTEXPR
1280 if (this->_M_impl._M_finish != this->_M_impl._M_end_of_storage)
1282 _GLIBCXX_ASAN_ANNOTATE_GROW(1);
1283 _Alloc_traits::construct(this->_M_impl, this->_M_impl._M_finish,
1285 ++this->_M_impl._M_finish;
1286 _GLIBCXX_ASAN_ANNOTATE_GREW(1);
1289 _M_realloc_insert(
end(), __x);
1292#if __cplusplus >= 201103L
1293 _GLIBCXX20_CONSTEXPR
1298 template<
typename... _Args>
1299#if __cplusplus > 201402L
1300 _GLIBCXX20_CONSTEXPR
1305 emplace_back(_Args&&... __args);
1317 _GLIBCXX20_CONSTEXPR
1321 __glibcxx_requires_nonempty();
1322 --this->_M_impl._M_finish;
1323 _Alloc_traits::destroy(this->_M_impl, this->_M_impl._M_finish);
1324 _GLIBCXX_ASAN_ANNOTATE_SHRINK(1);
1327#if __cplusplus >= 201103L
1340 template<
typename... _Args>
1341 _GLIBCXX20_CONSTEXPR
1343 emplace(const_iterator __position, _Args&&... __args)
1344 {
return _M_emplace_aux(__position, std::forward<_Args>(__args)...); }
1357 _GLIBCXX20_CONSTEXPR
1359 insert(const_iterator __position,
const value_type& __x);
1376#if __cplusplus >= 201103L
1388 _GLIBCXX20_CONSTEXPR
1390 insert(const_iterator __position, value_type&& __x)
1391 {
return _M_insert_rval(__position,
std::move(__x)); }
1406 _GLIBCXX20_CONSTEXPR
1410 auto __offset = __position -
cbegin();
1411 _M_range_insert(
begin() + __offset, __l.begin(), __l.end(),
1413 return begin() + __offset;
1417#if __cplusplus >= 201103L
1432 _GLIBCXX20_CONSTEXPR
1434 insert(const_iterator __position, size_type __n,
const value_type& __x)
1436 difference_type __offset = __position -
cbegin();
1437 _M_fill_insert(
begin() + __offset, __n, __x);
1438 return begin() + __offset;
1455 insert(
iterator __position, size_type __n,
const value_type& __x)
1456 { _M_fill_insert(__position, __n, __x); }
1459#if __cplusplus >= 201103L
1475 template<
typename _InputIterator,
1476 typename = std::_RequireInputIter<_InputIterator>>
1477 _GLIBCXX20_CONSTEXPR
1479 insert(const_iterator __position, _InputIterator __first,
1480 _InputIterator __last)
1482 difference_type __offset = __position -
cbegin();
1483 _M_range_insert(
begin() + __offset, __first, __last,
1485 return begin() + __offset;
1502 template<
typename _InputIterator>
1505 _InputIterator __last)
1508 typedef typename std::__is_integer<_InputIterator>::__type _Integral;
1509 _M_insert_dispatch(__position, __first, __last, _Integral());
1528 _GLIBCXX20_CONSTEXPR
1530#if __cplusplus >= 201103L
1532 {
return _M_erase(
begin() + (__position -
cbegin())); }
1535 {
return _M_erase(__position); }
1556 _GLIBCXX20_CONSTEXPR
1558#if __cplusplus >= 201103L
1559 erase(const_iterator __first, const_iterator __last)
1561 const auto __beg =
begin();
1562 const auto __cbeg =
cbegin();
1563 return _M_erase(__beg + (__first - __cbeg), __beg + (__last - __cbeg));
1567 {
return _M_erase(__first, __last); }
1581 _GLIBCXX20_CONSTEXPR
1585#if __cplusplus >= 201103L
1586 __glibcxx_assert(_Alloc_traits::propagate_on_container_swap::value
1587 || _M_get_Tp_allocator() == __x._M_get_Tp_allocator());
1589 this->_M_impl._M_swap_data(__x._M_impl);
1590 _Alloc_traits::_S_on_swap(_M_get_Tp_allocator(),
1591 __x._M_get_Tp_allocator());
1600 _GLIBCXX20_CONSTEXPR
1603 { _M_erase_at_end(this->_M_impl._M_start); }
1610 template<
typename _ForwardIterator>
1611 _GLIBCXX20_CONSTEXPR
1614 _ForwardIterator __first, _ForwardIterator __last)
1616 pointer __result = this->_M_allocate(__n);
1619 std::__uninitialized_copy_a(__first, __last, __result,
1620 _M_get_Tp_allocator());
1625 _M_deallocate(__result, __n);
1626 __throw_exception_again;
1635#if __cplusplus < 201103L
1638 template<
typename _Integer>
1640 _M_initialize_dispatch(_Integer __n, _Integer __value, __true_type)
1642 this->_M_impl._M_start = _M_allocate(_S_check_init_len(
1643 static_cast<size_type
>(__n), _M_get_Tp_allocator()));
1644 this->_M_impl._M_end_of_storage =
1645 this->_M_impl._M_start +
static_cast<size_type
>(__n);
1646 _M_fill_initialize(
static_cast<size_type
>(__n), __value);
1650 template<
typename _InputIterator>
1652 _M_initialize_dispatch(_InputIterator __first, _InputIterator __last,
1655 _M_range_initialize(__first, __last,
1661 template<
typename _InputIterator>
1662 _GLIBCXX20_CONSTEXPR
1664 _M_range_initialize(_InputIterator __first, _InputIterator __last,
1668 for (; __first != __last; ++__first)
1669#
if __cplusplus >= 201103L
1670 emplace_back(*__first);
1676 __throw_exception_again;
1681 template<
typename _ForwardIterator>
1682 _GLIBCXX20_CONSTEXPR
1684 _M_range_initialize(_ForwardIterator __first, _ForwardIterator __last,
1688 this->_M_impl._M_start
1689 = this->_M_allocate(_S_check_init_len(__n, _M_get_Tp_allocator()));
1690 this->_M_impl._M_end_of_storage = this->_M_impl._M_start + __n;
1691 this->_M_impl._M_finish =
1692 std::__uninitialized_copy_a(__first, __last,
1693 this->_M_impl._M_start,
1694 _M_get_Tp_allocator());
1699 _GLIBCXX20_CONSTEXPR
1701 _M_fill_initialize(size_type __n,
const value_type& __value)
1703 this->_M_impl._M_finish =
1704 std::__uninitialized_fill_n_a(this->_M_impl._M_start, __n, __value,
1705 _M_get_Tp_allocator());
1708#if __cplusplus >= 201103L
1710 _GLIBCXX20_CONSTEXPR
1712 _M_default_initialize(size_type __n)
1714 this->_M_impl._M_finish =
1715 std::__uninitialized_default_n_a(this->_M_impl._M_start, __n,
1716 _M_get_Tp_allocator());
1727 template<
typename _Integer>
1728 _GLIBCXX20_CONSTEXPR
1730 _M_assign_dispatch(_Integer __n, _Integer __val, __true_type)
1731 { _M_fill_assign(__n, __val); }
1734 template<
typename _InputIterator>
1735 _GLIBCXX20_CONSTEXPR
1737 _M_assign_dispatch(_InputIterator __first, _InputIterator __last,
1742 template<
typename _InputIterator>
1743 _GLIBCXX20_CONSTEXPR
1745 _M_assign_aux(_InputIterator __first, _InputIterator __last,
1749 template<
typename _ForwardIterator>
1750 _GLIBCXX20_CONSTEXPR
1752 _M_assign_aux(_ForwardIterator __first, _ForwardIterator __last,
1757 _GLIBCXX20_CONSTEXPR
1759 _M_fill_assign(size_type __n,
const value_type& __val);
1767 template<
typename _Integer>
1768 _GLIBCXX20_CONSTEXPR
1770 _M_insert_dispatch(iterator __pos, _Integer __n, _Integer __val,
1772 { _M_fill_insert(__pos, __n, __val); }
1775 template<
typename _InputIterator>
1776 _GLIBCXX20_CONSTEXPR
1778 _M_insert_dispatch(iterator __pos, _InputIterator __first,
1779 _InputIterator __last, __false_type)
1781 _M_range_insert(__pos, __first, __last,
1786 template<
typename _InputIterator>
1787 _GLIBCXX20_CONSTEXPR
1789 _M_range_insert(iterator __pos, _InputIterator __first,
1793 template<
typename _ForwardIterator>
1794 _GLIBCXX20_CONSTEXPR
1796 _M_range_insert(iterator __pos, _ForwardIterator __first,
1801 _GLIBCXX20_CONSTEXPR
1803 _M_fill_insert(iterator __pos, size_type __n,
const value_type& __x);
1805#if __cplusplus >= 201103L
1807 _GLIBCXX20_CONSTEXPR
1809 _M_default_append(size_type __n);
1811 _GLIBCXX20_CONSTEXPR
1816#if __cplusplus < 201103L
1819 _M_insert_aux(iterator __position,
const value_type& __x);
1822 _M_realloc_insert(iterator __position,
const value_type& __x);
1826 struct _Temporary_value
1828 template<
typename... _Args>
1829 _GLIBCXX20_CONSTEXPR
explicit
1830 _Temporary_value(
vector* __vec, _Args&&... __args) : _M_this(__vec)
1832 _Alloc_traits::construct(_M_this->_M_impl, _M_ptr(),
1833 std::forward<_Args>(__args)...);
1836 _GLIBCXX20_CONSTEXPR
1838 { _Alloc_traits::destroy(_M_this->_M_impl, _M_ptr()); }
1840 _GLIBCXX20_CONSTEXPR value_type&
1841 _M_val() noexcept {
return _M_storage._M_val; }
1844 _GLIBCXX20_CONSTEXPR _Tp*
1849 constexpr _Storage() : _M_byte() { }
1850 _GLIBCXX20_CONSTEXPR ~_Storage() { }
1851 _Storage& operator=(
const _Storage&) =
delete;
1852 unsigned char _M_byte;
1857 _Storage _M_storage;
1862 template<
typename _Arg>
1863 _GLIBCXX20_CONSTEXPR
1865 _M_insert_aux(iterator __position, _Arg&& __arg);
1867 template<
typename... _Args>
1868 _GLIBCXX20_CONSTEXPR
1870 _M_realloc_insert(iterator __position, _Args&&... __args);
1873 _GLIBCXX20_CONSTEXPR
1875 _M_insert_rval(const_iterator __position, value_type&& __v);
1878 template<
typename... _Args>
1879 _GLIBCXX20_CONSTEXPR
1881 _M_emplace_aux(const_iterator __position, _Args&&... __args);
1884 _GLIBCXX20_CONSTEXPR
1886 _M_emplace_aux(const_iterator __position, value_type&& __v)
1887 {
return _M_insert_rval(__position,
std::move(__v)); }
1891 _GLIBCXX20_CONSTEXPR
1893 _M_check_len(size_type __n,
const char* __s)
const
1896 __throw_length_error(__N(__s));
1903 static _GLIBCXX20_CONSTEXPR size_type
1904 _S_check_init_len(size_type __n,
const allocator_type& __a)
1906 if (__n > _S_max_size(_Tp_alloc_type(__a)))
1907 __throw_length_error(
1908 __N(
"cannot create std::vector larger than max_size()"));
1912 static _GLIBCXX20_CONSTEXPR size_type
1913 _S_max_size(
const _Tp_alloc_type& __a) _GLIBCXX_NOEXCEPT
1918 const size_t __diffmax
1919 = __gnu_cxx::__numeric_traits<ptrdiff_t>::__max /
sizeof(_Tp);
1921 return (
std::min)(__diffmax, __allocmax);
1928 _GLIBCXX20_CONSTEXPR
1930 _M_erase_at_end(pointer __pos) _GLIBCXX_NOEXCEPT
1932 if (size_type __n = this->_M_impl._M_finish - __pos)
1935 _M_get_Tp_allocator());
1936 this->_M_impl._M_finish = __pos;
1937 _GLIBCXX_ASAN_ANNOTATE_SHRINK(__n);
1941 _GLIBCXX20_CONSTEXPR
1943 _M_erase(iterator __position);
1945 _GLIBCXX20_CONSTEXPR
1947 _M_erase(iterator __first, iterator __last);
1949#if __cplusplus >= 201103L
1954 _GLIBCXX20_CONSTEXPR
1959 this->_M_impl._M_swap_data(__x._M_impl);
1960 __tmp._M_impl._M_swap_data(__x._M_impl);
1961 std::__alloc_on_move(_M_get_Tp_allocator(), __x._M_get_Tp_allocator());
1966 _GLIBCXX20_CONSTEXPR
1970 if (__x._M_get_Tp_allocator() == this->_M_get_Tp_allocator())
1976 this->_M_assign_aux(std::make_move_iterator(__x.begin()),
1977 std::make_move_iterator(__x.end()),
1984 template<
typename _Up>
1985 _GLIBCXX20_CONSTEXPR
1987 _M_data_ptr(_Up* __ptr)
const _GLIBCXX_NOEXCEPT
1990#if __cplusplus >= 201103L
1991 template<
typename _Ptr>
1992 _GLIBCXX20_CONSTEXPR
1993 typename std::pointer_traits<_Ptr>::element_type*
1994 _M_data_ptr(_Ptr __ptr)
const
1995 {
return empty() ? nullptr : std::__to_address(__ptr); }
1997 template<
typename _Up>
1999 _M_data_ptr(_Up* __ptr) _GLIBCXX_NOEXCEPT
2002 template<
typename _Ptr>
2004 _M_data_ptr(_Ptr __ptr)
2005 {
return empty() ? (value_type*)0 : __ptr.operator->(); }
2007 template<
typename _Ptr>
2009 _M_data_ptr(_Ptr __ptr)
const
2010 {
return empty() ? (
const value_type*)0 : __ptr.operator->(); }
2014#if __cpp_deduction_guides >= 201606
2015 template<
typename _InputIterator,
typename _ValT
2016 =
typename iterator_traits<_InputIterator>::value_type,
2017 typename _Allocator = allocator<_ValT>,
2018 typename = _RequireInputIter<_InputIterator>,
2019 typename = _RequireAllocator<_Allocator>>
2020 vector(_InputIterator, _InputIterator, _Allocator = _Allocator())
2021 -> vector<_ValT, _Allocator>;
2034 template<
typename _Tp,
typename _Alloc>
2035 _GLIBCXX20_CONSTEXPR
2041#if __cpp_lib_three_way_comparison
2053 template<
typename _Tp,
typename _Alloc>
2054 _GLIBCXX20_CONSTEXPR
2055 inline __detail::__synth3way_t<_Tp>
2056 operator<=>(
const vector<_Tp, _Alloc>& __x,
const vector<_Tp, _Alloc>& __y)
2058 return std::lexicographical_compare_three_way(__x.begin(), __x.end(),
2059 __y.begin(), __y.end(),
2060 __detail::__synth3way);
2074 template<
typename _Tp,
typename _Alloc>
2077 {
return std::lexicographical_compare(__x.
begin(), __x.
end(),
2081 template<
typename _Tp,
typename _Alloc>
2084 {
return !(__x == __y); }
2087 template<
typename _Tp,
typename _Alloc>
2090 {
return __y < __x; }
2093 template<
typename _Tp,
typename _Alloc>
2096 {
return !(__y < __x); }
2099 template<
typename _Tp,
typename _Alloc>
2102 {
return !(__x < __y); }
2106 template<
typename _Tp,
typename _Alloc>
2107 _GLIBCXX20_CONSTEXPR
2110 _GLIBCXX_NOEXCEPT_IF(
noexcept(__x.swap(__y)))
2113_GLIBCXX_END_NAMESPACE_CONTAINER
2115#if __cplusplus >= 201703L
2116 namespace __detail::__variant
2118 template<
typename>
struct _Never_valueless_alt;
2122 template<
typename _Tp,
typename _Alloc>
2123 struct _Never_valueless_alt<_GLIBCXX_STD_C::vector<_Tp, _Alloc>>
2129_GLIBCXX_END_NAMESPACE_VERSION