56 #ifndef _STL_BVECTOR_H
57 #define _STL_BVECTOR_H 1
59 #if __cplusplus >= 201103L
64 namespace std _GLIBCXX_VISIBILITY(default)
66 _GLIBCXX_BEGIN_NAMESPACE_VERSION
67 _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
69 typedef unsigned long _Bit_type;
70 enum { _S_word_bit = int(__CHAR_BIT__ *
sizeof(_Bit_type)) };
77 _Bit_reference(_Bit_type * __x, _Bit_type __y)
78 : _M_p(__x), _M_mask(__y) { }
80 _Bit_reference() _GLIBCXX_NOEXCEPT : _M_p(0), _M_mask(0) { }
82 #if __cplusplus >= 201103L
83 _Bit_reference(
const _Bit_reference&) =
default;
86 operator bool() const _GLIBCXX_NOEXCEPT
87 {
return !!(*_M_p & _M_mask); }
90 operator=(
bool __x) _GLIBCXX_NOEXCEPT
100 operator=(
const _Bit_reference& __x) _GLIBCXX_NOEXCEPT
101 {
return *
this = bool(__x); }
104 operator==(
const _Bit_reference& __x)
const
105 {
return bool(*
this) == bool(__x); }
108 operator<(
const _Bit_reference& __x)
const
109 {
return !bool(*
this) && bool(__x); }
112 flip() _GLIBCXX_NOEXCEPT
113 { *_M_p ^= _M_mask; }
116 #if __cplusplus >= 201103L
118 swap(_Bit_reference __x, _Bit_reference __y) noexcept
126 swap(_Bit_reference __x,
bool& __y) noexcept
134 swap(
bool& __x, _Bit_reference __y) noexcept
142 struct _Bit_iterator_base
143 :
public std::iterator<std::random_access_iterator_tag, bool>
146 unsigned int _M_offset;
148 _Bit_iterator_base(_Bit_type * __x,
unsigned int __y)
149 : _M_p(__x), _M_offset(__y) { }
154 if (_M_offset++ ==
int(_S_word_bit) - 1)
164 if (_M_offset-- == 0)
166 _M_offset = int(_S_word_bit) - 1;
172 _M_incr(ptrdiff_t __i)
175 _M_p += __n / int(_S_word_bit);
176 __n = __n % int(_S_word_bit);
179 __n += int(_S_word_bit);
182 _M_offset =
static_cast<unsigned int>(__n);
185 friend _GLIBCXX20_CONSTEXPR
bool
186 operator==(
const _Bit_iterator_base& __x,
const _Bit_iterator_base& __y)
187 {
return __x._M_p == __y._M_p && __x._M_offset == __y._M_offset; }
189 #if __cpp_lib_three_way_comparison
190 friend constexpr strong_ordering
191 operator<=>(
const _Bit_iterator_base& __x,
const _Bit_iterator_base& __y)
194 if (
const auto __cmp = __x._M_p <=> __y._M_p; __cmp != 0)
196 return __x._M_offset <=> __y._M_offset;
200 operator<(
const _Bit_iterator_base& __x,
const _Bit_iterator_base& __y)
202 return __x._M_p < __y._M_p
203 || (__x._M_p == __y._M_p && __x._M_offset < __y._M_offset);
207 operator!=(
const _Bit_iterator_base& __x,
const _Bit_iterator_base& __y)
208 {
return !(__x == __y); }
211 operator>(
const _Bit_iterator_base& __x,
const _Bit_iterator_base& __y)
212 {
return __y < __x; }
215 operator<=(
const _Bit_iterator_base& __x,
const _Bit_iterator_base& __y)
216 {
return !(__y < __x); }
219 operator>=(
const _Bit_iterator_base& __x,
const _Bit_iterator_base& __y)
220 {
return !(__x < __y); }
224 operator-(
const _Bit_iterator_base& __x,
const _Bit_iterator_base& __y)
226 return (
int(_S_word_bit) * (__x._M_p - __y._M_p)
227 + __x._M_offset - __y._M_offset);
231 struct _Bit_iterator :
public _Bit_iterator_base
233 typedef _Bit_reference reference;
234 #if __cplusplus > 201703L
235 typedef void pointer;
237 typedef _Bit_reference* pointer;
239 typedef _Bit_iterator iterator;
241 _Bit_iterator() : _Bit_iterator_base(0, 0) { }
243 _Bit_iterator(_Bit_type * __x,
unsigned int __y)
244 : _Bit_iterator_base(__x, __y) { }
247 _M_const_cast()
const
252 {
return reference(_M_p, 1UL << _M_offset); }
264 iterator __tmp = *
this;
279 iterator __tmp = *
this;
285 operator+=(difference_type __i)
292 operator-=(difference_type __i)
299 operator[](difference_type __i)
const
300 {
return *(*
this + __i); }
303 operator+(
const iterator& __x, difference_type __n)
305 iterator __tmp = __x;
311 operator+(difference_type __n,
const iterator& __x)
312 {
return __x + __n; }
315 operator-(
const iterator& __x, difference_type __n)
317 iterator __tmp = __x;
323 struct _Bit_const_iterator :
public _Bit_iterator_base
325 typedef bool reference;
326 typedef bool const_reference;
327 #if __cplusplus > 201703L
328 typedef void pointer;
330 typedef const bool* pointer;
332 typedef _Bit_const_iterator const_iterator;
334 _Bit_const_iterator() : _Bit_iterator_base(0, 0) { }
336 _Bit_const_iterator(_Bit_type * __x,
unsigned int __y)
337 : _Bit_iterator_base(__x, __y) { }
339 _Bit_const_iterator(
const _Bit_iterator& __x)
340 : _Bit_iterator_base(__x._M_p, __x._M_offset) { }
343 _M_const_cast()
const
344 {
return _Bit_iterator(_M_p, _M_offset); }
348 {
return _Bit_reference(_M_p, 1UL << _M_offset); }
360 const_iterator __tmp = *
this;
375 const_iterator __tmp = *
this;
381 operator+=(difference_type __i)
388 operator-=(difference_type __i)
395 operator[](difference_type __i)
const
396 {
return *(*
this + __i); }
398 friend const_iterator
399 operator+(
const const_iterator& __x, difference_type __n)
401 const_iterator __tmp = __x;
406 friend const_iterator
407 operator-(
const const_iterator& __x, difference_type __n)
409 const_iterator __tmp = __x;
414 friend const_iterator
415 operator+(difference_type __n,
const const_iterator& __x)
416 {
return __x + __n; }
420 __fill_bvector(_Bit_type * __v,
421 unsigned int __first,
unsigned int __last,
bool __x)
423 const _Bit_type __fmask = ~0ul << __first;
424 const _Bit_type __lmask = ~0ul >> (_S_word_bit - __last);
425 const _Bit_type __mask = __fmask & __lmask;
434 fill(_Bit_iterator __first, _Bit_iterator __last,
const bool& __x)
436 if (__first._M_p != __last._M_p)
438 _Bit_type* __first_p = __first._M_p;
439 if (__first._M_offset != 0)
440 __fill_bvector(__first_p++, __first._M_offset, _S_word_bit, __x);
442 __builtin_memset(__first_p, __x ? ~0 : 0,
443 (__last._M_p - __first_p) *
sizeof(_Bit_type));
445 if (__last._M_offset != 0)
446 __fill_bvector(__last._M_p, 0, __last._M_offset, __x);
448 else if (__first._M_offset != __last._M_offset)
449 __fill_bvector(__first._M_p, __first._M_offset, __last._M_offset, __x);
452 template<
typename _Alloc>
456 rebind<_Bit_type>::other _Bit_alloc_type;
459 typedef typename _Bit_alloc_traits::pointer _Bit_pointer;
461 struct _Bvector_impl_data
463 _Bit_iterator _M_start;
464 _Bit_iterator _M_finish;
465 _Bit_pointer _M_end_of_storage;
467 _Bvector_impl_data() _GLIBCXX_NOEXCEPT
468 : _M_start(), _M_finish(), _M_end_of_storage()
471 #if __cplusplus >= 201103L
472 _Bvector_impl_data(_Bvector_impl_data&& __x) noexcept
473 : _M_start(__x._M_start), _M_finish(__x._M_finish)
474 , _M_end_of_storage(__x._M_end_of_storage)
478 _M_move_data(_Bvector_impl_data&& __x) noexcept
480 this->_M_start = __x._M_start;
481 this->_M_finish = __x._M_finish;
482 this->_M_end_of_storage = __x._M_end_of_storage;
488 _M_reset() _GLIBCXX_NOEXCEPT
490 _M_start = _M_finish = _Bit_iterator();
491 _M_end_of_storage = _Bit_pointer();
496 :
public _Bit_alloc_type,
public _Bvector_impl_data
499 _Bvector_impl() _GLIBCXX_NOEXCEPT_IF(
500 is_nothrow_default_constructible<_Bit_alloc_type>::value)
504 _Bvector_impl(
const _Bit_alloc_type& __a) _GLIBCXX_NOEXCEPT
505 : _Bit_alloc_type(__a)
508 #if __cplusplus >= 201103L
509 _Bvector_impl(_Bvector_impl&&) =
default;
513 _M_end_addr() const _GLIBCXX_NOEXCEPT
515 if (this->_M_end_of_storage)
522 typedef _Alloc allocator_type;
525 _M_get_Bit_allocator() _GLIBCXX_NOEXCEPT
526 {
return this->_M_impl; }
528 const _Bit_alloc_type&
529 _M_get_Bit_allocator() const _GLIBCXX_NOEXCEPT
530 {
return this->_M_impl; }
533 get_allocator() const _GLIBCXX_NOEXCEPT
534 {
return allocator_type(_M_get_Bit_allocator()); }
536 #if __cplusplus >= 201103L
537 _Bvector_base() =
default;
542 _Bvector_base(
const allocator_type& __a)
545 #if __cplusplus >= 201103L
546 _Bvector_base(_Bvector_base&&) =
default;
550 { this->_M_deallocate(); }
553 _Bvector_impl _M_impl;
556 _M_allocate(
size_t __n)
562 if (_M_impl._M_start._M_p)
564 const size_t __n = _M_impl._M_end_addr() - _M_impl._M_start._M_p;
566 _M_impl._M_end_of_storage - __n,
572 #if __cplusplus >= 201103L
574 _M_move_data(_Bvector_base&& __x) noexcept
575 { _M_impl._M_move_data(
std::move(__x._M_impl)); }
580 {
return (__n +
int(_S_word_bit) - 1) / int(_S_word_bit); }
583 _GLIBCXX_END_NAMESPACE_CONTAINER
584 _GLIBCXX_END_NAMESPACE_VERSION
590 namespace std _GLIBCXX_VISIBILITY(default)
592 _GLIBCXX_BEGIN_NAMESPACE_VERSION
593 _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
614 template<
typename _Alloc>
615 class vector<bool, _Alloc> :
protected _Bvector_base<_Alloc>
617 typedef _Bvector_base<_Alloc> _Base;
618 typedef typename _Base::_Bit_pointer _Bit_pointer;
621 #if __cplusplus >= 201103L
626 typedef bool value_type;
627 typedef size_t size_type;
628 typedef ptrdiff_t difference_type;
629 typedef _Bit_reference reference;
630 typedef bool const_reference;
631 typedef _Bit_reference* pointer;
632 typedef const bool* const_pointer;
633 typedef _Bit_iterator iterator;
634 typedef _Bit_const_iterator const_iterator;
637 typedef _Alloc allocator_type;
641 {
return _Base::get_allocator(); }
644 using _Base::_M_allocate;
645 using _Base::_M_deallocate;
646 using _Base::_S_nword;
647 using _Base::_M_get_Bit_allocator;
650 #if __cplusplus >= 201103L
657 vector(
const allocator_type& __a)
660 #if __cplusplus >= 201103L
662 vector(size_type __n,
const allocator_type& __a = allocator_type())
666 vector(size_type __n,
const bool& __value,
667 const allocator_type& __a = allocator_type())
670 vector(size_type __n,
const bool& __value =
bool(),
671 const allocator_type& __a = allocator_type())
676 _M_initialize_value(__value);
680 : _Base(_Bit_alloc_traits::_S_select_on_copy(__x._M_get_Bit_allocator()))
682 _M_initialize(__x.
size());
683 _M_copy_aligned(__x.
begin(), __x.
end(), this->_M_impl._M_start);
686 #if __cplusplus >= 201103L
690 noexcept(_Bit_alloc_traits::_S_always_equal())
697 _M_initialize(__x.
size());
706 _M_initialize(__x.
size());
707 _M_copy_aligned(__x.
begin(), __x.
end(), this->_M_impl._M_start);
711 const allocator_type& __a = allocator_type())
714 _M_initialize_range(__l.begin(), __l.end(),
719 #if __cplusplus >= 201103L
720 template<
typename _InputIterator,
721 typename = std::_RequireInputIter<_InputIterator>>
722 vector(_InputIterator __first, _InputIterator __last,
723 const allocator_type& __a = allocator_type())
725 { _M_initialize_dispatch(__first, __last, __false_type()); }
727 template<
typename _InputIterator>
728 vector(_InputIterator __first, _InputIterator __last,
729 const allocator_type& __a = allocator_type())
732 typedef typename std::__is_integer<_InputIterator>::__type _Integral;
733 _M_initialize_dispatch(__first, __last, _Integral());
737 ~vector() _GLIBCXX_NOEXCEPT { }
744 #if __cplusplus >= 201103L
745 if (_Bit_alloc_traits::_S_propagate_on_copy_assign())
747 if (this->_M_get_Bit_allocator() != __x._M_get_Bit_allocator())
749 this->_M_deallocate();
750 std::__alloc_on_copy(_M_get_Bit_allocator(),
751 __x._M_get_Bit_allocator());
752 _M_initialize(__x.
size());
755 std::__alloc_on_copy(_M_get_Bit_allocator(),
756 __x._M_get_Bit_allocator());
761 this->_M_deallocate();
762 _M_initialize(__x.
size());
764 this->_M_impl._M_finish = _M_copy_aligned(__x.
begin(), __x.
end(),
769 #if __cplusplus >= 201103L
773 if (_Bit_alloc_traits::_S_propagate_on_move_assign()
774 || this->_M_get_Bit_allocator() == __x._M_get_Bit_allocator())
776 this->_M_deallocate();
778 std::__alloc_on_move(_M_get_Bit_allocator(),
779 __x._M_get_Bit_allocator());
785 this->_M_deallocate();
786 _M_initialize(__x.
size());
788 this->_M_impl._M_finish = _M_copy_aligned(__x.
begin(), __x.
end(),
798 this->
assign (__l.begin(), __l.end());
808 assign(size_type __n,
const bool& __x)
809 { _M_fill_assign(__n, __x); }
811 #if __cplusplus >= 201103L
812 template<
typename _InputIterator,
813 typename = std::_RequireInputIter<_InputIterator>>
815 assign(_InputIterator __first, _InputIterator __last)
818 template<
typename _InputIterator>
820 assign(_InputIterator __first, _InputIterator __last)
822 typedef typename std::__is_integer<_InputIterator>::__type _Integral;
823 _M_assign_dispatch(__first, __last, _Integral());
827 #if __cplusplus >= 201103L
834 begin() _GLIBCXX_NOEXCEPT
835 {
return iterator(this->_M_impl._M_start._M_p, 0); }
838 begin()
const _GLIBCXX_NOEXCEPT
839 {
return const_iterator(this->_M_impl._M_start._M_p, 0); }
842 end() _GLIBCXX_NOEXCEPT
843 {
return this->_M_impl._M_finish; }
846 end()
const _GLIBCXX_NOEXCEPT
847 {
return this->_M_impl._M_finish; }
850 rbegin() _GLIBCXX_NOEXCEPT
854 rbegin()
const _GLIBCXX_NOEXCEPT
858 rend() _GLIBCXX_NOEXCEPT
862 rend()
const _GLIBCXX_NOEXCEPT
865 #if __cplusplus >= 201103L
868 {
return const_iterator(this->_M_impl._M_start._M_p, 0); }
871 cend()
const noexcept
872 {
return this->_M_impl._M_finish; }
879 crend()
const noexcept
884 size()
const _GLIBCXX_NOEXCEPT
885 {
return size_type(
end() -
begin()); }
890 const size_type __isize =
891 __gnu_cxx::__numeric_traits<difference_type>::__max
892 - int(_S_word_bit) + 1;
893 const size_type __asize
894 = _Bit_alloc_traits::max_size(_M_get_Bit_allocator());
895 return (__asize <= __isize /
int(_S_word_bit)
896 ? __asize *
int(_S_word_bit) : __isize);
901 {
return size_type(const_iterator(this->_M_impl._M_end_addr(), 0)
904 _GLIBCXX_NODISCARD
bool
905 empty()
const _GLIBCXX_NOEXCEPT
911 return *iterator(this->_M_impl._M_start._M_p
912 + __n /
int(_S_word_bit), __n %
int(_S_word_bit));
918 return *const_iterator(this->_M_impl._M_start._M_p
919 + __n /
int(_S_word_bit), __n %
int(_S_word_bit));
926 if (__n >= this->
size())
927 __throw_out_of_range_fmt(__N(
"vector<bool>::_M_range_check: __n "
928 "(which is %zu) >= this->size() "
939 at(size_type __n)
const
946 __throw_length_error(__N(
"vector::reserve"));
961 {
return *(
end() - 1); }
965 {
return *(
end() - 1); }
973 data() _GLIBCXX_NOEXCEPT { }
978 if (this->_M_impl._M_finish._M_p != this->_M_impl._M_end_addr())
979 *this->_M_impl._M_finish++ = __x;
981 _M_insert_aux(
end(), __x);
987 std::swap(this->_M_impl._M_start, __x._M_impl._M_start);
988 std::swap(this->_M_impl._M_finish, __x._M_impl._M_finish);
989 std::swap(this->_M_impl._M_end_of_storage,
990 __x._M_impl._M_end_of_storage);
991 _Bit_alloc_traits::_S_on_swap(_M_get_Bit_allocator(),
992 __x._M_get_Bit_allocator());
997 swap(reference __x, reference __y) _GLIBCXX_NOEXCEPT
1005 #if __cplusplus >= 201103L
1006 insert(const_iterator __position,
const bool& __x =
bool())
1008 insert(iterator __position,
const bool& __x =
bool())
1011 const difference_type __n = __position -
begin();
1012 if (this->_M_impl._M_finish._M_p != this->_M_impl._M_end_addr()
1013 && __position ==
end())
1014 *this->_M_impl._M_finish++ = __x;
1016 _M_insert_aux(__position._M_const_cast(), __x);
1017 return begin() + __n;
1020 #if __cplusplus >= 201103L
1021 template<
typename _InputIterator,
1022 typename = std::_RequireInputIter<_InputIterator>>
1024 insert(const_iterator __position,
1025 _InputIterator __first, _InputIterator __last)
1027 difference_type __offset = __position -
cbegin();
1028 _M_insert_dispatch(__position._M_const_cast(),
1029 __first, __last, __false_type());
1030 return begin() + __offset;
1033 template<
typename _InputIterator>
1035 insert(iterator __position,
1036 _InputIterator __first, _InputIterator __last)
1038 typedef typename std::__is_integer<_InputIterator>::__type _Integral;
1039 _M_insert_dispatch(__position, __first, __last, _Integral());
1043 #if __cplusplus >= 201103L
1045 insert(const_iterator __position, size_type __n,
const bool& __x)
1047 difference_type __offset = __position -
cbegin();
1048 _M_fill_insert(__position._M_const_cast(), __n, __x);
1049 return begin() + __offset;
1053 insert(iterator __position, size_type __n,
const bool& __x)
1054 { _M_fill_insert(__position, __n, __x); }
1057 #if __cplusplus >= 201103L
1060 {
return this->
insert(__p, __l.begin(), __l.end()); }
1065 { --this->_M_impl._M_finish; }
1068 #if __cplusplus >= 201103L
1069 erase(const_iterator __position)
1071 erase(iterator __position)
1073 {
return _M_erase(__position._M_const_cast()); }
1076 #if __cplusplus >= 201103L
1077 erase(const_iterator __first, const_iterator __last)
1079 erase(iterator __first, iterator __last)
1081 {
return _M_erase(__first._M_const_cast(), __last._M_const_cast()); }
1084 resize(size_type __new_size,
bool __x =
bool())
1086 if (__new_size <
size())
1087 _M_erase_at_end(
begin() + difference_type(__new_size));
1092 #if __cplusplus >= 201103L
1095 { _M_shrink_to_fit(); }
1099 flip() _GLIBCXX_NOEXCEPT
1101 _Bit_type *
const __end = this->_M_impl._M_end_addr();
1102 for (_Bit_type * __p = this->_M_impl._M_start._M_p; __p != __end; ++__p)
1107 clear() _GLIBCXX_NOEXCEPT
1108 { _M_erase_at_end(
begin()); }
1110 #if __cplusplus >= 201103L
1111 template<
typename... _Args>
1112 #if __cplusplus > 201402L
1117 emplace_back(_Args&&... __args)
1120 #if __cplusplus > 201402L
1125 template<
typename... _Args>
1127 emplace(const_iterator __pos, _Args&&... __args)
1128 {
return insert(__pos,
bool(__args...)); }
1134 _M_copy_aligned(const_iterator __first, const_iterator __last,
1137 _Bit_type* __q = std::copy(__first._M_p, __last._M_p, __result._M_p);
1138 return std::copy(const_iterator(__last._M_p, 0), __last,
1143 _M_initialize(size_type __n)
1147 _Bit_pointer __q = this->_M_allocate(__n);
1148 this->_M_impl._M_end_of_storage = __q + _S_nword(__n);
1153 this->_M_impl._M_end_of_storage = _Bit_pointer();
1154 this->_M_impl._M_start = iterator(0, 0);
1156 this->_M_impl._M_finish = this->_M_impl._M_start + difference_type(__n);
1161 _M_initialize_value(
bool __x)
1163 if (_Bit_type* __p = this->_M_impl._M_start._M_p)
1164 __builtin_memset(__p, __x ? ~0 : 0,
1165 (this->_M_impl._M_end_addr() - __p)
1166 *
sizeof(_Bit_type));
1170 _M_reallocate(size_type __n);
1172 #if __cplusplus >= 201103L
1181 template<
typename _Integer>
1183 _M_initialize_dispatch(_Integer __n, _Integer __x, __true_type)
1185 _M_initialize(
static_cast<size_type
>(__n));
1186 _M_initialize_value(__x);
1189 template<
typename _InputIterator>
1191 _M_initialize_dispatch(_InputIterator __first, _InputIterator __last,
1193 { _M_initialize_range(__first, __last,
1196 template<
typename _InputIterator>
1198 _M_initialize_range(_InputIterator __first, _InputIterator __last,
1201 for (; __first != __last; ++__first)
1205 template<
typename _ForwardIterator>
1207 _M_initialize_range(_ForwardIterator __first, _ForwardIterator __last,
1212 std::copy(__first, __last, this->_M_impl._M_start);
1215 #if __cplusplus < 201103L
1218 template<
typename _Integer>
1220 _M_assign_dispatch(_Integer __n, _Integer __val, __true_type)
1221 { _M_fill_assign(__n, __val); }
1223 template<
class _InputIterator>
1225 _M_assign_dispatch(_InputIterator __first, _InputIterator __last,
1231 _M_fill_assign(
size_t __n,
bool __x)
1235 _M_initialize_value(__x);
1240 _M_erase_at_end(
begin() + __n);
1241 _M_initialize_value(__x);
1245 template<
typename _InputIterator>
1247 _M_assign_aux(_InputIterator __first, _InputIterator __last,
1250 iterator __cur =
begin();
1251 for (; __first != __last && __cur !=
end(); ++__cur, (void)++__first)
1253 if (__first == __last)
1254 _M_erase_at_end(__cur);
1259 template<
typename _ForwardIterator>
1261 _M_assign_aux(_ForwardIterator __first, _ForwardIterator __last,
1266 _M_erase_at_end(std::copy(__first, __last,
begin()));
1269 _ForwardIterator __mid = __first;
1271 std::copy(__first, __mid,
begin());
1280 template<
typename _Integer>
1282 _M_insert_dispatch(iterator __pos, _Integer __n, _Integer __x,
1284 { _M_fill_insert(__pos, __n, __x); }
1286 template<
typename _InputIterator>
1288 _M_insert_dispatch(iterator __pos,
1289 _InputIterator __first, _InputIterator __last,
1291 { _M_insert_range(__pos, __first, __last,
1295 _M_fill_insert(iterator __position, size_type __n,
bool __x);
1297 template<
typename _InputIterator>
1299 _M_insert_range(iterator __pos, _InputIterator __first,
1302 for (; __first != __last; ++__first)
1304 __pos =
insert(__pos, *__first);
1309 template<
typename _ForwardIterator>
1311 _M_insert_range(iterator __position, _ForwardIterator __first,
1315 _M_insert_aux(iterator __position,
bool __x);
1318 _M_check_len(size_type __n,
const char* __s)
const
1321 __throw_length_error(__N(__s));
1328 _M_erase_at_end(iterator __pos)
1329 { this->_M_impl._M_finish = __pos; }
1332 _M_erase(iterator __pos);
1335 _M_erase(iterator __first, iterator __last);
1338 _GLIBCXX_END_NAMESPACE_CONTAINER
1339 _GLIBCXX_END_NAMESPACE_VERSION
1342 #if __cplusplus >= 201103L
1344 namespace std _GLIBCXX_VISIBILITY(default)
1346 _GLIBCXX_BEGIN_NAMESPACE_VERSION
1350 template<
typename _Alloc>
1352 :
public __hash_base<size_t, _GLIBCXX_STD_C::vector<bool, _Alloc>>
1355 operator()(
const _GLIBCXX_STD_C::vector<bool, _Alloc>&)
const noexcept;
1358 _GLIBCXX_END_NAMESPACE_VERSION
constexpr complex< _Tp > operator*(const complex< _Tp > &__x, const complex< _Tp > &__y)
Return new complex value x times y.
constexpr complex< _Tp > operator-(const complex< _Tp > &__x, const complex< _Tp > &__y)
Return new complex value x minus y.
constexpr complex< _Tp > operator+(const complex< _Tp > &__x, const complex< _Tp > &__y)
Return new complex value x plus y.
constexpr _Tp * __addressof(_Tp &__r) noexcept
Same as C++11 std::addressof.
constexpr std::remove_reference< _Tp >::type && move(_Tp &&__t) noexcept
Convert a value to an rvalue.
constexpr const _Tp & max(const _Tp &, const _Tp &)
This does what you think it does.
constexpr iterator_traits< _Iter >::iterator_category __iterator_category(const _Iter &)
ISO C++ entities toplevel namespace is std.
constexpr iterator_traits< _InputIterator >::difference_type distance(_InputIterator __first, _InputIterator __last)
A generalization of pointer arithmetic.
constexpr void advance(_InputIterator &__i, _Distance __n)
A generalization of pointer arithmetic.
Primary class template hash.
Forward iterators support a superset of input iterator operations.
Random-access iterators support a superset of bidirectional iterator operations.
ptrdiff_t difference_type
Distance between iterators is represented as this type.
A standard container which offers fixed time access to individual elements in any order.
void resize(size_type __new_size)
Resizes the vector to the specified number of elements.
reference at(size_type __n)
Provides access to the data contained in the vector.
vector()=default
Creates a vector with no elements.
iterator erase(const_iterator __position)
Remove element at given position.
reverse_iterator rbegin() noexcept
bool empty() const noexcept
const_reverse_iterator crbegin() const noexcept
reference front() noexcept
allocator_type get_allocator() const noexcept
Get a copy of the memory allocation object.
reverse_iterator rend() noexcept
void push_back(const value_type &__x)
Add data to the end of the vector.
size_type max_size() const noexcept
const_reverse_iterator crend() const noexcept
void _M_range_check(size_type __n) const
Safety check used only from at().
void reserve(size_type __n)
Attempt to preallocate enough memory for specified number of elements.
void assign(size_type __n, const value_type &__val)
Assigns a given value to a vector.
void swap(vector &__x) noexcept
Swaps data with another vector.
void pop_back() noexcept
Removes last element.
vector & operator=(const vector &__x)
Vector assignment operator.
const_iterator cbegin() const noexcept
const_iterator cend() const noexcept
iterator emplace(const_iterator __position, _Args &&... __args)
Inserts an object in vector before specified iterator.
iterator begin() noexcept
reference back() noexcept
iterator insert(const_iterator __position, const value_type &__x)
Inserts given value into vector before specified iterator.
size_type size() const noexcept
size_type capacity() const noexcept
reference operator[](size_type __n) noexcept
Subscript access to the data contained in the vector.
Uniform interface to C++98 and C++11 allocators.
static constexpr pointer allocate(_Alloc &__a, size_type __n)
Allocate memory.
static constexpr void deallocate(_Alloc &__a, pointer __p, size_type __n)
Deallocate memory.