57 #define _STL_VECTOR_H 1 62 #if __cplusplus >= 201103L 66 namespace std _GLIBCXX_VISIBILITY(default)
68 _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
71 template<
typename _Tp,
typename _Alloc>
75 rebind<_Tp>::other _Tp_alloc_type;
76 typedef typename __gnu_cxx::__alloc_traits<_Tp_alloc_type>::pointer
80 :
public _Tp_alloc_type
84 pointer _M_end_of_storage;
87 : _Tp_alloc_type(), _M_start(), _M_finish(), _M_end_of_storage()
90 _Vector_impl(_Tp_alloc_type
const& __a) _GLIBCXX_NOEXCEPT
91 : _Tp_alloc_type(__a), _M_start(), _M_finish(), _M_end_of_storage()
94 #if __cplusplus >= 201103L 95 _Vector_impl(_Tp_alloc_type&& __a) noexcept
96 : _Tp_alloc_type(std::move(__a)),
97 _M_start(), _M_finish(), _M_end_of_storage()
101 void _M_swap_data(_Vector_impl& __x) _GLIBCXX_NOEXCEPT
103 std::swap(_M_start, __x._M_start);
104 std::swap(_M_finish, __x._M_finish);
105 std::swap(_M_end_of_storage, __x._M_end_of_storage);
110 typedef _Alloc allocator_type;
113 _M_get_Tp_allocator() _GLIBCXX_NOEXCEPT
114 {
return *
static_cast<_Tp_alloc_type*
>(&this->_M_impl); }
116 const _Tp_alloc_type&
117 _M_get_Tp_allocator()
const _GLIBCXX_NOEXCEPT
118 {
return *
static_cast<const _Tp_alloc_type*
>(&this->_M_impl); }
121 get_allocator()
const _GLIBCXX_NOEXCEPT
122 {
return allocator_type(_M_get_Tp_allocator()); }
127 _Vector_base(
const allocator_type& __a) _GLIBCXX_NOEXCEPT
132 { _M_create_storage(__n); }
136 { _M_create_storage(__n); }
138 #if __cplusplus >= 201103L 140 : _M_impl(std::move(__a)) { }
143 : _M_impl(std::move(__x._M_get_Tp_allocator()))
144 { this->_M_impl._M_swap_data(__x._M_impl); }
149 if (__x.get_allocator() == __a)
150 this->_M_impl._M_swap_data(__x._M_impl);
153 size_t __n = __x._M_impl._M_finish - __x._M_impl._M_start;
154 _M_create_storage(__n);
160 { _M_deallocate(this->_M_impl._M_start, this->_M_impl._M_end_of_storage
161 - this->_M_impl._M_start); }
164 _Vector_impl _M_impl;
167 _M_allocate(
size_t __n)
170 return __n != 0 ? _Tr::allocate(_M_impl, __n) : pointer();
174 _M_deallocate(pointer __p,
size_t __n)
178 _Tr::deallocate(_M_impl, __p, __n);
183 _M_create_storage(
size_t __n)
185 this->_M_impl._M_start = this->_M_allocate(__n);
186 this->_M_impl._M_finish = this->_M_impl._M_start;
187 this->_M_impl._M_end_of_storage = this->_M_impl._M_start + __n;
213 template<
typename _Tp,
typename _Alloc = std::allocator<_Tp> >
217 typedef typename _Alloc::value_type _Alloc_value_type;
218 __glibcxx_class_requires(_Tp, _SGIAssignableConcept)
219 __glibcxx_class_requires2(_Tp, _Alloc_value_type, _SameTypeConcept)
222 typedef typename _Base::_Tp_alloc_type _Tp_alloc_type;
226 typedef _Tp value_type;
227 typedef typename _Base::pointer pointer;
228 typedef typename _Alloc_traits::const_pointer const_pointer;
229 typedef typename _Alloc_traits::reference reference;
230 typedef typename _Alloc_traits::const_reference const_reference;
231 typedef __gnu_cxx::__normal_iterator<pointer, vector> iterator;
232 typedef __gnu_cxx::__normal_iterator<const_pointer, vector>
236 typedef size_t size_type;
237 typedef ptrdiff_t difference_type;
238 typedef _Alloc allocator_type;
241 using _Base::_M_allocate;
242 using _Base::_M_deallocate;
243 using _Base::_M_impl;
244 using _Base::_M_get_Tp_allocator;
254 #if __cplusplus >= 201103L 255 noexcept(is_nothrow_default_constructible<_Alloc>::value)
264 vector(
const allocator_type& __a) _GLIBCXX_NOEXCEPT
267 #if __cplusplus >= 201103L 277 vector(size_type __n,
const allocator_type& __a = allocator_type())
279 { _M_default_initialize(__n); }
289 vector(size_type __n,
const value_type& __value,
290 const allocator_type& __a = allocator_type())
292 { _M_fill_initialize(__n, __value); }
303 vector(size_type __n,
const value_type& __value = value_type(),
304 const allocator_type& __a = allocator_type())
306 { _M_fill_initialize(__n, __value); }
320 _Alloc_traits::_S_select_on_copy(__x._M_get_Tp_allocator()))
321 { this->_M_impl._M_finish =
322 std::__uninitialized_copy_a(__x.
begin(), __x.
end(),
323 this->_M_impl._M_start,
324 _M_get_Tp_allocator());
327 #if __cplusplus >= 201103L 336 : _Base(
std::move(__x)) { }
340 : _Base(__x.size(), __a)
341 { this->_M_impl._M_finish =
342 std::__uninitialized_copy_a(__x.
begin(), __x.
end(),
343 this->_M_impl._M_start,
344 _M_get_Tp_allocator());
349 noexcept(_Alloc_traits::_S_always_equal())
350 : _Base(
std::move(__rv), __m)
352 if (__rv.get_allocator() != __m)
354 this->_M_impl._M_finish =
355 std::__uninitialized_move_a(__rv.begin(), __rv.end(),
356 this->_M_impl._M_start,
357 _M_get_Tp_allocator());
374 const allocator_type& __a = allocator_type())
377 _M_range_initialize(__l.begin(), __l.end(),
398 #if __cplusplus >= 201103L 399 template<
typename _InputIterator,
400 typename = std::_RequireInputIter<_InputIterator>>
401 vector(_InputIterator __first, _InputIterator __last,
402 const allocator_type& __a = allocator_type())
404 { _M_initialize_dispatch(__first, __last, __false_type()); }
406 template<
typename _InputIterator>
407 vector(_InputIterator __first, _InputIterator __last,
408 const allocator_type& __a = allocator_type())
412 typedef typename std::__is_integer<_InputIterator>::__type _Integral;
413 _M_initialize_dispatch(__first, __last, _Integral());
424 {
std::_Destroy(this->_M_impl._M_start, this->_M_impl._M_finish,
425 _M_get_Tp_allocator()); }
436 operator=(
const vector& __x);
438 #if __cplusplus >= 201103L 450 constexpr
bool __move_storage =
451 _Alloc_traits::_S_propagate_on_move_assign()
452 || _Alloc_traits::_S_always_equal();
453 _M_move_assign(std::move(__x),
472 this->assign(__l.begin(), __l.end());
488 assign(size_type __n,
const value_type& __val)
489 { _M_fill_assign(__n, __val); }
503 #if __cplusplus >= 201103L 504 template<
typename _InputIterator,
505 typename = std::_RequireInputIter<_InputIterator>>
507 assign(_InputIterator __first, _InputIterator __last)
508 { _M_assign_dispatch(__first, __last, __false_type()); }
510 template<
typename _InputIterator>
512 assign(_InputIterator __first, _InputIterator __last)
515 typedef typename std::__is_integer<_InputIterator>::__type _Integral;
516 _M_assign_dispatch(__first, __last, _Integral());
520 #if __cplusplus >= 201103L 534 { this->assign(__l.begin(), __l.end()); }
538 using _Base::get_allocator;
548 {
return iterator(this->_M_impl._M_start); }
557 {
return const_iterator(this->_M_impl._M_start); }
566 {
return iterator(this->_M_impl._M_finish); }
574 end() const _GLIBCXX_NOEXCEPT
575 {
return const_iterator(this->_M_impl._M_finish); }
584 {
return reverse_iterator(
end()); }
591 const_reverse_iterator
593 {
return const_reverse_iterator(
end()); }
602 {
return reverse_iterator(
begin()); }
609 const_reverse_iterator
611 {
return const_reverse_iterator(
begin()); }
613 #if __cplusplus >= 201103L 621 {
return const_iterator(this->_M_impl._M_start); }
630 {
return const_iterator(this->_M_impl._M_finish); }
637 const_reverse_iterator
639 {
return const_reverse_iterator(
end()); }
646 const_reverse_iterator
648 {
return const_reverse_iterator(
begin()); }
655 {
return size_type(this->_M_impl._M_finish - this->_M_impl._M_start); }
660 {
return _Alloc_traits::max_size(_M_get_Tp_allocator()); }
662 #if __cplusplus >= 201103L 675 if (__new_size > size())
676 _M_default_append(__new_size - size());
677 else if (__new_size < size())
678 _M_erase_at_end(this->_M_impl._M_start + __new_size);
693 resize(size_type __new_size,
const value_type& __x)
695 if (__new_size > size())
696 insert(
end(), __new_size - size(), __x);
697 else if (__new_size < size())
698 _M_erase_at_end(this->_M_impl._M_start + __new_size);
713 resize(size_type __new_size, value_type __x = value_type())
715 if (__new_size > size())
716 insert(
end(), __new_size - size(), __x);
717 else if (__new_size < size())
718 _M_erase_at_end(this->_M_impl._M_start + __new_size);
722 #if __cplusplus >= 201103L 726 { _M_shrink_to_fit(); }
735 {
return size_type(this->_M_impl._M_end_of_storage
736 - this->_M_impl._M_start); }
764 reserve(size_type __n);
780 {
return *(this->_M_impl._M_start + __n); }
795 {
return *(this->_M_impl._M_start + __n); }
802 if (__n >= this->size())
803 __throw_out_of_range_fmt(__N(
"vector::_M_range_check: __n " 804 "(which is %zu) >= this->size() " 840 at(size_type __n)
const 868 {
return *(
end() - 1); }
876 {
return *(
end() - 1); }
885 #if __cplusplus >= 201103L 891 {
return _M_data_ptr(this->_M_impl._M_start); }
893 #if __cplusplus >= 201103L 898 data()
const _GLIBCXX_NOEXCEPT
899 {
return _M_data_ptr(this->_M_impl._M_start); }
915 if (this->_M_impl._M_finish != this->_M_impl._M_end_of_storage)
917 _Alloc_traits::construct(this->_M_impl, this->_M_impl._M_finish,
919 ++this->_M_impl._M_finish;
922 #if __cplusplus >= 201103L 923 _M_emplace_back_aux(__x);
925 _M_insert_aux(
end(), __x);
929 #if __cplusplus >= 201103L 931 push_back(value_type&& __x)
932 { emplace_back(std::move(__x)); }
934 template<
typename... _Args>
936 emplace_back(_Args&&... __args);
951 --this->_M_impl._M_finish;
952 _Alloc_traits::destroy(this->_M_impl, this->_M_impl._M_finish);
955 #if __cplusplus >= 201103L 968 template<
typename... _Args>
970 emplace(const_iterator __position, _Args&&... __args);
984 insert(const_iterator __position,
const value_type& __x);
998 insert(iterator __position,
const value_type& __x);
1001 #if __cplusplus >= 201103L 1014 insert(const_iterator __position, value_type&& __x)
1015 {
return emplace(__position, std::move(__x)); }
1032 {
return this->insert(__position, __l.begin(), __l.end()); }
1035 #if __cplusplus >= 201103L 1051 insert(const_iterator __position, size_type __n,
const value_type& __x)
1053 difference_type __offset = __position -
cbegin();
1054 _M_fill_insert(
begin() + __offset, __n, __x);
1055 return begin() + __offset;
1072 insert(iterator __position, size_type __n,
const value_type& __x)
1073 { _M_fill_insert(__position, __n, __x); }
1076 #if __cplusplus >= 201103L 1092 template<
typename _InputIterator,
1093 typename = std::_RequireInputIter<_InputIterator>>
1095 insert(const_iterator __position, _InputIterator __first,
1096 _InputIterator __last)
1098 difference_type __offset = __position -
cbegin();
1099 _M_insert_dispatch(
begin() + __offset,
1100 __first, __last, __false_type());
1101 return begin() + __offset;
1118 template<
typename _InputIterator>
1120 insert(iterator __position, _InputIterator __first,
1121 _InputIterator __last)
1124 typedef typename std::__is_integer<_InputIterator>::__type _Integral;
1125 _M_insert_dispatch(__position, __first, __last, _Integral());
1145 #if __cplusplus >= 201103L 1147 {
return _M_erase(
begin() + (__position -
cbegin())); }
1149 erase(iterator __position)
1150 {
return _M_erase(__position); }
1172 #if __cplusplus >= 201103L 1173 erase(const_iterator __first, const_iterator __last)
1175 const auto __beg =
begin();
1176 const auto __cbeg =
cbegin();
1177 return _M_erase(__beg + (__first - __cbeg), __beg + (__last - __cbeg));
1180 erase(iterator __first, iterator __last)
1181 {
return _M_erase(__first, __last); }
1195 #if __cplusplus >= 201103L 1196 noexcept(_Alloc_traits::_S_nothrow_swap())
1199 this->_M_impl._M_swap_data(__x._M_impl);
1200 _Alloc_traits::_S_on_swap(_M_get_Tp_allocator(),
1201 __x._M_get_Tp_allocator());
1212 { _M_erase_at_end(this->_M_impl._M_start); }
1219 template<
typename _ForwardIterator>
1222 _ForwardIterator __first, _ForwardIterator __last)
1224 pointer __result = this->_M_allocate(__n);
1227 std::__uninitialized_copy_a(__first, __last, __result,
1228 _M_get_Tp_allocator());
1233 _M_deallocate(__result, __n);
1234 __throw_exception_again;
1245 template<
typename _Integer>
1247 _M_initialize_dispatch(_Integer __n, _Integer __value, __true_type)
1249 this->_M_impl._M_start = _M_allocate(static_cast<size_type>(__n));
1250 this->_M_impl._M_end_of_storage =
1251 this->_M_impl._M_start +
static_cast<size_type
>(__n);
1252 _M_fill_initialize(static_cast<size_type>(__n), __value);
1256 template<
typename _InputIterator>
1258 _M_initialize_dispatch(_InputIterator __first, _InputIterator __last,
1261 typedef typename std::iterator_traits<_InputIterator>::
1262 iterator_category _IterCategory;
1263 _M_range_initialize(__first, __last, _IterCategory());
1267 template<
typename _InputIterator>
1269 _M_range_initialize(_InputIterator __first,
1272 for (; __first != __last; ++__first)
1273 #
if __cplusplus >= 201103L
1274 emplace_back(*__first);
1276 push_back(*__first);
1281 template<
typename _ForwardIterator>
1283 _M_range_initialize(_ForwardIterator __first,
1287 this->_M_impl._M_start = this->_M_allocate(__n);
1288 this->_M_impl._M_end_of_storage = this->_M_impl._M_start + __n;
1289 this->_M_impl._M_finish =
1290 std::__uninitialized_copy_a(__first, __last,
1291 this->_M_impl._M_start,
1292 _M_get_Tp_allocator());
1298 _M_fill_initialize(size_type __n,
const value_type& __value)
1300 this->_M_impl._M_finish =
1301 std::__uninitialized_fill_n_a(this->_M_impl._M_start, __n, __value,
1302 _M_get_Tp_allocator());
1305 #if __cplusplus >= 201103L 1308 _M_default_initialize(size_type __n)
1310 this->_M_impl._M_finish =
1311 std::__uninitialized_default_n_a(this->_M_impl._M_start, __n,
1312 _M_get_Tp_allocator());
1323 template<
typename _Integer>
1325 _M_assign_dispatch(_Integer __n, _Integer __val, __true_type)
1326 { _M_fill_assign(__n, __val); }
1329 template<
typename _InputIterator>
1331 _M_assign_dispatch(_InputIterator __first, _InputIterator __last,
1334 typedef typename std::iterator_traits<_InputIterator>::
1335 iterator_category _IterCategory;
1336 _M_assign_aux(__first, __last, _IterCategory());
1340 template<
typename _InputIterator>
1342 _M_assign_aux(_InputIterator __first, _InputIterator __last,
1346 template<
typename _ForwardIterator>
1348 _M_assign_aux(_ForwardIterator __first, _ForwardIterator __last,
1354 _M_fill_assign(size_type __n,
const value_type& __val);
1363 template<
typename _Integer>
1365 _M_insert_dispatch(iterator __pos, _Integer __n, _Integer __val,
1367 { _M_fill_insert(__pos, __n, __val); }
1370 template<
typename _InputIterator>
1372 _M_insert_dispatch(iterator __pos, _InputIterator __first,
1373 _InputIterator __last, __false_type)
1375 typedef typename std::iterator_traits<_InputIterator>::
1376 iterator_category _IterCategory;
1377 _M_range_insert(__pos, __first, __last, _IterCategory());
1381 template<
typename _InputIterator>
1383 _M_range_insert(iterator __pos, _InputIterator __first,
1387 template<
typename _ForwardIterator>
1389 _M_range_insert(iterator __pos, _ForwardIterator __first,
1395 _M_fill_insert(iterator __pos, size_type __n,
const value_type& __x);
1397 #if __cplusplus >= 201103L 1400 _M_default_append(size_type __n);
1407 #if __cplusplus < 201103L 1409 _M_insert_aux(iterator __position,
const value_type& __x);
1411 template<
typename... _Args>
1413 _M_insert_aux(iterator __position, _Args&&... __args);
1415 template<
typename... _Args>
1417 _M_emplace_back_aux(_Args&&... __args);
1422 _M_check_len(size_type __n,
const char* __s)
const 1424 if (max_size() - size() < __n)
1425 __throw_length_error(__N(__s));
1427 const size_type __len = size() +
std::max(size(), __n);
1428 return (__len < size() || __len > max_size()) ? max_size() : __len;
1436 _M_erase_at_end(pointer __pos) _GLIBCXX_NOEXCEPT
1438 std::_Destroy(__pos, this->_M_impl._M_finish, _M_get_Tp_allocator());
1439 this->_M_impl._M_finish = __pos;
1443 _M_erase(iterator __position);
1446 _M_erase(iterator __first, iterator __last);
1448 #if __cplusplus >= 201103L 1456 vector __tmp(get_allocator());
1457 this->_M_impl._M_swap_data(__tmp._M_impl);
1458 this->_M_impl._M_swap_data(__x._M_impl);
1459 std::__alloc_on_move(_M_get_Tp_allocator(), __x._M_get_Tp_allocator());
1467 if (__x._M_get_Tp_allocator() == this->_M_get_Tp_allocator())
1473 this->assign(std::__make_move_if_noexcept_iterator(__x.begin()),
1474 std::__make_move_if_noexcept_iterator(__x.end()));
1480 #if __cplusplus >= 201103L 1481 template<
typename _Up>
1483 _M_data_ptr(_Up* __ptr)
const 1486 template<
typename _Ptr>
1488 _M_data_ptr(_Ptr __ptr)
const 1491 template<
typename _Ptr>
1493 _M_data_ptr(_Ptr __ptr)
const 1509 template<
typename _Tp,
typename _Alloc>
1526 template<
typename _Tp,
typename _Alloc>
1530 __y.begin(), __y.end()); }
1533 template<
typename _Tp,
typename _Alloc>
1536 {
return !(__x == __y); }
1539 template<
typename _Tp,
typename _Alloc>
1542 {
return __y < __x; }
1545 template<
typename _Tp,
typename _Alloc>
1548 {
return !(__y < __x); }
1551 template<
typename _Tp,
typename _Alloc>
1554 {
return !(__x < __y); }
1557 template<
typename _Tp,
typename _Alloc>
1562 _GLIBCXX_END_NAMESPACE_CONTAINER
vector(const vector &__x, const allocator_type &__a)
Copy constructor with alternative allocator.
size_type max_size() const noexcept
vector(const vector &__x)
Vector copy constructor.
reference at(size_type __n)
Provides access to the data contained in the vector.
vector(size_type __n, const value_type &__value, const allocator_type &__a=allocator_type())
Creates a vector with copies of an exemplar element.
bool lexicographical_compare(_II1 __first1, _II1 __last1, _II2 __first2, _II2 __last2, _Compare __comp)
Performs dictionary comparison on ranges.
const_reverse_iterator rbegin() const noexcept
const_reverse_iterator crbegin() const noexcept
void push_back(const value_type &__x)
Add data to the end of the vector.
_Tp * __addressof(_Tp &__r) noexcept
Same as C++11 std::addressof.
void assign(_InputIterator __first, _InputIterator __last)
Assigns a range to a vector.
const_iterator cbegin() const noexcept
reverse_iterator rend() noexcept
void assign(initializer_list< value_type > __l)
Assigns an initializer list to a vector.
integral_constant< bool, true > true_type
The type used as a compile-time boolean with true value.
iterator begin() noexcept
const_reference back() const noexcept
const_iterator end() const noexcept
iterator_traits< _InputIterator >::difference_type distance(_InputIterator __first, _InputIterator __last)
A generalization of pointer arithmetic.
const_reference at(size_type __n) const
Provides access to the data contained in the vector.
reference operator[](size_type __n) noexcept
Subscript access to the data contained in the vector.
const_iterator begin() const noexcept
iterator erase(const_iterator __first, const_iterator __last)
Remove a range of elements.
vector(vector &&__rv, const allocator_type &__m) noexcept(_Alloc_traits::_S_always_equal())
Move constructor with alternative allocator.
vector(vector &&__x) noexcept
Vector move constructor.
bool equal(_IIter1 __first1, _IIter1 __last1, _IIter2 __first2, _IIter2 __last2, _BinaryPredicate __binary_pred)
Tests a range for element-wise equality.
const_reference operator[](size_type __n) const noexcept
Subscript access to the data contained in the vector.
vector & operator=(vector &&__x) noexcept(_Alloc_traits::_S_nothrow_move())
Vector move assignment operator.
void _Destroy(_Tp *__pointer)
constexpr const _Tp * begin(initializer_list< _Tp > __ils) noexcept
Return an iterator pointing to the first element of the initializer_list.
reference front() noexcept
reference back() noexcept
_GLIBCXX14_CONSTEXPR const _Tp & max(const _Tp &, const _Tp &)
This does what you think it does.
const_reverse_iterator crend() const noexcept
void resize(size_type __new_size, const value_type &__x)
Resizes the vector to the specified number of elements.
Random-access iterators support a superset of bidirectional iterator operations.
const_iterator cend() const noexcept
A standard container which offers fixed time access to individual elements in any order...
iterator insert(const_iterator __position, initializer_list< value_type > __l)
Inserts an initializer_list into the vector.
vector() noexcept(is_nothrow_default_constructible< _Alloc >::value)
Creates a vector with no elements.
vector(size_type __n, const allocator_type &__a=allocator_type())
Creates a vector with default constructed elements.
reverse_iterator rbegin() noexcept
const_reverse_iterator rend() const noexcept
__ptrtr_elt_type< _Ptr >::__type element_type
The type pointed to.
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.
See bits/stl_deque.h's _Deque_base for an explanation.
void pop_back() noexcept
Removes last element.
iterator insert(const_iterator __position, value_type &&__x)
Inserts given rvalue into vector before specified iterator.
size_type capacity() const noexcept
size_type size() const noexcept
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 __position)
Remove element at given position.
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().
const_reference front() const noexcept
vector & operator=(initializer_list< value_type > __l)
Vector list assignment operator.
void swap(vector &__x) noexcept(_Alloc_traits::_S_nothrow_swap())
Swaps data with another vector.
Forward iterators support a superset of input iterator operations.
pointer _M_allocate_and_copy(size_type __n, _ForwardIterator __first, _ForwardIterator __last)
void resize(size_type __new_size)
Resizes the vector to the specified number of elements.
ISO C++ entities toplevel namespace is std.
constexpr const _Tp * end(initializer_list< _Tp > __ils) noexcept
Return an iterator pointing to one past the last element of the initializer_list. ...
vector(_InputIterator __first, _InputIterator __last, const allocator_type &__a=allocator_type())
Builds a vector from a range.
vector(const allocator_type &__a) noexcept
Creates a vector with no elements.
Uniform interface to C++98 and C++0x allocators.
bool empty() const noexcept
iterator insert(const_iterator __position, _InputIterator __first, _InputIterator __last)
Inserts a range into the vector.
void assign(size_type __n, const value_type &__val)
Assigns a given value to a vector.