57#define _STL_BVECTOR_H 1
59#if __cplusplus >= 201103L
64namespace std _GLIBCXX_VISIBILITY(default)
66_GLIBCXX_BEGIN_NAMESPACE_VERSION
68 typedef unsigned long _Bit_type;
69 enum { _S_word_bit = int(__CHAR_BIT__ *
sizeof(_Bit_type)) };
71 __attribute__((__nonnull__))
74 __fill_bvector_n(_Bit_type*,
size_t,
bool) _GLIBCXX_NOEXCEPT;
76_GLIBCXX_BEGIN_NAMESPACE_CONTAINER
84 _Bit_reference(_Bit_type * __x, _Bit_type __y)
85 : _M_p(__x), _M_mask(__y) { }
88 _Bit_reference() _GLIBCXX_NOEXCEPT : _M_p(0), _M_mask(0) { }
90#if __cplusplus >= 201103L
91 _Bit_reference(
const _Bit_reference&) =
default;
94 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
95 operator bool() const _GLIBCXX_NOEXCEPT
96 {
return !!(*_M_p & _M_mask); }
100 operator=(
bool __x) _GLIBCXX_NOEXCEPT
109#if __cplusplus > 202002L
110 constexpr const _Bit_reference&
111 operator=(
bool __x)
const noexcept
123 operator=(
const _Bit_reference& __x) _GLIBCXX_NOEXCEPT
124 {
return *
this = bool(__x); }
126 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
128 operator==(
const _Bit_reference& __x)
const
129 {
return bool(*
this) == bool(__x); }
131 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
133 operator<(
const _Bit_reference& __x)
const
134 {
return !bool(*
this) && bool(__x); }
138 flip() _GLIBCXX_NOEXCEPT
139 { *_M_p ^= _M_mask; }
141#if __cplusplus >= 201103L
144 swap(_Bit_reference __x, _Bit_reference __y)
noexcept
153 swap(_Bit_reference __x,
bool& __y)
noexcept
162 swap(
bool& __x, _Bit_reference __y)
noexcept
172#pragma GCC diagnostic push
173#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
174 struct _Bit_iterator_base
175 :
public std::iterator<std::random_access_iterator_tag, bool>
178 unsigned int _M_offset;
181 _Bit_iterator_base(_Bit_type * __x,
unsigned int __y)
182 : _M_p(__x), _M_offset(__y) { }
188 if (_M_offset++ ==
int(_S_word_bit) - 1)
199 if (_M_offset-- == 0)
201 _M_offset = int(_S_word_bit) - 1;
208 _M_incr(ptrdiff_t __i)
211 _M_p += __n / int(_S_word_bit);
212 __n = __n % int(_S_word_bit);
215 __n += int(_S_word_bit);
218 _M_offset =
static_cast<unsigned int>(__n);
222 friend _GLIBCXX20_CONSTEXPR
bool
223 operator==(
const _Bit_iterator_base& __x,
const _Bit_iterator_base& __y)
224 {
return __x._M_p == __y._M_p && __x._M_offset == __y._M_offset; }
226#if __cpp_lib_three_way_comparison
228 friend constexpr strong_ordering
229 operator<=>(
const _Bit_iterator_base& __x,
const _Bit_iterator_base& __y)
232 if (
const auto __cmp = __x._M_p <=> __y._M_p; __cmp != 0)
234 return __x._M_offset <=> __y._M_offset;
239 operator<(
const _Bit_iterator_base& __x,
const _Bit_iterator_base& __y)
241 return __x._M_p < __y._M_p
242 || (__x._M_p == __y._M_p && __x._M_offset < __y._M_offset);
247 operator!=(
const _Bit_iterator_base& __x,
const _Bit_iterator_base& __y)
248 {
return !(__x == __y); }
252 operator>(
const _Bit_iterator_base& __x,
const _Bit_iterator_base& __y)
253 {
return __y < __x; }
257 operator<=(
const _Bit_iterator_base& __x,
const _Bit_iterator_base& __y)
258 {
return !(__y < __x); }
262 operator>=(
const _Bit_iterator_base& __x,
const _Bit_iterator_base& __y)
263 {
return !(__x < __y); }
266 friend _GLIBCXX20_CONSTEXPR ptrdiff_t
267 operator-(
const _Bit_iterator_base& __x,
const _Bit_iterator_base& __y)
269 return (
int(_S_word_bit) * (__x._M_p - __y._M_p)
270 + __x._M_offset - __y._M_offset);
273#pragma GCC diagnostic pop
275 struct _Bit_iterator :
public _Bit_iterator_base
277 typedef _Bit_reference reference;
278#if __cplusplus > 201703L
279 typedef void pointer;
281 typedef _Bit_reference* pointer;
283 typedef _Bit_iterator iterator;
286 _Bit_iterator() : _Bit_iterator_base(0, 0) { }
289 _Bit_iterator(_Bit_type * __x,
unsigned int __y)
290 : _Bit_iterator_base(__x, __y) { }
294 _M_const_cast()
const
297 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
300 {
return reference(_M_p, 1UL << _M_offset); }
314 iterator __tmp = *
this;
331 iterator __tmp = *
this;
352 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
355 {
return *(*
this + __i); }
358 friend _GLIBCXX20_CONSTEXPR iterator
361 iterator __tmp = __x;
367 friend _GLIBCXX20_CONSTEXPR iterator
369 {
return __x + __n; }
372 friend _GLIBCXX20_CONSTEXPR iterator
375 iterator __tmp = __x;
381 struct _Bit_const_iterator :
public _Bit_iterator_base
383 typedef bool reference;
384 typedef bool const_reference;
385#if __cplusplus > 201703L
386 typedef void pointer;
388 typedef const bool* pointer;
390 typedef _Bit_const_iterator const_iterator;
393 _Bit_const_iterator() : _Bit_iterator_base(0, 0) { }
396 _Bit_const_iterator(_Bit_type * __x,
unsigned int __y)
397 : _Bit_iterator_base(__x, __y) { }
400 _Bit_const_iterator(
const _Bit_iterator& __x)
401 : _Bit_iterator_base(__x._M_p, __x._M_offset) { }
405 _M_const_cast()
const
406 {
return _Bit_iterator(_M_p, _M_offset); }
408 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
411 {
return _Bit_reference(_M_p, 1UL << _M_offset); }
425 const_iterator __tmp = *
this;
442 const_iterator __tmp = *
this;
463 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
466 {
return *(*
this + __i); }
469 friend _GLIBCXX20_CONSTEXPR const_iterator
472 const_iterator __tmp = __x;
478 friend _GLIBCXX20_CONSTEXPR const_iterator
481 const_iterator __tmp = __x;
487 friend _GLIBCXX20_CONSTEXPR const_iterator
489 {
return __x + __n; }
492 template<
typename _Alloc>
496 rebind<_Bit_type>::other _Bit_alloc_type;
499 typedef typename _Bit_alloc_traits::pointer _Bit_pointer;
501 struct _Bvector_impl_data
503#if !_GLIBCXX_INLINE_VERSION
504 _Bit_iterator _M_start;
511 void operator=(_Bit_iterator __it) { _M_p = __it._M_p; }
514 _Bit_iterator _M_finish;
515 _Bit_pointer _M_end_of_storage;
518 _Bvector_impl_data() _GLIBCXX_NOEXCEPT
519 : _M_start(), _M_finish(), _M_end_of_storage()
522#if __cplusplus >= 201103L
523 _Bvector_impl_data(
const _Bvector_impl_data&) =
default;
526 operator=(
const _Bvector_impl_data&) =
default;
529 _Bvector_impl_data(_Bvector_impl_data&& __x) noexcept
530 : _Bvector_impl_data(__x)
535 _M_move_data(_Bvector_impl_data&& __x)
noexcept
544 _M_reset() _GLIBCXX_NOEXCEPT
545 { *
this = _Bvector_impl_data(); }
549 _M_swap_data(_Bvector_impl_data& __x) _GLIBCXX_NOEXCEPT
558 :
public _Bit_alloc_type,
public _Bvector_impl_data
561 _Bvector_impl() _GLIBCXX_NOEXCEPT_IF(
562 is_nothrow_default_constructible<_Bit_alloc_type>::value)
567 _Bvector_impl(
const _Bit_alloc_type& __a) _GLIBCXX_NOEXCEPT
568 : _Bit_alloc_type(__a)
571#if __cplusplus >= 201103L
575 _Bvector_impl(_Bvector_impl&& __x) noexcept
580 _Bvector_impl(_Bit_alloc_type&& __a, _Bvector_impl&& __x) noexcept
587 _M_end_addr() const _GLIBCXX_NOEXCEPT
589 if (this->_M_end_of_storage)
596 typedef _Alloc allocator_type;
600 _M_get_Bit_allocator() _GLIBCXX_NOEXCEPT
601 {
return this->_M_impl; }
604 const _Bit_alloc_type&
605 _M_get_Bit_allocator() const _GLIBCXX_NOEXCEPT
606 {
return this->_M_impl; }
610 get_allocator() const _GLIBCXX_NOEXCEPT
611 {
return allocator_type(_M_get_Bit_allocator()); }
613#if __cplusplus >= 201103L
614 _Bvector_base() =
default;
620 _Bvector_base(
const allocator_type& __a)
623#if __cplusplus >= 201103L
624 _Bvector_base(_Bvector_base&&) =
default;
627 _Bvector_base(_Bvector_base&& __x,
const allocator_type& __a) noexcept
628 : _M_impl(_Bit_alloc_type(__a),
std::move(__x._M_impl))
634 { this->_M_deallocate(); }
637 _Bvector_impl _M_impl;
641 _M_allocate(
size_t __n)
644#if __cpp_lib_is_constant_evaluated
648 for (
size_t __i = 0; __i < __n; ++__i)
659 if (_M_impl._M_start._M_p)
661 const size_t __n = _M_impl._M_end_addr() - _M_impl._M_start._M_p;
663 _M_impl._M_end_of_storage - __n,
669#if __cplusplus >= 201103L
672 _M_move_data(_Bvector_base&& __x)
noexcept
673 { _M_impl._M_move_data(
std::move(__x._M_impl)); }
679 {
return (__n +
int(_S_word_bit) - 1) / int(_S_word_bit); }
703 template<
typename _Alloc>
704 class vector<bool, _Alloc> :
protected _Bvector_base<_Alloc>
706 typedef _Bvector_base<_Alloc> _Base;
707 typedef typename _Base::_Bit_pointer _Bit_pointer;
710#if __cplusplus >= 201103L
715 typedef bool value_type;
716 typedef size_t size_type;
717 typedef ptrdiff_t difference_type;
718 typedef _Bit_reference reference;
719 typedef bool const_reference;
720 typedef _Bit_reference* pointer;
721 typedef const bool* const_pointer;
722 typedef _Bit_iterator iterator;
723 typedef _Bit_const_iterator const_iterator;
726 typedef _Alloc allocator_type;
731 {
return _Base::get_allocator(); }
734 using _Base::_M_allocate;
735 using _Base::_M_deallocate;
736 using _Base::_S_nword;
737 using _Base::_M_get_Bit_allocator;
740#if __cplusplus >= 201103L
748 vector(
const allocator_type& __a)
751#if __cplusplus >= 201103L
754 vector(size_type __n,
const allocator_type& __a = allocator_type())
759 vector(size_type __n,
const bool& __value,
760 const allocator_type& __a = allocator_type())
763 vector(size_type __n,
const bool& __value =
bool(),
764 const allocator_type& __a = allocator_type())
769 _M_initialize_value(__value);
774 : _Base(_Bit_alloc_traits::_S_select_on_copy(__x._M_get_Bit_allocator()))
776 const_iterator __xbegin = __x.
begin(), __xend = __x.
end();
777 _M_initialize(__x.
size());
778 _M_copy_aligned(__xbegin, __xend,
begin());
781#if __cplusplus >= 201103L
798 _M_initialize(__x.
size());
806 vector(
vector&& __x,
const __type_identity_t<allocator_type>& __a)
807 noexcept(_Bit_alloc_traits::_S_always_equal())
813 vector(
const vector& __x,
const __type_identity_t<allocator_type>& __a)
816 _M_initialize(__x.
size());
822 const allocator_type& __a = allocator_type())
825 _M_initialize_range(__l.begin(), __l.end(),
830#if __cplusplus >= 201103L
831 template<
typename _InputIterator,
832 typename = std::_RequireInputIter<_InputIterator>>
834 vector(_InputIterator __first, _InputIterator __last,
835 const allocator_type& __a = allocator_type())
838 _M_initialize_range(__first, __last,
842 template<
typename _InputIterator>
843 vector(_InputIterator __first, _InputIterator __last,
844 const allocator_type& __a = allocator_type())
848 typedef typename std::__is_integer<_InputIterator>::__type _Integral;
849 _M_initialize_dispatch(__first, __last, _Integral());
854 ~vector() _GLIBCXX_NOEXCEPT { }
862#if __cplusplus >= 201103L
863 if (_Bit_alloc_traits::_S_propagate_on_copy_assign())
865 if (this->_M_get_Bit_allocator() != __x._M_get_Bit_allocator())
867 this->_M_deallocate();
868 std::__alloc_on_copy(_M_get_Bit_allocator(),
869 __x._M_get_Bit_allocator());
870 _M_initialize(__x.
size());
873 std::__alloc_on_copy(_M_get_Bit_allocator(),
874 __x._M_get_Bit_allocator());
879 this->_M_deallocate();
880 _M_initialize(__x.
size());
882 this->_M_impl._M_finish = _M_copy_aligned(__x.
begin(), __x.
end(),
887#if __cplusplus >= 201103L
892 if (_Bit_alloc_traits::_S_propagate_on_move_assign()
893 || this->_M_get_Bit_allocator() == __x._M_get_Bit_allocator())
895 this->_M_deallocate();
897 std::__alloc_on_move(_M_get_Bit_allocator(),
898 __x._M_get_Bit_allocator());
904 this->_M_deallocate();
905 _M_initialize(__x.
size());
907 this->_M_impl._M_finish = _M_copy_aligned(__x.
begin(), __x.
end(),
918 this->
assign(__l.begin(), __l.end());
929 assign(size_type __n,
const bool& __x)
930 { _M_fill_assign(__n, __x); }
932#if __cplusplus >= 201103L
933 template<
typename _InputIterator,
934 typename = std::_RequireInputIter<_InputIterator>>
937 assign(_InputIterator __first, _InputIterator __last)
940 template<
typename _InputIterator>
942 assign(_InputIterator __first, _InputIterator __last)
945 typedef typename std::__is_integer<_InputIterator>::__type _Integral;
946 _M_assign_dispatch(__first, __last, _Integral());
950#if __cplusplus >= 201103L
957 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
959 begin() _GLIBCXX_NOEXCEPT
960 {
return iterator(this->_M_impl._M_start._M_p, 0); }
962 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
964 begin()
const _GLIBCXX_NOEXCEPT
965 {
return const_iterator(this->_M_impl._M_start._M_p, 0); }
967 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
969 end() _GLIBCXX_NOEXCEPT
970 {
return this->_M_impl._M_finish; }
972 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
974 end()
const _GLIBCXX_NOEXCEPT
975 {
return this->_M_impl._M_finish; }
977 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
979 rbegin() _GLIBCXX_NOEXCEPT
982 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
984 rbegin()
const _GLIBCXX_NOEXCEPT
987 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
989 rend() _GLIBCXX_NOEXCEPT
992 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
994 rend()
const _GLIBCXX_NOEXCEPT
997#if __cplusplus >= 201103L
998 [[__nodiscard__]] _GLIBCXX20_CONSTEXPR
1001 {
return const_iterator(this->_M_impl._M_start._M_p, 0); }
1003 [[__nodiscard__]] _GLIBCXX20_CONSTEXPR
1005 cend()
const noexcept
1006 {
return this->_M_impl._M_finish; }
1008 [[__nodiscard__]] _GLIBCXX20_CONSTEXPR
1013 [[__nodiscard__]] _GLIBCXX20_CONSTEXPR
1015 crend()
const noexcept
1019 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
1021 size()
const _GLIBCXX_NOEXCEPT
1022 {
return size_type(
end() -
begin()); }
1024 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
1028 const size_type __isize =
1029 __gnu_cxx::__numeric_traits<difference_type>::__max
1030 - int(_S_word_bit) + 1;
1031 const size_type __asize
1032 = _Bit_alloc_traits::max_size(_M_get_Bit_allocator());
1033 return (__asize <= __isize /
int(_S_word_bit)
1034 ? __asize *
int(_S_word_bit) : __isize);
1037 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
1040 {
return size_type(const_iterator(this->_M_impl._M_end_addr(), 0)
1043 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
1045 empty()
const _GLIBCXX_NOEXCEPT
1048 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
1051 {
return begin()[__n]; }
1053 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
1056 {
return begin()[__n]; }
1059 _GLIBCXX20_CONSTEXPR
1063 if (__n >= this->
size())
1064 __throw_out_of_range_fmt(__N(
"vector<bool>::_M_range_check: __n "
1065 "(which is %zu) >= this->size() "
1071 _GLIBCXX20_CONSTEXPR
1076 return (*
this)[__n];
1079 _GLIBCXX20_CONSTEXPR
1081 at(size_type __n)
const
1084 return (*
this)[__n];
1087 _GLIBCXX20_CONSTEXPR
1092 __throw_length_error(__N(
"vector::reserve"));
1097 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
1100 {
return *
begin(); }
1102 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
1105 {
return *
begin(); }
1107 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
1110 {
return *(
end() - 1); }
1112 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
1115 {
return *(
end() - 1); }
1117 _GLIBCXX20_CONSTEXPR
1121 if (this->_M_impl._M_finish._M_p != this->_M_impl._M_end_addr())
1122 *this->_M_impl._M_finish++ = __x;
1124 _M_insert_aux(
end(), __x);
1127 _GLIBCXX20_CONSTEXPR
1129 swap(
vector& __x) _GLIBCXX_NOEXCEPT
1131#if __cplusplus >= 201103L
1132 __glibcxx_assert(_Bit_alloc_traits::propagate_on_container_swap::value
1133 || _M_get_Bit_allocator() == __x._M_get_Bit_allocator());
1135 this->_M_impl._M_swap_data(__x._M_impl);
1136 _Bit_alloc_traits::_S_on_swap(_M_get_Bit_allocator(),
1137 __x._M_get_Bit_allocator());
1141 _GLIBCXX20_CONSTEXPR
1143 swap(reference __x, reference __y) _GLIBCXX_NOEXCEPT
1150 _GLIBCXX20_CONSTEXPR
1152#if __cplusplus >= 201103L
1153 insert(const_iterator __position,
const bool& __x)
1155 insert(iterator __position,
const bool& __x)
1158 const difference_type __n = __position -
begin();
1159 if (this->_M_impl._M_finish._M_p != this->_M_impl._M_end_addr()
1160 && __position ==
end())
1161 *this->_M_impl._M_finish++ = __x;
1163 _M_insert_aux(__position._M_const_cast(), __x);
1164 return begin() + __n;
1167#if _GLIBCXX_USE_DEPRECATED
1168 _GLIBCXX_DEPRECATED_SUGGEST(
"insert(position, false)")
1170 insert(const_iterator __position)
1171 {
return this->
insert(__position._M_const_cast(),
false); }
1174#if __cplusplus >= 201103L
1175 template<
typename _InputIterator,
1176 typename = std::_RequireInputIter<_InputIterator>>
1177 _GLIBCXX20_CONSTEXPR
1179 insert(const_iterator __position,
1180 _InputIterator __first, _InputIterator __last)
1182 difference_type __offset = __position -
cbegin();
1183 _M_insert_range(__position._M_const_cast(),
1186 return begin() + __offset;
1189 template<
typename _InputIterator>
1191 insert(iterator __position,
1192 _InputIterator __first, _InputIterator __last)
1195 typedef typename std::__is_integer<_InputIterator>::__type _Integral;
1196 _M_insert_dispatch(__position, __first, __last, _Integral());
1200#if __cplusplus >= 201103L
1201 _GLIBCXX20_CONSTEXPR
1203 insert(const_iterator __position, size_type __n,
const bool& __x)
1205 difference_type __offset = __position -
cbegin();
1206 _M_fill_insert(__position._M_const_cast(), __n, __x);
1207 return begin() + __offset;
1211 insert(iterator __position, size_type __n,
const bool& __x)
1212 { _M_fill_insert(__position, __n, __x); }
1215#if __cplusplus >= 201103L
1216 _GLIBCXX20_CONSTEXPR
1219 {
return this->
insert(__p, __l.begin(), __l.end()); }
1222 _GLIBCXX20_CONSTEXPR
1225 { --this->_M_impl._M_finish; }
1227 _GLIBCXX20_CONSTEXPR
1229#if __cplusplus >= 201103L
1230 erase(const_iterator __position)
1232 erase(iterator __position)
1234 {
return _M_erase(__position._M_const_cast()); }
1236 _GLIBCXX20_CONSTEXPR
1238#if __cplusplus >= 201103L
1239 erase(const_iterator __first, const_iterator __last)
1241 erase(iterator __first, iterator __last)
1243 {
return _M_erase(__first._M_const_cast(), __last._M_const_cast()); }
1245 _GLIBCXX20_CONSTEXPR
1247 resize(size_type __new_size,
bool __x =
bool())
1249 if (__new_size <
size())
1250 _M_erase_at_end(
begin() + difference_type(__new_size));
1255#if __cplusplus >= 201103L
1256 _GLIBCXX20_CONSTEXPR
1259 { _M_shrink_to_fit(); }
1262 _GLIBCXX20_CONSTEXPR
1264 flip() _GLIBCXX_NOEXCEPT
1266 _Bit_type *
const __end = this->_M_impl._M_end_addr();
1267 for (_Bit_type * __p = this->_M_impl._M_start._M_p; __p != __end; ++__p)
1271 _GLIBCXX20_CONSTEXPR
1273 clear() _GLIBCXX_NOEXCEPT
1274 { _M_erase_at_end(
begin()); }
1276#if __cplusplus >= 201103L
1277 template<
typename... _Args>
1278#if __cplusplus > 201402L
1279 _GLIBCXX20_CONSTEXPR
1284 emplace_back(_Args&&... __args)
1287#if __cplusplus > 201402L
1292 template<
typename... _Args>
1293 _GLIBCXX20_CONSTEXPR
1295 emplace(const_iterator __pos, _Args&&... __args)
1296 {
return insert(__pos,
bool(__args...)); }
1301 _GLIBCXX20_CONSTEXPR
1303 _M_copy_aligned(const_iterator __first, const_iterator __last,
1306 _Bit_type* __q = std::copy(__first._M_p, __last._M_p, __result._M_p);
1307 return std::copy(const_iterator(__last._M_p, 0), __last,
1311 _GLIBCXX20_CONSTEXPR
1313 _M_initialize(size_type __n)
1317 _Bit_pointer __q = this->_M_allocate(__n);
1318 this->_M_impl._M_end_of_storage = __q + _S_nword(__n);
1320 this->_M_impl._M_start = __start;
1321 this->_M_impl._M_finish = __start + difference_type(__n);
1325 _GLIBCXX20_CONSTEXPR
1327 _M_initialize_value(
bool __x) _GLIBCXX_NOEXCEPT
1329 if (_Bit_type* __p = this->_M_impl._M_start._M_p)
1330 __fill_bvector_n(__p, this->_M_impl._M_end_addr() - __p, __x);
1333 _GLIBCXX20_CONSTEXPR
1335 _M_reallocate(size_type __n);
1337#if __cplusplus >= 201103L
1338 _GLIBCXX20_CONSTEXPR
1343#if __cplusplus < 201103L
1346 template<
typename _Integer>
1348 _M_initialize_dispatch(_Integer __n, _Integer __x, __true_type)
1350 _M_initialize(
static_cast<size_type
>(__n));
1351 _M_initialize_value(__x);
1354 template<
typename _InputIterator>
1356 _M_initialize_dispatch(_InputIterator __first, _InputIterator __last,
1358 { _M_initialize_range(__first, __last,
1362 template<
typename _InputIterator>
1363 _GLIBCXX20_CONSTEXPR
1365 _M_initialize_range(_InputIterator __first, _InputIterator __last,
1368 for (; __first != __last; ++__first)
1372 template<
typename _ForwardIterator>
1373 _GLIBCXX20_CONSTEXPR
1375 _M_initialize_range(_ForwardIterator __first, _ForwardIterator __last,
1380 std::copy(__first, __last,
begin());
1383#if __cplusplus < 201103L
1386 template<
typename _Integer>
1388 _M_assign_dispatch(_Integer __n, _Integer __val, __true_type)
1389 { _M_fill_assign(__n, __val); }
1391 template<
class _InputIterator>
1393 _M_assign_dispatch(_InputIterator __first, _InputIterator __last,
1398 _GLIBCXX20_CONSTEXPR
1400 _M_fill_assign(
size_t __n,
bool __x)
1404 _M_initialize_value(__x);
1409 _M_erase_at_end(
begin() + __n);
1410 _M_initialize_value(__x);
1414 template<
typename _InputIterator>
1415 _GLIBCXX20_CONSTEXPR
1417 _M_assign_aux(_InputIterator __first, _InputIterator __last,
1420 iterator __cur =
begin();
1421 for (; __first != __last && __cur !=
end(); ++__cur, (void)++__first)
1423 if (__first == __last)
1424 _M_erase_at_end(__cur);
1429 template<
typename _ForwardIterator>
1430 _GLIBCXX20_CONSTEXPR
1432 _M_assign_aux(_ForwardIterator __first, _ForwardIterator __last,
1437 _M_erase_at_end(std::copy(__first, __last,
begin()));
1440 _ForwardIterator __mid = __first;
1442 std::copy(__first, __mid,
begin());
1447#if __cplusplus < 201103L
1450 template<
typename _Integer>
1452 _M_insert_dispatch(iterator __pos, _Integer __n, _Integer __x,
1454 { _M_fill_insert(__pos, __n, __x); }
1456 template<
typename _InputIterator>
1458 _M_insert_dispatch(iterator __pos,
1459 _InputIterator __first, _InputIterator __last,
1461 { _M_insert_range(__pos, __first, __last,
1465 _GLIBCXX20_CONSTEXPR
1467 _M_fill_insert(iterator __position, size_type __n,
bool __x);
1469 template<
typename _InputIterator>
1470 _GLIBCXX20_CONSTEXPR
1472 _M_insert_range(iterator __pos, _InputIterator __first,
1475 for (; __first != __last; ++__first)
1477 __pos =
insert(__pos, *__first);
1482 template<
typename _ForwardIterator>
1483 _GLIBCXX20_CONSTEXPR
1485 _M_insert_range(iterator __position, _ForwardIterator __first,
1488 _GLIBCXX20_CONSTEXPR
1490 _M_insert_aux(iterator __position,
bool __x);
1492 _GLIBCXX20_CONSTEXPR
1494 _M_check_len(size_type __n,
const char* __s)
const
1497 __throw_length_error(__N(__s));
1503 _GLIBCXX20_CONSTEXPR
1505 _M_erase_at_end(iterator __pos)
1506 { this->_M_impl._M_finish = __pos; }
1508 _GLIBCXX20_CONSTEXPR
1510 _M_erase(iterator __pos);
1512 _GLIBCXX20_CONSTEXPR
1514 _M_erase(iterator __first, iterator __last);
1522#if __cplusplus >= 201103L
1523 void data() =
delete;
1529_GLIBCXX_END_NAMESPACE_CONTAINER
1532 _GLIBCXX20_CONSTEXPR
1534 __fill_bvector(_Bit_type* __v,
unsigned int __first,
unsigned int __last,
1535 bool __x) _GLIBCXX_NOEXCEPT
1537 const _Bit_type __fmask = ~0ul << __first;
1538 const _Bit_type __lmask = ~0ul >> (_S_word_bit - __last);
1539 const _Bit_type __mask = __fmask & __lmask;
1548 __attribute__((__nonnull__))
1549 _GLIBCXX20_CONSTEXPR
1551 __fill_bvector_n(_Bit_type* __p,
size_t __n,
bool __x) _GLIBCXX_NOEXCEPT
1553#if __cpp_lib_is_constant_evaluated
1556 for (
size_t __i = 0; __i < __n; ++__i)
1557 __p[__i] = __x ? ~0ul : 0ul;
1561 __builtin_memset(__p, __x ? ~0 : 0, __n * sizeof(_Bit_type));
1565 _GLIBCXX20_CONSTEXPR
1567 __fill_a1(_GLIBCXX_STD_C::_Bit_iterator __first,
1568 _GLIBCXX_STD_C::_Bit_iterator __last,
const bool& __x)
1570 if (__first._M_p != __last._M_p)
1572 _Bit_type* __first_p = __first._M_p;
1573 if (__first._M_offset != 0)
1574 __fill_bvector(__first_p++, __first._M_offset, _S_word_bit, __x);
1576 __fill_bvector_n(__first_p, __last._M_p - __first_p, __x);
1578 if (__last._M_offset != 0)
1579 __fill_bvector(__last._M_p, 0, __last._M_offset, __x);
1581 else if (__first._M_offset != __last._M_offset)
1582 __fill_bvector(__first._M_p, __first._M_offset, __last._M_offset, __x);
1585#if __cplusplus >= 201103L
1588 template<
typename _Alloc>
1590 :
public __hash_base<size_t, _GLIBCXX_STD_C::vector<bool, _Alloc>>
1593 operator()(
const _GLIBCXX_STD_C::vector<bool, _Alloc>&)
const noexcept;
1597_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 bool is_constant_evaluated() noexcept
Returns true only when called during constant evaluation.
constexpr std::remove_reference< _Tp >::type && move(_Tp &&__t) noexcept
Convert a value to an rvalue.
void swap(any &__x, any &__y) noexcept
Exchange the states of two any objects.
constexpr _Tp * __addressof(_Tp &__r) noexcept
Same as C++11 std::addressof.
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.
typename __detected_or_t< is_empty< _Alloc >, __equal, _Alloc >::type is_always_equal
Whether all instances of the allocator type compare equal.
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.
constexpr iterator insert(const_iterator __position, const value_type &__x)
Inserts given value into vector before specified iterator.
constexpr void push_back(const value_type &__x)
Add data to the end of the vector.
constexpr reverse_iterator rbegin() noexcept
constexpr iterator end() noexcept
vector()=default
Creates a vector with no elements.
constexpr iterator emplace(const_iterator __position, _Args &&... __args)
Inserts an object in vector before specified iterator.
constexpr iterator begin() noexcept
constexpr size_type capacity() const noexcept
constexpr ~vector() noexcept
constexpr void assign(size_type __n, const value_type &__val)
Assigns a given value to a vector.
constexpr _Tp * data() noexcept
constexpr void pop_back() noexcept
Removes last element.
constexpr void reserve(size_type __n)
Attempt to preallocate enough memory for specified number of elements.
constexpr reference at(size_type __n)
Provides access to the data contained in the vector.
constexpr void resize(size_type __new_size)
Resizes the vector to the specified number of elements.
constexpr void _M_range_check(size_type __n) const
Safety check used only from at().
constexpr reference front() noexcept
constexpr iterator erase(const_iterator __position)
Remove element at given position.
constexpr bool empty() const noexcept
constexpr reverse_iterator rend() noexcept
constexpr const_reverse_iterator crbegin() const noexcept
constexpr const_iterator cbegin() const noexcept
constexpr void clear() noexcept
constexpr allocator_type get_allocator() const noexcept
Get a copy of the memory allocation object.
constexpr size_type size() const noexcept
constexpr vector & operator=(const vector &__x)
Vector assignment operator.
constexpr reference back() noexcept
constexpr const_reverse_iterator crend() const noexcept
constexpr const_iterator cend() const noexcept
constexpr reference operator[](size_type __n) noexcept
Subscript access to the data contained in the vector.
constexpr void shrink_to_fit()
constexpr size_type max_size() const noexcept
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.