876 using _Base::get_allocator;
887 {
return iterator(this->_M_impl._M_start); }
897 {
return const_iterator(this->_M_impl._M_start); }
907 {
return iterator(this->_M_impl._M_finish); }
917 {
return const_iterator(this->_M_impl._M_finish); }
935 const_reverse_iterator
955 const_reverse_iterator
959#if __cplusplus >= 201103L
968 {
return const_iterator(this->_M_impl._M_start); }
978 {
return const_iterator(this->_M_impl._M_finish); }
986 const_reverse_iterator
996 const_reverse_iterator
1006 {
return size_type(this->_M_impl._M_finish -
this->_M_impl._M_start); }
1012 {
return _S_max_size(_M_get_Tp_allocator()); }
1014#if __cplusplus >= 201103L
1031 _M_erase_at_end(this->_M_impl._M_start +
__new_size);
1052 _M_erase_at_end(this->_M_impl._M_start +
__new_size);
1073 _M_erase_at_end(this->_M_impl._M_start +
__new_size);
1077#if __cplusplus >= 201103L
1079 _GLIBCXX20_CONSTEXPR
1082 { _M_shrink_to_fit(); }
1093 return size_type(this->_M_impl._M_end_of_storage
1094 -
this->_M_impl._M_start);
1143 __glibcxx_requires_subscript(__n);
1144 return *(this->_M_impl._M_start + __n);
1162 __glibcxx_requires_subscript(__n);
1163 return *(this->_M_impl._M_start + __n);
1172 if (__n >= this->
size())
1173 __throw_out_of_range_fmt(__N(
"vector::_M_range_check: __n "
1174 "(which is %zu) >= this->size() "
1196 return (*
this)[__n];
1215 return (*
this)[__n];
1226 __glibcxx_requires_nonempty();
1238 __glibcxx_requires_nonempty();
1250 __glibcxx_requires_nonempty();
1251 return *(
end() - 1);
1262 __glibcxx_requires_nonempty();
1263 return *(
end() - 1);
1276 {
return _M_data_ptr(this->_M_impl._M_start); }
1281 {
return _M_data_ptr(this->_M_impl._M_start); }
1294 _GLIBCXX20_CONSTEXPR
1298 if (this->_M_impl._M_finish !=
this->_M_impl._M_end_of_storage)
1300 _GLIBCXX_ASAN_ANNOTATE_GROW(1);
1301 _Alloc_traits::construct(this->_M_impl, this->_M_impl._M_finish,
1303 ++this->_M_impl._M_finish;
1304 _GLIBCXX_ASAN_ANNOTATE_GREW(1);
1307 _M_realloc_append(__x);
1310#if __cplusplus >= 201103L
1316 template<
typename... _Args>
1317#if __cplusplus > 201402L
1318 _GLIBCXX20_CONSTEXPR
1323 emplace_back(_Args&&... __args);
1335 _GLIBCXX20_CONSTEXPR
1339 __glibcxx_requires_nonempty();
1340 --this->_M_impl._M_finish;
1341 _Alloc_traits::destroy(this->_M_impl, this->_M_impl._M_finish);
1342 _GLIBCXX_ASAN_ANNOTATE_SHRINK(1);
1345#if __cplusplus >= 201103L
1358 template<
typename...
_Args>
1394#if __cplusplus >= 201103L
1429 _M_range_insert(
begin() + __offset,
__l.begin(),
__l.end(),
1431 return begin() + __offset;
1435#if __cplusplus >= 201103L
1455 _M_fill_insert(
begin() + __offset, __n, __x);
1456 return begin() + __offset;
1477#if __cplusplus >= 201103L
1493 template<
typename _InputIterator,
1495 _GLIBCXX20_CONSTEXPR
1501 _M_range_insert(
begin() + __offset, __first, __last,
1503 return begin() + __offset;
1520 template<
typename _InputIterator>
1526 typedef typename std::__is_integer<_InputIterator>::__type
_Integral;
1546 _GLIBCXX20_CONSTEXPR
1548#if __cplusplus >= 201103L
1574 _GLIBCXX20_CONSTEXPR
1576#if __cplusplus >= 201103L
1577 erase(const_iterator __first, const_iterator __last)
1585 {
return _M_erase(__first, __last); }
1599 _GLIBCXX20_CONSTEXPR
1603#if __cplusplus >= 201103L
1604 __glibcxx_assert(_Alloc_traits::propagate_on_container_swap::value
1605 || _M_get_Tp_allocator() == __x._M_get_Tp_allocator());
1607 this->_M_impl._M_swap_data(__x._M_impl);
1608 _Alloc_traits::_S_on_swap(_M_get_Tp_allocator(),
1609 __x._M_get_Tp_allocator());
1621 { _M_erase_at_end(this->_M_impl._M_start); }
1628 template<
typename _ForwardIterator>
1634 pointer __result = this->_M_allocate(__n);
1638 _M_get_Tp_allocator());
1643 _M_deallocate(__result, __n);
1644 __throw_exception_again;
1653#if __cplusplus < 201103L
1656 template<
typename _Integer>
1660 this->_M_impl._M_start = _M_allocate(_S_check_init_len(
1661 static_cast<size_type
>(__n), _M_get_Tp_allocator()));
1662 this->_M_impl._M_end_of_storage =
1663 this->_M_impl._M_start +
static_cast<size_type
>(__n);
1664 _M_fill_initialize(
static_cast<size_type
>(__n), __value);
1668 template<
typename _InputIterator>
1670 _M_initialize_dispatch(_InputIterator __first, _InputIterator __last,
1673 _M_range_initialize(__first, __last,
1679 template<
typename _InputIterator>
1680 _GLIBCXX20_CONSTEXPR
1682 _M_range_initialize(_InputIterator __first, _InputIterator __last,
1686 for (; __first != __last; ++__first)
1687#
if __cplusplus >= 201103L
1688 emplace_back(*__first);
1694 __throw_exception_again;
1699 template<
typename _ForwardIterator>
1700 _GLIBCXX20_CONSTEXPR
1702 _M_range_initialize(_ForwardIterator __first, _ForwardIterator __last,
1705 _M_range_initialize_n(__first, __last,
1709 template<
typename _Iterator>
1710 _GLIBCXX20_CONSTEXPR
1712 _M_range_initialize_n(_Iterator __first, _Iterator __last,
1715 pointer __start = this->_M_impl._M_start =
1716 this->_M_allocate(_S_check_init_len(__n, _M_get_Tp_allocator()));
1717 this->_M_impl._M_end_of_storage = __start + __n;
1718 this->_M_impl._M_finish
1720 __start, _M_get_Tp_allocator());
1725 _GLIBCXX20_CONSTEXPR
1727 _M_fill_initialize(size_type __n,
const value_type& __value)
1729 this->_M_impl._M_finish =
1731 _M_get_Tp_allocator());
1734#if __cplusplus >= 201103L
1736 _GLIBCXX20_CONSTEXPR
1738 _M_default_initialize(size_type __n)
1740 this->_M_impl._M_finish =
1742 _M_get_Tp_allocator());
1753 template<
typename _Integer>
1754 _GLIBCXX20_CONSTEXPR
1756 _M_assign_dispatch(_Integer __n, _Integer __val, __true_type)
1757 { _M_fill_assign(__n, __val); }
1760 template<
typename _InputIterator>
1761 _GLIBCXX20_CONSTEXPR
1763 _M_assign_dispatch(_InputIterator __first, _InputIterator __last,
1768 template<
typename _InputIterator>
1769 _GLIBCXX20_CONSTEXPR
1771 _M_assign_aux(_InputIterator __first, _InputIterator __last,
1775 template<
typename _ForwardIterator>
1776 _GLIBCXX20_CONSTEXPR
1778 _M_assign_aux(_ForwardIterator __first, _ForwardIterator __last,
1783 _GLIBCXX20_CONSTEXPR
1785 _M_fill_assign(size_type __n,
const value_type& __val);
1793 template<
typename _Integer>
1794 _GLIBCXX20_CONSTEXPR
1796 _M_insert_dispatch(iterator __pos, _Integer __n, _Integer __val,
1798 { _M_fill_insert(__pos, __n, __val); }
1801 template<
typename _InputIterator>
1802 _GLIBCXX20_CONSTEXPR
1804 _M_insert_dispatch(iterator __pos, _InputIterator __first,
1805 _InputIterator __last, __false_type)
1807 _M_range_insert(__pos, __first, __last,
1812 template<
typename _InputIterator>
1813 _GLIBCXX20_CONSTEXPR
1815 _M_range_insert(iterator __pos, _InputIterator __first,
1819 template<
typename _ForwardIterator>
1820 _GLIBCXX20_CONSTEXPR
1822 _M_range_insert(iterator __pos, _ForwardIterator __first,
1827 _GLIBCXX20_CONSTEXPR
1829 _M_fill_insert(iterator __pos, size_type __n,
const value_type& __x);
1831#if __cplusplus >= 201103L
1833 _GLIBCXX20_CONSTEXPR
1835 _M_default_append(size_type __n);
1837 _GLIBCXX20_CONSTEXPR
1842#if __cplusplus < 201103L
1845 _M_insert_aux(iterator __position,
const value_type& __x);
1848 _M_realloc_insert(iterator __position,
const value_type& __x);
1851 _M_realloc_append(
const value_type& __x);
1855 struct _Temporary_value
1857 template<
typename... _Args>
1858 _GLIBCXX20_CONSTEXPR
explicit
1859 _Temporary_value(
vector* __vec, _Args&&... __args) : _M_this(__vec)
1861 _Alloc_traits::construct(_M_this->_M_impl, _M_ptr(),
1865 _GLIBCXX20_CONSTEXPR
1867 { _Alloc_traits::destroy(_M_this->_M_impl, _M_ptr()); }
1869 _GLIBCXX20_CONSTEXPR value_type&
1870 _M_val() noexcept {
return _M_storage._M_val; }
1873 _GLIBCXX20_CONSTEXPR _Tp*
1878 constexpr _Storage() : _M_byte() { }
1879 _GLIBCXX20_CONSTEXPR ~_Storage() { }
1880 _Storage& operator=(
const _Storage&) =
delete;
1881 unsigned char _M_byte;
1886 _Storage _M_storage;
1891 template<
typename _Arg>
1892 _GLIBCXX20_CONSTEXPR
1894 _M_insert_aux(iterator __position, _Arg&& __arg);
1896 template<
typename... _Args>
1897 _GLIBCXX20_CONSTEXPR
1899 _M_realloc_insert(iterator __position, _Args&&... __args);
1901 template<
typename... _Args>
1902 _GLIBCXX20_CONSTEXPR
1904 _M_realloc_append(_Args&&... __args);
1907 _GLIBCXX20_CONSTEXPR
1909 _M_insert_rval(const_iterator __position, value_type&& __v);
1912 template<
typename... _Args>
1913 _GLIBCXX20_CONSTEXPR
1915 _M_emplace_aux(const_iterator __position, _Args&&... __args);
1918 _GLIBCXX20_CONSTEXPR
1920 _M_emplace_aux(const_iterator __position, value_type&& __v)
1921 {
return _M_insert_rval(__position,
std::move(__v)); }
1925 _GLIBCXX20_CONSTEXPR
1927 _M_check_len(size_type __n,
const char* __s)
const
1930 __throw_length_error(__N(__s));
1937 static _GLIBCXX20_CONSTEXPR size_type
1938 _S_check_init_len(size_type __n,
const allocator_type& __a)
1940 if (__n > _S_max_size(_Tp_alloc_type(__a)))
1941 __throw_length_error(
1942 __N(
"cannot create std::vector larger than max_size()"));
1946 static _GLIBCXX20_CONSTEXPR size_type
1947 _S_max_size(
const _Tp_alloc_type& __a) _GLIBCXX_NOEXCEPT
1952 const size_t __diffmax
1953 = __gnu_cxx::__numeric_traits<ptrdiff_t>::__max /
sizeof(_Tp);
1955 return (
std::min)(__diffmax, __allocmax);
1962 _GLIBCXX20_CONSTEXPR
1964 _M_erase_at_end(pointer __pos) _GLIBCXX_NOEXCEPT
1966 if (size_type __n = this->_M_impl._M_finish - __pos)
1969 _M_get_Tp_allocator());
1970 this->_M_impl._M_finish = __pos;
1971 _GLIBCXX_ASAN_ANNOTATE_SHRINK(__n);
1975 _GLIBCXX20_CONSTEXPR
1977 _M_erase(iterator __position);
1979 _GLIBCXX20_CONSTEXPR
1981 _M_erase(iterator __first, iterator __last);
1983#if __cplusplus >= 201103L
1988 _GLIBCXX20_CONSTEXPR
1993 this->_M_impl._M_swap_data(__x._M_impl);
1994 __tmp._M_impl._M_swap_data(__x._M_impl);
2000 _GLIBCXX20_CONSTEXPR
2004 if (__x._M_get_Tp_allocator() == this->_M_get_Tp_allocator())
2010 this->_M_assign_aux(std::make_move_iterator(__x.begin()),
2011 std::make_move_iterator(__x.end()),
2018 template<
typename _Up>
2019 _GLIBCXX20_CONSTEXPR
2021 _M_data_ptr(_Up* __ptr)
const _GLIBCXX_NOEXCEPT
2024#if __cplusplus >= 201103L
2025 template<
typename _Ptr>
2026 _GLIBCXX20_CONSTEXPR
2028 _M_data_ptr(_Ptr __ptr)
const
2029 {
return empty() ? nullptr : std::__to_address(__ptr); }
2031 template<
typename _Up>
2033 _M_data_ptr(_Up* __ptr) _GLIBCXX_NOEXCEPT
2036 template<
typename _Ptr>
2038 _M_data_ptr(_Ptr __ptr)
2039 {
return empty() ? (value_type*)0 : __ptr.operator->(); }
2041 template<
typename _Ptr>
2043 _M_data_ptr(_Ptr __ptr)
const
2044 {
return empty() ? (
const value_type*)0 : __ptr.operator->(); }
2048#if __cpp_deduction_guides >= 201606
2049 template<
typename _InputIterator,
typename _ValT
2050 =
typename iterator_traits<_InputIterator>::value_type,
2051 typename _Allocator = allocator<_ValT>,
2052 typename = _RequireInputIter<_InputIterator>,
2053 typename = _RequireAllocator<_Allocator>>
2054 vector(_InputIterator, _InputIterator, _Allocator = _Allocator())
2055 -> vector<_ValT, _Allocator>;
2068 template<
typename _Tp,
typename _Alloc>
2069 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
2072 {
return (__x.size() == __y.size()
2073 && std::equal(__x.begin(), __x.end(), __y.begin())); }
2075#if __cpp_lib_three_way_comparison
2087 template<
typename _Tp,
typename _Alloc>
2089 constexpr __detail::__synth3way_t<_Tp>
2093 __y.begin(), __y.end(),
2094 __detail::__synth3way);
2108 template<
typename _Tp,
typename _Alloc>
2109 _GLIBCXX_NODISCARD
inline bool
2110 operator<(
const vector<_Tp, _Alloc>& __x,
const vector<_Tp, _Alloc>& __y)
2111 {
return std::lexicographical_compare(__x.begin(), __x.end(),
2112 __y.begin(), __y.end()); }
2115 template<
typename _Tp,
typename _Alloc>
2116 _GLIBCXX_NODISCARD
inline bool
2117 operator!=(
const vector<_Tp, _Alloc>& __x,
const vector<_Tp, _Alloc>& __y)
2118 {
return !(__x == __y); }
2121 template<
typename _Tp,
typename _Alloc>
2122 _GLIBCXX_NODISCARD
inline bool
2123 operator>(
const vector<_Tp, _Alloc>& __x,
const vector<_Tp, _Alloc>& __y)
2124 {
return __y < __x; }
2127 template<
typename _Tp,
typename _Alloc>
2128 _GLIBCXX_NODISCARD
inline bool
2129 operator<=(
const vector<_Tp, _Alloc>& __x,
const vector<_Tp, _Alloc>& __y)
2130 {
return !(__y < __x); }
2133 template<
typename _Tp,
typename _Alloc>
2134 _GLIBCXX_NODISCARD
inline bool
2135 operator>=(
const vector<_Tp, _Alloc>& __x,
const vector<_Tp, _Alloc>& __y)
2136 {
return !(__x < __y); }
2140 template<
typename _Tp,
typename _Alloc>
2141 _GLIBCXX20_CONSTEXPR
2147_GLIBCXX_END_NAMESPACE_CONTAINER
2149#if __cplusplus >= 201703L
2150 namespace __detail::__variant
2152 template<
typename>
struct _Never_valueless_alt;
2156 template<
typename _Tp,
typename _Alloc>
2157 struct _Never_valueless_alt<_GLIBCXX_STD_C::vector<_Tp, _Alloc>>
2163_GLIBCXX_END_NAMESPACE_VERSION