57 #define _STL_VECTOR_H 1 62 #if __cplusplus >= 201103L 68 namespace std _GLIBCXX_VISIBILITY(default)
70 _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
73 template<
typename _Tp,
typename _Alloc>
77 rebind<_Tp>::other _Tp_alloc_type;
78 typedef typename __gnu_cxx::__alloc_traits<_Tp_alloc_type>::pointer
82 :
public _Tp_alloc_type
86 pointer _M_end_of_storage;
89 : _Tp_alloc_type(), _M_start(), _M_finish(), _M_end_of_storage()
92 _Vector_impl(_Tp_alloc_type
const& __a) _GLIBCXX_NOEXCEPT
93 : _Tp_alloc_type(__a), _M_start(), _M_finish(), _M_end_of_storage()
96 #if __cplusplus >= 201103L 97 _Vector_impl(_Tp_alloc_type&& __a) noexcept
98 : _Tp_alloc_type(std::move(__a)),
99 _M_start(), _M_finish(), _M_end_of_storage()
103 void _M_swap_data(_Vector_impl& __x) _GLIBCXX_NOEXCEPT
105 std::swap(_M_start, __x._M_start);
106 std::swap(_M_finish, __x._M_finish);
107 std::swap(_M_end_of_storage, __x._M_end_of_storage);
112 typedef _Alloc allocator_type;
115 _M_get_Tp_allocator() _GLIBCXX_NOEXCEPT
116 {
return *
static_cast<_Tp_alloc_type*
>(&this->_M_impl); }
118 const _Tp_alloc_type&
119 _M_get_Tp_allocator()
const _GLIBCXX_NOEXCEPT
120 {
return *
static_cast<const _Tp_alloc_type*
>(&this->_M_impl); }
123 get_allocator()
const _GLIBCXX_NOEXCEPT
124 {
return allocator_type(_M_get_Tp_allocator()); }
129 _Vector_base(
const allocator_type& __a) _GLIBCXX_NOEXCEPT
134 { _M_create_storage(__n); }
138 { _M_create_storage(__n); }
140 #if __cplusplus >= 201103L 142 : _M_impl(std::move(__a)) { }
145 : _M_impl(std::move(__x._M_get_Tp_allocator()))
146 { this->_M_impl._M_swap_data(__x._M_impl); }
151 if (__x.get_allocator() == __a)
152 this->_M_impl._M_swap_data(__x._M_impl);
155 size_t __n = __x._M_impl._M_finish - __x._M_impl._M_start;
156 _M_create_storage(__n);
162 { _M_deallocate(this->_M_impl._M_start, this->_M_impl._M_end_of_storage
163 - this->_M_impl._M_start); }
166 _Vector_impl _M_impl;
169 _M_allocate(
size_t __n)
172 return __n != 0 ? _Tr::allocate(_M_impl, __n) : pointer();
176 _M_deallocate(pointer __p,
size_t __n)
180 _Tr::deallocate(_M_impl, __p, __n);
185 _M_create_storage(
size_t __n)
187 this->_M_impl._M_start = this->_M_allocate(__n);
188 this->_M_impl._M_finish = this->_M_impl._M_start;
189 this->_M_impl._M_end_of_storage = this->_M_impl._M_start + __n;
215 template<
typename _Tp,
typename _Alloc = std::allocator<_Tp> >
218 #ifdef _GLIBCXX_CONCEPT_CHECKS 220 typedef typename _Alloc::value_type _Alloc_value_type;
221 # if __cplusplus < 201103L 222 __glibcxx_class_requires(_Tp, _SGIAssignableConcept)
224 __glibcxx_class_requires2(_Tp, _Alloc_value_type, _SameTypeConcept)
228 typedef typename _Base::_Tp_alloc_type _Tp_alloc_type;
232 typedef _Tp value_type;
233 typedef typename _Base::pointer pointer;
234 typedef typename _Alloc_traits::const_pointer const_pointer;
235 typedef typename _Alloc_traits::reference reference;
236 typedef typename _Alloc_traits::const_reference const_reference;
237 typedef __gnu_cxx::__normal_iterator<pointer, vector> iterator;
238 typedef __gnu_cxx::__normal_iterator<const_pointer, vector>
242 typedef size_t size_type;
243 typedef ptrdiff_t difference_type;
244 typedef _Alloc allocator_type;
247 using _Base::_M_allocate;
248 using _Base::_M_deallocate;
249 using _Base::_M_impl;
250 using _Base::_M_get_Tp_allocator;
260 #if __cplusplus >= 201103L 261 noexcept(is_nothrow_default_constructible<_Alloc>::value)
270 vector(
const allocator_type& __a) _GLIBCXX_NOEXCEPT
273 #if __cplusplus >= 201103L 283 vector(size_type __n,
const allocator_type& __a = allocator_type())
285 { _M_default_initialize(__n); }
295 vector(size_type __n,
const value_type& __value,
296 const allocator_type& __a = allocator_type())
298 { _M_fill_initialize(__n, __value); }
309 vector(size_type __n,
const value_type& __value = value_type(),
310 const allocator_type& __a = allocator_type())
312 { _M_fill_initialize(__n, __value); }
328 _Alloc_traits::_S_select_on_copy(__x._M_get_Tp_allocator()))
330 this->_M_impl._M_finish =
331 std::__uninitialized_copy_a(__x.
begin(), __x.
end(),
332 this->_M_impl._M_start,
333 _M_get_Tp_allocator());
336 #if __cplusplus >= 201103L 345 : _Base(
std::move(__x)) { }
349 : _Base(__x.size(), __a)
351 this->_M_impl._M_finish =
352 std::__uninitialized_copy_a(__x.
begin(), __x.
end(),
353 this->_M_impl._M_start,
354 _M_get_Tp_allocator());
359 noexcept(_Alloc_traits::_S_always_equal())
360 : _Base(
std::move(__rv), __m)
362 if (__rv.get_allocator() != __m)
364 this->_M_impl._M_finish =
365 std::__uninitialized_move_a(__rv.begin(), __rv.end(),
366 this->_M_impl._M_start,
367 _M_get_Tp_allocator());
384 const allocator_type& __a = allocator_type())
387 _M_range_initialize(__l.begin(), __l.end(),
408 #if __cplusplus >= 201103L 409 template<
typename _InputIterator,
410 typename = std::_RequireInputIter<_InputIterator>>
411 vector(_InputIterator __first, _InputIterator __last,
412 const allocator_type& __a = allocator_type())
414 { _M_initialize_dispatch(__first, __last, __false_type()); }
416 template<
typename _InputIterator>
417 vector(_InputIterator __first, _InputIterator __last,
418 const allocator_type& __a = allocator_type())
422 typedef typename std::__is_integer<_InputIterator>::__type _Integral;
423 _M_initialize_dispatch(__first, __last, _Integral());
434 {
std::_Destroy(this->_M_impl._M_start, this->_M_impl._M_finish,
435 _M_get_Tp_allocator()); }
447 operator=(
const vector& __x);
449 #if __cplusplus >= 201103L 463 constexpr
bool __move_storage =
464 _Alloc_traits::_S_propagate_on_move_assign()
465 || _Alloc_traits::_S_always_equal();
484 this->_M_assign_aux(__l.begin(), __l.end(),
501 assign(size_type __n,
const value_type& __val)
502 { _M_fill_assign(__n, __val); }
516 #if __cplusplus >= 201103L 517 template<
typename _InputIterator,
518 typename = std::_RequireInputIter<_InputIterator>>
520 assign(_InputIterator __first, _InputIterator __last)
521 { _M_assign_dispatch(__first, __last, __false_type()); }
523 template<
typename _InputIterator>
525 assign(_InputIterator __first, _InputIterator __last)
528 typedef typename std::__is_integer<_InputIterator>::__type _Integral;
529 _M_assign_dispatch(__first, __last, _Integral());
533 #if __cplusplus >= 201103L 548 this->_M_assign_aux(__l.begin(), __l.end(),
554 using _Base::get_allocator;
564 {
return iterator(this->_M_impl._M_start); }
573 {
return const_iterator(this->_M_impl._M_start); }
582 {
return iterator(this->_M_impl._M_finish); }
590 end() const _GLIBCXX_NOEXCEPT
591 {
return const_iterator(this->_M_impl._M_finish); }
600 {
return reverse_iterator(
end()); }
607 const_reverse_iterator
609 {
return const_reverse_iterator(
end()); }
618 {
return reverse_iterator(
begin()); }
625 const_reverse_iterator
627 {
return const_reverse_iterator(
begin()); }
629 #if __cplusplus >= 201103L 637 {
return const_iterator(this->_M_impl._M_start); }
646 {
return const_iterator(this->_M_impl._M_finish); }
653 const_reverse_iterator
655 {
return const_reverse_iterator(
end()); }
662 const_reverse_iterator
664 {
return const_reverse_iterator(
begin()); }
671 {
return size_type(this->_M_impl._M_finish - this->_M_impl._M_start); }
676 {
return _Alloc_traits::max_size(_M_get_Tp_allocator()); }
678 #if __cplusplus >= 201103L 691 if (__new_size > size())
692 _M_default_append(__new_size - size());
693 else if (__new_size < size())
694 _M_erase_at_end(this->_M_impl._M_start + __new_size);
709 resize(size_type __new_size,
const value_type& __x)
711 if (__new_size > size())
712 _M_fill_insert(
end(), __new_size - size(), __x);
713 else if (__new_size < size())
714 _M_erase_at_end(this->_M_impl._M_start + __new_size);
729 resize(size_type __new_size, value_type __x = value_type())
731 if (__new_size > size())
732 _M_fill_insert(
end(), __new_size - size(), __x);
733 else if (__new_size < size())
734 _M_erase_at_end(this->_M_impl._M_start + __new_size);
738 #if __cplusplus >= 201103L 742 { _M_shrink_to_fit(); }
751 {
return size_type(this->_M_impl._M_end_of_storage
752 - this->_M_impl._M_start); }
780 reserve(size_type __n);
797 __glibcxx_requires_subscript(__n);
798 return *(this->_M_impl._M_start + __n);
815 __glibcxx_requires_subscript(__n);
816 return *(this->_M_impl._M_start + __n);
824 if (__n >= this->size())
825 __throw_out_of_range_fmt(__N(
"vector::_M_range_check: __n " 826 "(which is %zu) >= this->size() " 862 at(size_type __n)
const 875 __glibcxx_requires_nonempty();
886 __glibcxx_requires_nonempty();
897 __glibcxx_requires_nonempty();
908 __glibcxx_requires_nonempty();
921 {
return _M_data_ptr(this->_M_impl._M_start); }
924 data()
const _GLIBCXX_NOEXCEPT
925 {
return _M_data_ptr(this->_M_impl._M_start); }
941 if (this->_M_impl._M_finish != this->_M_impl._M_end_of_storage)
943 _Alloc_traits::construct(this->_M_impl, this->_M_impl._M_finish,
945 ++this->_M_impl._M_finish;
948 _M_realloc_insert(
end(), __x);
951 #if __cplusplus >= 201103L 953 push_back(value_type&& __x)
954 { emplace_back(std::move(__x)); }
956 template<
typename... _Args>
957 #if __cplusplus > 201402L 962 emplace_back(_Args&&... __args);
977 __glibcxx_requires_nonempty();
978 --this->_M_impl._M_finish;
979 _Alloc_traits::destroy(this->_M_impl, this->_M_impl._M_finish);
982 #if __cplusplus >= 201103L 995 template<
typename... _Args>
997 emplace(const_iterator __position, _Args&&... __args)
998 {
return _M_emplace_aux(__position, std::forward<_Args>(__args)...); }
1012 insert(const_iterator __position,
const value_type& __x);
1026 insert(iterator __position,
const value_type& __x);
1029 #if __cplusplus >= 201103L 1042 insert(const_iterator __position, value_type&& __x)
1043 {
return _M_insert_rval(__position, std::move(__x)); }
1061 auto __offset = __position -
cbegin();
1062 _M_range_insert(
begin() + __offset, __l.begin(), __l.end(),
1064 return begin() + __offset;
1068 #if __cplusplus >= 201103L 1084 insert(const_iterator __position, size_type __n,
const value_type& __x)
1086 difference_type __offset = __position -
cbegin();
1087 _M_fill_insert(
begin() + __offset, __n, __x);
1088 return begin() + __offset;
1105 insert(iterator __position, size_type __n,
const value_type& __x)
1106 { _M_fill_insert(__position, __n, __x); }
1109 #if __cplusplus >= 201103L 1125 template<
typename _InputIterator,
1126 typename = std::_RequireInputIter<_InputIterator>>
1128 insert(const_iterator __position, _InputIterator __first,
1129 _InputIterator __last)
1131 difference_type __offset = __position -
cbegin();
1132 _M_insert_dispatch(
begin() + __offset,
1133 __first, __last, __false_type());
1134 return begin() + __offset;
1151 template<
typename _InputIterator>
1153 insert(iterator __position, _InputIterator __first,
1154 _InputIterator __last)
1157 typedef typename std::__is_integer<_InputIterator>::__type _Integral;
1158 _M_insert_dispatch(__position, __first, __last, _Integral());
1178 #if __cplusplus >= 201103L 1180 {
return _M_erase(
begin() + (__position -
cbegin())); }
1182 erase(iterator __position)
1183 {
return _M_erase(__position); }
1205 #if __cplusplus >= 201103L 1206 erase(const_iterator __first, const_iterator __last)
1208 const auto __beg =
begin();
1209 const auto __cbeg =
cbegin();
1210 return _M_erase(__beg + (__first - __cbeg), __beg + (__last - __cbeg));
1213 erase(iterator __first, iterator __last)
1214 {
return _M_erase(__first, __last); }
1231 #if __cplusplus >= 201103L 1232 __glibcxx_assert(_Alloc_traits::propagate_on_container_swap::value
1233 || _M_get_Tp_allocator() == __x._M_get_Tp_allocator());
1235 this->_M_impl._M_swap_data(__x._M_impl);
1236 _Alloc_traits::_S_on_swap(_M_get_Tp_allocator(),
1237 __x._M_get_Tp_allocator());
1248 { _M_erase_at_end(this->_M_impl._M_start); }
1255 template<
typename _ForwardIterator>
1258 _ForwardIterator __first, _ForwardIterator __last)
1260 pointer __result = this->_M_allocate(__n);
1263 std::__uninitialized_copy_a(__first, __last, __result,
1264 _M_get_Tp_allocator());
1269 _M_deallocate(__result, __n);
1270 __throw_exception_again;
1281 template<
typename _Integer>
1283 _M_initialize_dispatch(_Integer __n, _Integer __value, __true_type)
1285 this->_M_impl._M_start = _M_allocate(static_cast<size_type>(__n));
1286 this->_M_impl._M_end_of_storage =
1287 this->_M_impl._M_start +
static_cast<size_type
>(__n);
1288 _M_fill_initialize(static_cast<size_type>(__n), __value);
1292 template<
typename _InputIterator>
1294 _M_initialize_dispatch(_InputIterator __first, _InputIterator __last,
1297 typedef typename std::iterator_traits<_InputIterator>::
1298 iterator_category _IterCategory;
1299 _M_range_initialize(__first, __last, _IterCategory());
1303 template<
typename _InputIterator>
1305 _M_range_initialize(_InputIterator __first,
1308 for (; __first != __last; ++__first)
1309 #
if __cplusplus >= 201103L
1310 emplace_back(*__first);
1312 push_back(*__first);
1317 template<
typename _ForwardIterator>
1319 _M_range_initialize(_ForwardIterator __first,
1323 this->_M_impl._M_start = this->_M_allocate(__n);
1324 this->_M_impl._M_end_of_storage = this->_M_impl._M_start + __n;
1325 this->_M_impl._M_finish =
1326 std::__uninitialized_copy_a(__first, __last,
1327 this->_M_impl._M_start,
1328 _M_get_Tp_allocator());
1334 _M_fill_initialize(size_type __n,
const value_type& __value)
1336 this->_M_impl._M_finish =
1337 std::__uninitialized_fill_n_a(this->_M_impl._M_start, __n, __value,
1338 _M_get_Tp_allocator());
1341 #if __cplusplus >= 201103L 1344 _M_default_initialize(size_type __n)
1346 this->_M_impl._M_finish =
1347 std::__uninitialized_default_n_a(this->_M_impl._M_start, __n,
1348 _M_get_Tp_allocator());
1359 template<
typename _Integer>
1361 _M_assign_dispatch(_Integer __n, _Integer __val, __true_type)
1362 { _M_fill_assign(__n, __val); }
1365 template<
typename _InputIterator>
1367 _M_assign_dispatch(_InputIterator __first, _InputIterator __last,
1372 template<
typename _InputIterator>
1374 _M_assign_aux(_InputIterator __first, _InputIterator __last,
1378 template<
typename _ForwardIterator>
1380 _M_assign_aux(_ForwardIterator __first, _ForwardIterator __last,
1386 _M_fill_assign(size_type __n,
const value_type& __val);
1394 template<
typename _Integer>
1396 _M_insert_dispatch(iterator __pos, _Integer __n, _Integer __val,
1398 { _M_fill_insert(__pos, __n, __val); }
1401 template<
typename _InputIterator>
1403 _M_insert_dispatch(iterator __pos, _InputIterator __first,
1404 _InputIterator __last, __false_type)
1406 _M_range_insert(__pos, __first, __last,
1411 template<
typename _InputIterator>
1413 _M_range_insert(iterator __pos, _InputIterator __first,
1417 template<
typename _ForwardIterator>
1419 _M_range_insert(iterator __pos, _ForwardIterator __first,
1425 _M_fill_insert(iterator __pos, size_type __n,
const value_type& __x);
1427 #if __cplusplus >= 201103L 1430 _M_default_append(size_type __n);
1436 #if __cplusplus < 201103L 1439 _M_insert_aux(iterator __position,
const value_type& __x);
1442 _M_realloc_insert(iterator __position,
const value_type& __x);
1446 struct _Temporary_value
1448 template<
typename... _Args>
1450 _Temporary_value(
vector* __vec, _Args&&... __args) : _M_this(__vec)
1452 _Alloc_traits::construct(_M_this->_M_impl, _M_ptr(),
1453 std::forward<_Args>(__args)...);
1457 { _Alloc_traits::destroy(_M_this->_M_impl, _M_ptr()); }
1460 _M_val() {
return *
reinterpret_cast<_Tp*
>(&__buf); }
1467 typename aligned_storage<sizeof(_Tp), alignof(_Tp)>::type __buf;
1472 template<
typename _Arg>
1474 _M_insert_aux(iterator __position, _Arg&& __arg);
1476 template<
typename... _Args>
1478 _M_realloc_insert(iterator __position, _Args&&... __args);
1482 _M_insert_rval(const_iterator __position, value_type&& __v);
1485 template<
typename... _Args>
1487 _M_emplace_aux(const_iterator __position, _Args&&... __args);
1491 _M_emplace_aux(const_iterator __position, value_type&& __v)
1492 {
return _M_insert_rval(__position, std::move(__v)); }
1497 _M_check_len(size_type __n,
const char* __s)
const 1499 if (max_size() - size() < __n)
1500 __throw_length_error(__N(__s));
1502 const size_type __len = size() +
std::max(size(), __n);
1503 return (__len < size() || __len > max_size()) ? max_size() : __len;
1511 _M_erase_at_end(pointer __pos) _GLIBCXX_NOEXCEPT
1513 std::_Destroy(__pos, this->_M_impl._M_finish, _M_get_Tp_allocator());
1514 this->_M_impl._M_finish = __pos;
1518 _M_erase(iterator __position);
1521 _M_erase(iterator __first, iterator __last);
1523 #if __cplusplus >= 201103L 1531 vector __tmp(get_allocator());
1532 this->_M_impl._M_swap_data(__tmp._M_impl);
1533 this->_M_impl._M_swap_data(__x._M_impl);
1534 std::__alloc_on_move(_M_get_Tp_allocator(), __x._M_get_Tp_allocator());
1542 if (__x._M_get_Tp_allocator() == this->_M_get_Tp_allocator())
1548 this->assign(std::__make_move_if_noexcept_iterator(__x.begin()),
1549 std::__make_move_if_noexcept_iterator(__x.end()));
1555 template<
typename _Up>
1557 _M_data_ptr(_Up* __ptr)
const _GLIBCXX_NOEXCEPT
1560 #if __cplusplus >= 201103L 1561 template<
typename _Ptr>
1563 _M_data_ptr(_Ptr __ptr)
const 1566 template<
typename _Up>
1568 _M_data_ptr(_Up* __ptr) _GLIBCXX_NOEXCEPT
1571 template<
typename _Ptr>
1573 _M_data_ptr(_Ptr __ptr)
1574 {
return __ptr.operator->(); }
1576 template<
typename _Ptr>
1578 _M_data_ptr(_Ptr __ptr)
const 1579 {
return __ptr.operator->(); }
1594 template<
typename _Tp,
typename _Alloc>
1611 template<
typename _Tp,
typename _Alloc>
1615 __y.begin(), __y.end()); }
1618 template<
typename _Tp,
typename _Alloc>
1621 {
return !(__x == __y); }
1624 template<
typename _Tp,
typename _Alloc>
1627 {
return __y < __x; }
1630 template<
typename _Tp,
typename _Alloc>
1633 {
return !(__y < __x); }
1636 template<
typename _Tp,
typename _Alloc>
1639 {
return !(__x < __y); }
1642 template<
typename _Tp,
typename _Alloc>
1645 _GLIBCXX_NOEXCEPT_IF(noexcept(__x.swap(__y)))
1648 _GLIBCXX_END_NAMESPACE_CONTAINER
vector(vector &&__x) noexcept
Vector move constructor.
reverse_iterator rbegin() noexcept
const_reverse_iterator rbegin() const noexcept
iterator begin() noexcept
void _M_range_check(size_type __n) const
Safety check used only from at().
Uniform interface to C++98 and C++11 allocators.
Uniform interface to all pointer-like types.
const_reference front() const noexcept
size_type max_size() const noexcept
const_iterator cend() const noexcept
iterator erase(const_iterator __first, const_iterator __last)
Remove a range of elements.
constexpr const _Tp * begin(initializer_list< _Tp > __ils) noexcept
Return an iterator pointing to the first element of the initializer_list.
void assign(initializer_list< value_type > __l)
Assigns an initializer list to a vector.
size_type capacity() const noexcept
size_type size() const noexcept
reference operator[](size_type __n) noexcept
Subscript access to the data contained in the vector.
iterator_traits< _Iter >::iterator_category __iterator_category(const _Iter &)
iterator insert(const_iterator __position, initializer_list< value_type > __l)
Inserts an initializer_list into the vector.
A standard container which offers fixed time access to individual elements in any order...
integral_constant< bool, true > true_type
The type used as a compile-time boolean with true value.
vector & operator=(initializer_list< value_type > __l)
Vector list assignment operator.
vector(initializer_list< value_type > __l, const allocator_type &__a=allocator_type())
Builds a vector from an initializer list.
constexpr const _Tp * end(initializer_list< _Tp > __ils) noexcept
Return an iterator pointing to one past the last element of the initializer_list. ...
void assign(size_type __n, const value_type &__val)
Assigns a given value to a vector.
vector(vector &&__rv, const allocator_type &__m) noexcept(_Alloc_traits::_S_always_equal())
Move constructor with alternative allocator.
constexpr auto cbegin(const _Container &__cont) noexcept(noexcept(std::begin(__cont))) -> decltype(std::begin(__cont))
Return an iterator pointing to the first element of the const container.
__detected_or_t< __get_first_arg_t< _Ptr >, __element_type, _Ptr > element_type
The type pointed to.
const_iterator begin() const noexcept
vector(_InputIterator __first, _InputIterator __last, const allocator_type &__a=allocator_type())
Builds a vector from a range.
ISO C++ entities toplevel namespace is std.
iterator insert(const_iterator __position, _InputIterator __first, _InputIterator __last)
Inserts a range into the vector.
vector(const allocator_type &__a) noexcept
Creates a vector with no elements.
bool equal(_IIter1 __first1, _IIter1 __last1, _IIter2 __first2, _IIter2 __last2, _BinaryPredicate __binary_pred)
Tests a range for element-wise equality.
bool lexicographical_compare(_II1 __first1, _II1 __last1, _II2 __first2, _II2 __last2, _Compare __comp)
Performs dictionary comparison on ranges.
const_reverse_iterator crend() const noexcept
const_reverse_iterator crbegin() const noexcept
void push_back(const value_type &__x)
Add data to the end of the vector.
pointer _M_allocate_and_copy(size_type __n, _ForwardIterator __first, _ForwardIterator __last)
constexpr _Tp * __addressof(_Tp &__r) noexcept
Same as C++11 std::addressof.
void resize(size_type __new_size)
Resizes the vector to the specified number of elements.
reference back() noexcept
void assign(_InputIterator __first, _InputIterator __last)
Assigns a range to a vector.
_GLIBCXX17_CONSTEXPR iterator_traits< _InputIterator >::difference_type distance(_InputIterator __first, _InputIterator __last)
A generalization of pointer arithmetic.
reference at(size_type __n)
Provides access to the data contained in the vector.
vector() noexcept(is_nothrow_default_constructible< _Alloc >::value)
Creates a vector with no elements.
iterator insert(const_iterator __position, value_type &&__x)
Inserts given rvalue into vector before specified iterator.
iterator erase(const_iterator __position)
Remove element at given position.
bool empty() const noexcept
vector(size_type __n, const value_type &__value, const allocator_type &__a=allocator_type())
Creates a vector with copies of an exemplar element.
vector(const vector &__x)
Vector copy constructor.
vector(const vector &__x, const allocator_type &__a)
Copy constructor with alternative allocator.
reverse_iterator rend() noexcept
Forward iterators support a superset of input iterator operations.
const_iterator end() const noexcept
_GLIBCXX14_CONSTEXPR const _Tp & max(const _Tp &, const _Tp &)
This does what you think it does.
vector(size_type __n, const allocator_type &__a=allocator_type())
Creates a vector with default constructed elements.
const_reference back() const noexcept
void pop_back() noexcept
Removes last element.
See bits/stl_deque.h's _Deque_base for an explanation.
reference front() noexcept
vector & operator=(vector &&__x) noexcept(_Alloc_traits::_S_nothrow_move())
Vector move assignment operator.
Random-access iterators support a superset of bidirectional iterator operations.
const_reverse_iterator rend() const noexcept
const_reference operator[](size_type __n) const noexcept
Subscript access to the data contained in the vector.
iterator insert(const_iterator __position, size_type __n, const value_type &__x)
Inserts a number of copies of given data into the vector.
iterator emplace(const_iterator __position, _Args &&...__args)
Inserts an object in vector before specified iterator.
void swap(vector &__x) noexcept
Swaps data with another vector.
void resize(size_type __new_size, const value_type &__x)
Resizes the vector to the specified number of elements.
const_iterator cbegin() const noexcept
const_reference at(size_type __n) const
Provides access to the data contained in the vector.
void _Destroy(_Tp *__pointer)