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> >
219 typedef typename _Alloc::value_type _Alloc_value_type;
220 #if __cplusplus < 201103L 221 __glibcxx_class_requires(_Tp, _SGIAssignableConcept)
223 __glibcxx_class_requires2(_Tp, _Alloc_value_type, _SameTypeConcept)
226 typedef typename _Base::_Tp_alloc_type _Tp_alloc_type;
230 typedef _Tp value_type;
231 typedef typename _Base::pointer pointer;
232 typedef typename _Alloc_traits::const_pointer const_pointer;
233 typedef typename _Alloc_traits::reference reference;
234 typedef typename _Alloc_traits::const_reference const_reference;
235 typedef __gnu_cxx::__normal_iterator<pointer, vector> iterator;
236 typedef __gnu_cxx::__normal_iterator<const_pointer, vector>
240 typedef size_t size_type;
241 typedef ptrdiff_t difference_type;
242 typedef _Alloc allocator_type;
245 using _Base::_M_allocate;
246 using _Base::_M_deallocate;
247 using _Base::_M_impl;
248 using _Base::_M_get_Tp_allocator;
258 #if __cplusplus >= 201103L 259 noexcept(is_nothrow_default_constructible<_Alloc>::value)
268 vector(
const allocator_type& __a) _GLIBCXX_NOEXCEPT
271 #if __cplusplus >= 201103L 281 vector(size_type __n,
const allocator_type& __a = allocator_type())
283 { _M_default_initialize(__n); }
293 vector(size_type __n,
const value_type& __value,
294 const allocator_type& __a = allocator_type())
296 { _M_fill_initialize(__n, __value); }
307 vector(size_type __n,
const value_type& __value = value_type(),
308 const allocator_type& __a = allocator_type())
310 { _M_fill_initialize(__n, __value); }
326 _Alloc_traits::_S_select_on_copy(__x._M_get_Tp_allocator()))
328 this->_M_impl._M_finish =
329 std::__uninitialized_copy_a(__x.
begin(), __x.
end(),
330 this->_M_impl._M_start,
331 _M_get_Tp_allocator());
334 #if __cplusplus >= 201103L 343 : _Base(std::move(__x)) { }
347 : _Base(__x.size(), __a)
349 this->_M_impl._M_finish =
350 std::__uninitialized_copy_a(__x.
begin(), __x.
end(),
351 this->_M_impl._M_start,
352 _M_get_Tp_allocator());
357 noexcept(_Alloc_traits::_S_always_equal())
358 : _Base(
std::move(__rv), __m)
360 if (__rv.get_allocator() != __m)
362 this->_M_impl._M_finish =
363 std::__uninitialized_move_a(__rv.begin(), __rv.end(),
364 this->_M_impl._M_start,
365 _M_get_Tp_allocator());
382 const allocator_type& __a = allocator_type())
385 _M_range_initialize(__l.begin(), __l.end(),
406 #if __cplusplus >= 201103L 407 template<
typename _InputIterator,
408 typename = std::_RequireInputIter<_InputIterator>>
409 vector(_InputIterator __first, _InputIterator __last,
410 const allocator_type& __a = allocator_type())
412 { _M_initialize_dispatch(__first, __last, __false_type()); }
414 template<
typename _InputIterator>
415 vector(_InputIterator __first, _InputIterator __last,
416 const allocator_type& __a = allocator_type())
420 typedef typename std::__is_integer<_InputIterator>::__type _Integral;
421 _M_initialize_dispatch(__first, __last, _Integral());
432 {
std::_Destroy(this->_M_impl._M_start, this->_M_impl._M_finish,
433 _M_get_Tp_allocator()); }
445 operator=(
const vector& __x);
447 #if __cplusplus >= 201103L 461 constexpr
bool __move_storage =
462 _Alloc_traits::_S_propagate_on_move_assign()
463 || _Alloc_traits::_S_always_equal();
482 this->_M_assign_aux(__l.begin(), __l.end(),
499 assign(size_type __n,
const value_type& __val)
500 { _M_fill_assign(__n, __val); }
514 #if __cplusplus >= 201103L 515 template<
typename _InputIterator,
516 typename = std::_RequireInputIter<_InputIterator>>
518 assign(_InputIterator __first, _InputIterator __last)
519 { _M_assign_dispatch(__first, __last, __false_type()); }
521 template<
typename _InputIterator>
523 assign(_InputIterator __first, _InputIterator __last)
526 typedef typename std::__is_integer<_InputIterator>::__type _Integral;
527 _M_assign_dispatch(__first, __last, _Integral());
531 #if __cplusplus >= 201103L 546 this->_M_assign_aux(__l.begin(), __l.end(),
552 using _Base::get_allocator;
562 {
return iterator(this->_M_impl._M_start); }
571 {
return const_iterator(this->_M_impl._M_start); }
580 {
return iterator(this->_M_impl._M_finish); }
588 end() const _GLIBCXX_NOEXCEPT
589 {
return const_iterator(this->_M_impl._M_finish); }
598 {
return reverse_iterator(
end()); }
605 const_reverse_iterator
607 {
return const_reverse_iterator(
end()); }
616 {
return reverse_iterator(
begin()); }
623 const_reverse_iterator
625 {
return const_reverse_iterator(
begin()); }
627 #if __cplusplus >= 201103L 635 {
return const_iterator(this->_M_impl._M_start); }
644 {
return const_iterator(this->_M_impl._M_finish); }
651 const_reverse_iterator
653 {
return const_reverse_iterator(
end()); }
660 const_reverse_iterator
662 {
return const_reverse_iterator(
begin()); }
669 {
return size_type(this->_M_impl._M_finish - this->_M_impl._M_start); }
674 {
return _Alloc_traits::max_size(_M_get_Tp_allocator()); }
676 #if __cplusplus >= 201103L 689 if (__new_size > size())
690 _M_default_append(__new_size - size());
691 else if (__new_size < size())
692 _M_erase_at_end(this->_M_impl._M_start + __new_size);
707 resize(size_type __new_size,
const value_type& __x)
709 if (__new_size > size())
710 _M_fill_insert(
end(), __new_size - size(), __x);
711 else if (__new_size < size())
712 _M_erase_at_end(this->_M_impl._M_start + __new_size);
727 resize(size_type __new_size, value_type __x = value_type())
729 if (__new_size > size())
730 _M_fill_insert(
end(), __new_size - size(), __x);
731 else if (__new_size < size())
732 _M_erase_at_end(this->_M_impl._M_start + __new_size);
736 #if __cplusplus >= 201103L 740 { _M_shrink_to_fit(); }
749 {
return size_type(this->_M_impl._M_end_of_storage
750 - this->_M_impl._M_start); }
778 reserve(size_type __n);
795 __glibcxx_requires_subscript(__n);
796 return *(this->_M_impl._M_start + __n);
813 __glibcxx_requires_subscript(__n);
814 return *(this->_M_impl._M_start + __n);
822 if (__n >= this->size())
823 __throw_out_of_range_fmt(__N(
"vector::_M_range_check: __n " 824 "(which is %zu) >= this->size() " 860 at(size_type __n)
const 873 __glibcxx_requires_nonempty();
884 __glibcxx_requires_nonempty();
895 __glibcxx_requires_nonempty();
906 __glibcxx_requires_nonempty();
919 {
return _M_data_ptr(this->_M_impl._M_start); }
922 data()
const _GLIBCXX_NOEXCEPT
923 {
return _M_data_ptr(this->_M_impl._M_start); }
939 if (this->_M_impl._M_finish != this->_M_impl._M_end_of_storage)
941 _Alloc_traits::construct(this->_M_impl, this->_M_impl._M_finish,
943 ++this->_M_impl._M_finish;
946 _M_realloc_insert(
end(), __x);
949 #if __cplusplus >= 201103L 951 push_back(value_type&& __x)
952 { emplace_back(std::move(__x)); }
954 template<
typename... _Args>
955 #if __cplusplus > 201402L 960 emplace_back(_Args&&... __args);
975 __glibcxx_requires_nonempty();
976 --this->_M_impl._M_finish;
977 _Alloc_traits::destroy(this->_M_impl, this->_M_impl._M_finish);
980 #if __cplusplus >= 201103L 993 template<
typename... _Args>
995 emplace(const_iterator __position, _Args&&... __args)
996 {
return _M_emplace_aux(__position, std::forward<_Args>(__args)...); }
1010 insert(const_iterator __position,
const value_type& __x);
1024 insert(iterator __position,
const value_type& __x);
1027 #if __cplusplus >= 201103L 1040 insert(const_iterator __position, value_type&& __x)
1041 {
return _M_insert_rval(__position, std::move(__x)); }
1059 auto __offset = __position -
cbegin();
1060 _M_range_insert(
begin() + __offset, __l.begin(), __l.end(),
1062 return begin() + __offset;
1066 #if __cplusplus >= 201103L 1082 insert(const_iterator __position, size_type __n,
const value_type& __x)
1084 difference_type __offset = __position -
cbegin();
1085 _M_fill_insert(
begin() + __offset, __n, __x);
1086 return begin() + __offset;
1103 insert(iterator __position, size_type __n,
const value_type& __x)
1104 { _M_fill_insert(__position, __n, __x); }
1107 #if __cplusplus >= 201103L 1123 template<
typename _InputIterator,
1124 typename = std::_RequireInputIter<_InputIterator>>
1126 insert(const_iterator __position, _InputIterator __first,
1127 _InputIterator __last)
1129 difference_type __offset = __position -
cbegin();
1130 _M_insert_dispatch(
begin() + __offset,
1131 __first, __last, __false_type());
1132 return begin() + __offset;
1149 template<
typename _InputIterator>
1151 insert(iterator __position, _InputIterator __first,
1152 _InputIterator __last)
1155 typedef typename std::__is_integer<_InputIterator>::__type _Integral;
1156 _M_insert_dispatch(__position, __first, __last, _Integral());
1176 #if __cplusplus >= 201103L 1178 {
return _M_erase(
begin() + (__position -
cbegin())); }
1180 erase(iterator __position)
1181 {
return _M_erase(__position); }
1203 #if __cplusplus >= 201103L 1204 erase(const_iterator __first, const_iterator __last)
1206 const auto __beg =
begin();
1207 const auto __cbeg =
cbegin();
1208 return _M_erase(__beg + (__first - __cbeg), __beg + (__last - __cbeg));
1211 erase(iterator __first, iterator __last)
1212 {
return _M_erase(__first, __last); }
1229 #if __cplusplus >= 201103L 1230 __glibcxx_assert(_Alloc_traits::propagate_on_container_swap::value
1231 || _M_get_Tp_allocator() == __x._M_get_Tp_allocator());
1233 this->_M_impl._M_swap_data(__x._M_impl);
1234 _Alloc_traits::_S_on_swap(_M_get_Tp_allocator(),
1235 __x._M_get_Tp_allocator());
1246 { _M_erase_at_end(this->_M_impl._M_start); }
1253 template<
typename _ForwardIterator>
1256 _ForwardIterator __first, _ForwardIterator __last)
1258 pointer __result = this->_M_allocate(__n);
1261 std::__uninitialized_copy_a(__first, __last, __result,
1262 _M_get_Tp_allocator());
1267 _M_deallocate(__result, __n);
1268 __throw_exception_again;
1279 template<
typename _Integer>
1281 _M_initialize_dispatch(_Integer __n, _Integer __value, __true_type)
1283 this->_M_impl._M_start = _M_allocate(static_cast<size_type>(__n));
1284 this->_M_impl._M_end_of_storage =
1285 this->_M_impl._M_start +
static_cast<size_type
>(__n);
1286 _M_fill_initialize(static_cast<size_type>(__n), __value);
1290 template<
typename _InputIterator>
1292 _M_initialize_dispatch(_InputIterator __first, _InputIterator __last,
1295 typedef typename std::iterator_traits<_InputIterator>::
1296 iterator_category _IterCategory;
1297 _M_range_initialize(__first, __last, _IterCategory());
1301 template<
typename _InputIterator>
1303 _M_range_initialize(_InputIterator __first,
1306 for (; __first != __last; ++__first)
1307 #
if __cplusplus >= 201103L
1308 emplace_back(*__first);
1310 push_back(*__first);
1315 template<
typename _ForwardIterator>
1317 _M_range_initialize(_ForwardIterator __first,
1321 this->_M_impl._M_start = this->_M_allocate(__n);
1322 this->_M_impl._M_end_of_storage = this->_M_impl._M_start + __n;
1323 this->_M_impl._M_finish =
1324 std::__uninitialized_copy_a(__first, __last,
1325 this->_M_impl._M_start,
1326 _M_get_Tp_allocator());
1332 _M_fill_initialize(size_type __n,
const value_type& __value)
1334 this->_M_impl._M_finish =
1335 std::__uninitialized_fill_n_a(this->_M_impl._M_start, __n, __value,
1336 _M_get_Tp_allocator());
1339 #if __cplusplus >= 201103L 1342 _M_default_initialize(size_type __n)
1344 this->_M_impl._M_finish =
1345 std::__uninitialized_default_n_a(this->_M_impl._M_start, __n,
1346 _M_get_Tp_allocator());
1357 template<
typename _Integer>
1359 _M_assign_dispatch(_Integer __n, _Integer __val, __true_type)
1360 { _M_fill_assign(__n, __val); }
1363 template<
typename _InputIterator>
1365 _M_assign_dispatch(_InputIterator __first, _InputIterator __last,
1370 template<
typename _InputIterator>
1372 _M_assign_aux(_InputIterator __first, _InputIterator __last,
1376 template<
typename _ForwardIterator>
1378 _M_assign_aux(_ForwardIterator __first, _ForwardIterator __last,
1384 _M_fill_assign(size_type __n,
const value_type& __val);
1392 template<
typename _Integer>
1394 _M_insert_dispatch(iterator __pos, _Integer __n, _Integer __val,
1396 { _M_fill_insert(__pos, __n, __val); }
1399 template<
typename _InputIterator>
1401 _M_insert_dispatch(iterator __pos, _InputIterator __first,
1402 _InputIterator __last, __false_type)
1404 _M_range_insert(__pos, __first, __last,
1409 template<
typename _InputIterator>
1411 _M_range_insert(iterator __pos, _InputIterator __first,
1415 template<
typename _ForwardIterator>
1417 _M_range_insert(iterator __pos, _ForwardIterator __first,
1423 _M_fill_insert(iterator __pos, size_type __n,
const value_type& __x);
1425 #if __cplusplus >= 201103L 1428 _M_default_append(size_type __n);
1434 #if __cplusplus < 201103L 1437 _M_insert_aux(iterator __position,
const value_type& __x);
1440 _M_realloc_insert(iterator __position,
const value_type& __x);
1444 struct _Temporary_value
1446 template<
typename... _Args>
1448 _Temporary_value(
vector* __vec, _Args&&... __args) : _M_this(__vec)
1450 _Alloc_traits::construct(_M_this->_M_impl, _M_ptr(),
1451 std::forward<_Args>(__args)...);
1455 { _Alloc_traits::destroy(_M_this->_M_impl, _M_ptr()); }
1458 _M_val() {
return *
reinterpret_cast<_Tp*
>(&__buf); }
1465 typename aligned_storage<sizeof(_Tp), alignof(_Tp)>::type __buf;
1470 template<
typename _Arg>
1472 _M_insert_aux(iterator __position, _Arg&& __arg);
1474 template<
typename... _Args>
1476 _M_realloc_insert(iterator __position, _Args&&... __args);
1480 _M_insert_rval(const_iterator __position, value_type&& __v);
1483 template<
typename... _Args>
1485 _M_emplace_aux(const_iterator __position, _Args&&... __args);
1489 _M_emplace_aux(const_iterator __position, value_type&& __v)
1490 {
return _M_insert_rval(__position, std::move(__v)); }
1495 _M_check_len(size_type __n,
const char* __s)
const 1497 if (max_size() - size() < __n)
1498 __throw_length_error(__N(__s));
1500 const size_type __len = size() +
std::max(size(), __n);
1501 return (__len < size() || __len > max_size()) ? max_size() : __len;
1509 _M_erase_at_end(pointer __pos) _GLIBCXX_NOEXCEPT
1511 std::_Destroy(__pos, this->_M_impl._M_finish, _M_get_Tp_allocator());
1512 this->_M_impl._M_finish = __pos;
1516 _M_erase(iterator __position);
1519 _M_erase(iterator __first, iterator __last);
1521 #if __cplusplus >= 201103L 1529 vector __tmp(get_allocator());
1530 this->_M_impl._M_swap_data(__tmp._M_impl);
1531 this->_M_impl._M_swap_data(__x._M_impl);
1532 std::__alloc_on_move(_M_get_Tp_allocator(), __x._M_get_Tp_allocator());
1540 if (__x._M_get_Tp_allocator() == this->_M_get_Tp_allocator())
1546 this->assign(std::__make_move_if_noexcept_iterator(__x.begin()),
1547 std::__make_move_if_noexcept_iterator(__x.end()));
1553 template<
typename _Up>
1555 _M_data_ptr(_Up* __ptr)
const _GLIBCXX_NOEXCEPT
1558 #if __cplusplus >= 201103L 1559 template<
typename _Ptr>
1561 _M_data_ptr(_Ptr __ptr)
const 1564 template<
typename _Up>
1566 _M_data_ptr(_Up* __ptr) _GLIBCXX_NOEXCEPT
1569 template<
typename _Ptr>
1571 _M_data_ptr(_Ptr __ptr)
1572 {
return __ptr.operator->(); }
1574 template<
typename _Ptr>
1576 _M_data_ptr(_Ptr __ptr)
const 1577 {
return __ptr.operator->(); }
1592 template<
typename _Tp,
typename _Alloc>
1609 template<
typename _Tp,
typename _Alloc>
1613 __y.begin(), __y.end()); }
1616 template<
typename _Tp,
typename _Alloc>
1619 {
return !(__x == __y); }
1622 template<
typename _Tp,
typename _Alloc>
1625 {
return __y < __x; }
1628 template<
typename _Tp,
typename _Alloc>
1631 {
return !(__y < __x); }
1634 template<
typename _Tp,
typename _Alloc>
1637 {
return !(__x < __y); }
1640 template<
typename _Tp,
typename _Alloc>
1643 _GLIBCXX_NOEXCEPT_IF(noexcept(__x.swap(__y)))
1646 _GLIBCXX_END_NAMESPACE_CONTAINER
Uniform interface to all pointer-like types.
vector(initializer_list< value_type > __l, const allocator_type &__a=allocator_type())
Builds a vector from an initializer list.
void _M_range_check(size_type __n) const
Safety check used only from at().
void swap(vector &__x) noexcept
Swaps data with another vector.
const_iterator cend() const noexcept
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.
void assign(size_type __n, const value_type &__val)
Assigns a given value to a vector.
constexpr const _Tp * end(initializer_list< _Tp > __ils) noexcept
Return an iterator pointing to one past the last element of the initializer_list. ...
See bits/stl_deque.h's _Deque_base for an explanation.
vector(size_type __n, const allocator_type &__a=allocator_type())
Creates a vector with default constructed elements.
vector(const allocator_type &__a) noexcept
Creates a vector with no elements.
constexpr _Tp * __addressof(_Tp &__r) noexcept
Same as C++11 std::addressof.
vector & operator=(initializer_list< value_type > __l)
Vector list assignment operator.
vector & operator=(vector &&__x) noexcept(_Alloc_traits::_S_nothrow_move())
Vector move assignment operator.
const_reverse_iterator rbegin() const noexcept
iterator insert(const_iterator __position, _InputIterator __first, _InputIterator __last)
Inserts a range into the vector.
reference at(size_type __n)
Provides access to the data contained in the vector.
constexpr const _Tp * begin(initializer_list< _Tp > __ils) noexcept
Return an iterator pointing to the first element of the initializer_list.
ISO C++ entities toplevel namespace is std.
const_reverse_iterator rend() 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.
const_reverse_iterator crend() const noexcept
void pop_back() noexcept
Removes last element.
iterator begin() noexcept
const_iterator cbegin() const noexcept
void _Destroy(_Tp *__pointer)
bool empty() const noexcept
const_iterator begin() const noexcept
_GLIBCXX17_CONSTEXPR iterator_traits< _InputIterator >::difference_type distance(_InputIterator __first, _InputIterator __last)
A generalization of pointer arithmetic.
const_iterator end() const noexcept
iterator insert(const_iterator __position, value_type &&__x)
Inserts given rvalue into vector before specified iterator.
bool lexicographical_compare(_II1 __first1, _II1 __last1, _II2 __first2, _II2 __last2, _Compare __comp)
Performs dictionary comparison on ranges.
__detected_or_t< __get_first_arg_t< _Ptr >, __element_type, _Ptr > element_type
The type pointed to.
iterator emplace(const_iterator __position, _Args &&... __args)
Inserts an object in vector before specified iterator.
iterator insert(const_iterator __position, size_type __n, const value_type &__x)
Inserts a number of copies of given data into the vector.
iterator erase(const_iterator __first, const_iterator __last)
Remove a range of elements.
vector(_InputIterator __first, _InputIterator __last, const allocator_type &__a=allocator_type())
Builds a vector from a range.
_GLIBCXX14_CONSTEXPR const _Tp & max(const _Tp &, const _Tp &)
This does what you think it does.
const_reverse_iterator crbegin() const noexcept
integral_constant< bool, true > true_type
The type used as a compile-time boolean with true value.
void assign(_InputIterator __first, _InputIterator __last)
Assigns a range to a vector.
const_reference operator[](size_type __n) const noexcept
Subscript access to the data contained in the vector.
vector(vector &&__x) noexcept
Vector move constructor.
void resize(size_type __new_size, const value_type &__x)
Resizes the vector to the specified number of elements.
vector(const vector &__x, const allocator_type &__a)
Copy constructor with alternative allocator.
pointer _M_allocate_and_copy(size_type __n, _ForwardIterator __first, _ForwardIterator __last)
reference operator[](size_type __n) noexcept
Subscript access to the data contained in the vector.
Random-access iterators support a superset of bidirectional iterator operations.
reverse_iterator rbegin() noexcept
vector(vector &&__rv, const allocator_type &__m) noexcept(_Alloc_traits::_S_always_equal())
Move constructor with alternative allocator.
reverse_iterator rend() noexcept
reference front() noexcept
vector(const vector &__x)
Vector copy constructor.
const_reference back() const noexcept
vector() noexcept(is_nothrow_default_constructible< _Alloc >::value)
Creates a vector with no elements.
A standard container which offers fixed time access to individual elements in any order...
const_reference at(size_type __n) const
Provides access to the data contained in the vector.
size_type capacity() const noexcept
size_type max_size() const noexcept
reference back() noexcept
const_reference front() const noexcept
void push_back(const value_type &__x)
Add data to the end of the vector.
Uniform interface to C++98 and C++11 allocators.
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.
void resize(size_type __new_size)
Resizes the vector to the specified number of elements.
void assign(initializer_list< value_type > __l)
Assigns an initializer list to a vector.
size_type size() const noexcept
Forward iterators support a superset of input iterator operations.
bool equal(_IIter1 __first1, _IIter1 __last1, _IIter2 __first2, _IIter2 __last2, _BinaryPredicate __binary_pred)
Tests a range for element-wise equality.
iterator erase(const_iterator __position)
Remove element at given position.