860 using _Base::get_allocator;
871 {
return iterator(this->_M_impl._M_start); }
881 {
return const_iterator(this->_M_impl._M_start); }
891 {
return iterator(this->_M_impl._M_finish); }
901 {
return const_iterator(this->_M_impl._M_finish); }
919 const_reverse_iterator
939 const_reverse_iterator
943#if __cplusplus >= 201103L
952 {
return const_iterator(this->_M_impl._M_start); }
962 {
return const_iterator(this->_M_impl._M_finish); }
970 const_reverse_iterator
980 const_reverse_iterator
990 {
return size_type(this->_M_impl._M_finish -
this->_M_impl._M_start); }
996 {
return _S_max_size(_M_get_Tp_allocator()); }
998#if __cplusplus >= 201103L
1015 _M_erase_at_end(this->_M_impl._M_start +
__new_size);
1036 _M_erase_at_end(this->_M_impl._M_start +
__new_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(); }
1077 return size_type(this->_M_impl._M_end_of_storage
1078 -
this->_M_impl._M_start);
1127 __glibcxx_requires_subscript(__n);
1128 return *(this->_M_impl._M_start + __n);
1146 __glibcxx_requires_subscript(__n);
1147 return *(this->_M_impl._M_start + __n);
1156 if (__n >= this->
size())
1157 __throw_out_of_range_fmt(__N(
"vector::_M_range_check: __n "
1158 "(which is %zu) >= this->size() "
1180 return (*
this)[__n];
1199 return (*
this)[__n];
1210 __glibcxx_requires_nonempty();
1222 __glibcxx_requires_nonempty();
1234 __glibcxx_requires_nonempty();
1235 return *(
end() - 1);
1246 __glibcxx_requires_nonempty();
1247 return *(
end() - 1);
1260 {
return _M_data_ptr(this->_M_impl._M_start); }
1265 {
return _M_data_ptr(this->_M_impl._M_start); }
1278 _GLIBCXX20_CONSTEXPR
1282 if (this->_M_impl._M_finish !=
this->_M_impl._M_end_of_storage)
1284 _GLIBCXX_ASAN_ANNOTATE_GROW(1);
1285 _Alloc_traits::construct(this->_M_impl, this->_M_impl._M_finish,
1287 ++this->_M_impl._M_finish;
1288 _GLIBCXX_ASAN_ANNOTATE_GREW(1);
1291 _M_realloc_append(__x);
1294#if __cplusplus >= 201103L
1300 template<
typename... _Args>
1301#if __cplusplus > 201402L
1302 _GLIBCXX20_CONSTEXPR
1307 emplace_back(_Args&&... __args);
1319 _GLIBCXX20_CONSTEXPR
1323 __glibcxx_requires_nonempty();
1324 --this->_M_impl._M_finish;
1325 _Alloc_traits::destroy(this->_M_impl, this->_M_impl._M_finish);
1326 _GLIBCXX_ASAN_ANNOTATE_SHRINK(1);
1329#if __cplusplus >= 201103L
1342 template<
typename...
_Args>
1378#if __cplusplus >= 201103L
1413 _M_range_insert(
begin() + __offset,
__l.begin(),
__l.end(),
1415 return begin() + __offset;
1419#if __cplusplus >= 201103L
1439 _M_fill_insert(
begin() + __offset, __n, __x);
1440 return begin() + __offset;
1461#if __cplusplus >= 201103L
1477 template<
typename _InputIterator,
1479 _GLIBCXX20_CONSTEXPR
1482 _InputIterator __last)
1485 _M_range_insert(
begin() + __offset, __first, __last,
1487 return begin() + __offset;
1504 template<
typename _InputIterator>
1507 _InputIterator __last)
1510 typedef typename std::__is_integer<_InputIterator>::__type
_Integral;
1530 _GLIBCXX20_CONSTEXPR
1532#if __cplusplus >= 201103L
1558 _GLIBCXX20_CONSTEXPR
1560#if __cplusplus >= 201103L
1561 erase(const_iterator __first, const_iterator __last)
1569 {
return _M_erase(__first, __last); }
1583 _GLIBCXX20_CONSTEXPR
1587#if __cplusplus >= 201103L
1588 __glibcxx_assert(_Alloc_traits::propagate_on_container_swap::value
1589 || _M_get_Tp_allocator() == __x._M_get_Tp_allocator());
1591 this->_M_impl._M_swap_data(__x._M_impl);
1592 _Alloc_traits::_S_on_swap(_M_get_Tp_allocator(),
1593 __x._M_get_Tp_allocator());
1605 { _M_erase_at_end(this->_M_impl._M_start); }
1612 template<
typename _ForwardIterator>
1618 pointer __result = this->_M_allocate(__n);
1622 _M_get_Tp_allocator());
1627 _M_deallocate(__result, __n);
1628 __throw_exception_again;
1637#if __cplusplus < 201103L
1640 template<
typename _Integer>
1644 this->_M_impl._M_start = _M_allocate(_S_check_init_len(
1645 static_cast<size_type
>(__n), _M_get_Tp_allocator()));
1646 this->_M_impl._M_end_of_storage =
1647 this->_M_impl._M_start +
static_cast<size_type
>(__n);
1648 _M_fill_initialize(
static_cast<size_type
>(__n), __value);
1652 template<
typename _InputIterator>
1654 _M_initialize_dispatch(_InputIterator __first, _InputIterator __last,
1657 _M_range_initialize(__first, __last,
1663 template<
typename _InputIterator>
1664 _GLIBCXX20_CONSTEXPR
1666 _M_range_initialize(_InputIterator __first, _InputIterator __last,
1670 for (; __first != __last; ++__first)
1671#
if __cplusplus >= 201103L
1672 emplace_back(*__first);
1678 __throw_exception_again;
1683 template<
typename _ForwardIterator>
1684 _GLIBCXX20_CONSTEXPR
1686 _M_range_initialize(_ForwardIterator __first, _ForwardIterator __last,
1690 this->_M_impl._M_start
1691 = this->_M_allocate(_S_check_init_len(__n, _M_get_Tp_allocator()));
1692 this->_M_impl._M_end_of_storage = this->_M_impl._M_start + __n;
1693 this->_M_impl._M_finish =
1695 this->_M_impl._M_start,
1696 _M_get_Tp_allocator());
1701 _GLIBCXX20_CONSTEXPR
1703 _M_fill_initialize(size_type __n,
const value_type& __value)
1705 this->_M_impl._M_finish =
1707 _M_get_Tp_allocator());
1710#if __cplusplus >= 201103L
1712 _GLIBCXX20_CONSTEXPR
1714 _M_default_initialize(size_type __n)
1716 this->_M_impl._M_finish =
1718 _M_get_Tp_allocator());
1729 template<
typename _Integer>
1730 _GLIBCXX20_CONSTEXPR
1732 _M_assign_dispatch(_Integer __n, _Integer __val, __true_type)
1733 { _M_fill_assign(__n, __val); }
1736 template<
typename _InputIterator>
1737 _GLIBCXX20_CONSTEXPR
1739 _M_assign_dispatch(_InputIterator __first, _InputIterator __last,
1744 template<
typename _InputIterator>
1745 _GLIBCXX20_CONSTEXPR
1747 _M_assign_aux(_InputIterator __first, _InputIterator __last,
1751 template<
typename _ForwardIterator>
1752 _GLIBCXX20_CONSTEXPR
1754 _M_assign_aux(_ForwardIterator __first, _ForwardIterator __last,
1759 _GLIBCXX20_CONSTEXPR
1761 _M_fill_assign(size_type __n,
const value_type& __val);
1769 template<
typename _Integer>
1770 _GLIBCXX20_CONSTEXPR
1772 _M_insert_dispatch(iterator __pos, _Integer __n, _Integer __val,
1774 { _M_fill_insert(__pos, __n, __val); }
1777 template<
typename _InputIterator>
1778 _GLIBCXX20_CONSTEXPR
1780 _M_insert_dispatch(iterator __pos, _InputIterator __first,
1781 _InputIterator __last, __false_type)
1783 _M_range_insert(__pos, __first, __last,
1788 template<
typename _InputIterator>
1789 _GLIBCXX20_CONSTEXPR
1791 _M_range_insert(iterator __pos, _InputIterator __first,
1795 template<
typename _ForwardIterator>
1796 _GLIBCXX20_CONSTEXPR
1798 _M_range_insert(iterator __pos, _ForwardIterator __first,
1803 _GLIBCXX20_CONSTEXPR
1805 _M_fill_insert(iterator __pos, size_type __n,
const value_type& __x);
1807#if __cplusplus >= 201103L
1809 _GLIBCXX20_CONSTEXPR
1811 _M_default_append(size_type __n);
1813 _GLIBCXX20_CONSTEXPR
1818#if __cplusplus < 201103L
1821 _M_insert_aux(iterator __position,
const value_type& __x);
1824 _M_realloc_insert(iterator __position,
const value_type& __x);
1827 _M_realloc_append(
const value_type& __x);
1831 struct _Temporary_value
1833 template<
typename... _Args>
1834 _GLIBCXX20_CONSTEXPR
explicit
1835 _Temporary_value(vector* __vec, _Args&&... __args) : _M_this(__vec)
1837 _Alloc_traits::construct(_M_this->_M_impl, _M_ptr(),
1841 _GLIBCXX20_CONSTEXPR
1843 { _Alloc_traits::destroy(_M_this->_M_impl, _M_ptr()); }
1845 _GLIBCXX20_CONSTEXPR value_type&
1846 _M_val() noexcept {
return _M_storage._M_val; }
1849 _GLIBCXX20_CONSTEXPR _Tp*
1854 constexpr _Storage() : _M_byte() { }
1855 _GLIBCXX20_CONSTEXPR ~_Storage() { }
1856 _Storage& operator=(
const _Storage&) =
delete;
1857 unsigned char _M_byte;
1862 _Storage _M_storage;
1867 template<
typename _Arg>
1868 _GLIBCXX20_CONSTEXPR
1870 _M_insert_aux(iterator __position, _Arg&& __arg);
1872 template<
typename... _Args>
1873 _GLIBCXX20_CONSTEXPR
1875 _M_realloc_insert(iterator __position, _Args&&... __args);
1877 template<
typename... _Args>
1878 _GLIBCXX20_CONSTEXPR
1880 _M_realloc_append(_Args&&... __args);
1883 _GLIBCXX20_CONSTEXPR
1885 _M_insert_rval(const_iterator __position, value_type&& __v);
1888 template<
typename... _Args>
1889 _GLIBCXX20_CONSTEXPR
1891 _M_emplace_aux(const_iterator __position, _Args&&... __args);
1894 _GLIBCXX20_CONSTEXPR
1896 _M_emplace_aux(const_iterator __position, value_type&& __v)
1897 {
return _M_insert_rval(__position,
std::move(__v)); }
1901 _GLIBCXX20_CONSTEXPR
1903 _M_check_len(size_type __n,
const char* __s)
const
1906 __throw_length_error(__N(__s));
1913 static _GLIBCXX20_CONSTEXPR size_type
1914 _S_check_init_len(size_type __n,
const allocator_type& __a)
1916 if (__n > _S_max_size(_Tp_alloc_type(__a)))
1917 __throw_length_error(
1918 __N(
"cannot create std::vector larger than max_size()"));
1922 static _GLIBCXX20_CONSTEXPR size_type
1923 _S_max_size(
const _Tp_alloc_type& __a) _GLIBCXX_NOEXCEPT
1928 const size_t __diffmax
1929 = __gnu_cxx::__numeric_traits<ptrdiff_t>::__max /
sizeof(_Tp);
1931 return (
std::min)(__diffmax, __allocmax);
1938 _GLIBCXX20_CONSTEXPR
1940 _M_erase_at_end(pointer __pos) _GLIBCXX_NOEXCEPT
1942 if (size_type __n = this->_M_impl._M_finish - __pos)
1945 _M_get_Tp_allocator());
1946 this->_M_impl._M_finish = __pos;
1947 _GLIBCXX_ASAN_ANNOTATE_SHRINK(__n);
1951 _GLIBCXX20_CONSTEXPR
1953 _M_erase(iterator __position);
1955 _GLIBCXX20_CONSTEXPR
1957 _M_erase(iterator __first, iterator __last);
1959#if __cplusplus >= 201103L
1964 _GLIBCXX20_CONSTEXPR
1966 _M_move_assign(vector&& __x, true_type)
noexcept
1969 this->_M_impl._M_swap_data(__x._M_impl);
1970 __tmp._M_impl._M_swap_data(__x._M_impl);
1976 _GLIBCXX20_CONSTEXPR
1978 _M_move_assign(vector&& __x, false_type)
1980 if (__x._M_get_Tp_allocator() == this->_M_get_Tp_allocator())
1986 this->_M_assign_aux(std::make_move_iterator(__x.begin()),
1987 std::make_move_iterator(__x.end()),
1994 template<
typename _Up>
1995 _GLIBCXX20_CONSTEXPR
1997 _M_data_ptr(_Up* __ptr)
const _GLIBCXX_NOEXCEPT
2000#if __cplusplus >= 201103L
2001 template<
typename _Ptr>
2002 _GLIBCXX20_CONSTEXPR
2004 _M_data_ptr(_Ptr __ptr)
const
2005 {
return empty() ? nullptr : std::__to_address(__ptr); }
2007 template<
typename _Up>
2009 _M_data_ptr(_Up* __ptr) _GLIBCXX_NOEXCEPT
2012 template<
typename _Ptr>
2014 _M_data_ptr(_Ptr __ptr)
2015 {
return empty() ? (value_type*)0 : __ptr.operator->(); }
2017 template<
typename _Ptr>
2019 _M_data_ptr(_Ptr __ptr)
const
2020 {
return empty() ? (
const value_type*)0 : __ptr.operator->(); }
2024#if __cpp_deduction_guides >= 201606
2025 template<
typename _InputIterator,
typename _ValT
2026 =
typename iterator_traits<_InputIterator>::value_type,
2027 typename _Allocator = allocator<_ValT>,
2028 typename = _RequireInputIter<_InputIterator>,
2029 typename = _RequireAllocator<_Allocator>>
2030 vector(_InputIterator, _InputIterator, _Allocator = _Allocator())
2031 -> vector<_ValT, _Allocator>;
2044 template<
typename _Tp,
typename _Alloc>
2045 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
2048 {
return (__x.size() ==
__y.size()
2049 && std::equal(__x.begin(), __x.end(),
__y.begin())); }
2051#if __cpp_lib_three_way_comparison
2063 template<
typename _Tp,
typename _Alloc>
2065 inline __detail::__synth3way_t<_Tp>
2070 __detail::__synth3way);
2084 template<
typename _Tp,
typename _Alloc>
2085 _GLIBCXX_NODISCARD
inline bool
2086 operator<(
const vector<_Tp, _Alloc>& __x,
const vector<_Tp, _Alloc>& __y)
2087 {
return std::lexicographical_compare(__x.begin(), __x.end(),
2088 __y.begin(), __y.end()); }
2091 template<
typename _Tp,
typename _Alloc>
2092 _GLIBCXX_NODISCARD
inline bool
2093 operator!=(
const vector<_Tp, _Alloc>& __x,
const vector<_Tp, _Alloc>& __y)
2094 {
return !(__x == __y); }
2097 template<
typename _Tp,
typename _Alloc>
2098 _GLIBCXX_NODISCARD
inline bool
2099 operator>(
const vector<_Tp, _Alloc>& __x,
const vector<_Tp, _Alloc>& __y)
2100 {
return __y < __x; }
2103 template<
typename _Tp,
typename _Alloc>
2104 _GLIBCXX_NODISCARD
inline bool
2105 operator<=(
const vector<_Tp, _Alloc>& __x,
const vector<_Tp, _Alloc>& __y)
2106 {
return !(__y < __x); }
2109 template<
typename _Tp,
typename _Alloc>
2110 _GLIBCXX_NODISCARD
inline bool
2111 operator>=(
const vector<_Tp, _Alloc>& __x,
const vector<_Tp, _Alloc>& __y)
2112 {
return !(__x < __y); }
2116 template<
typename _Tp,
typename _Alloc>
2117 _GLIBCXX20_CONSTEXPR
2123_GLIBCXX_END_NAMESPACE_CONTAINER
2125#if __cplusplus >= 201703L
2126 namespace __detail::__variant
2128 template<
typename>
struct _Never_valueless_alt;
2132 template<
typename _Tp,
typename _Alloc>
2133 struct _Never_valueless_alt<_GLIBCXX_STD_C::vector<_Tp, _Alloc>>
2139_GLIBCXX_END_NAMESPACE_VERSION