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
111 operator=(
const _Bit_reference& __x) _GLIBCXX_NOEXCEPT
112 {
return *
this = bool(__x); }
114 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
116 operator==(
const _Bit_reference& __x)
const
117 {
return bool(*
this) == bool(__x); }
119 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
121 operator<(
const _Bit_reference& __x)
const
122 {
return !bool(*
this) && bool(__x); }
126 flip() _GLIBCXX_NOEXCEPT
127 { *_M_p ^= _M_mask; }
129#if __cplusplus >= 201103L
132 swap(_Bit_reference __x, _Bit_reference __y)
noexcept
141 swap(_Bit_reference __x,
bool& __y)
noexcept
150 swap(
bool& __x, _Bit_reference __y)
noexcept
160#pragma GCC diagnostic push
161#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
162 struct _Bit_iterator_base
163 :
public std::iterator<std::random_access_iterator_tag, bool>
166 unsigned int _M_offset;
169 _Bit_iterator_base(_Bit_type * __x,
unsigned int __y)
170 : _M_p(__x), _M_offset(__y) { }
176 if (_M_offset++ ==
int(_S_word_bit) - 1)
187 if (_M_offset-- == 0)
189 _M_offset = int(_S_word_bit) - 1;
196 _M_incr(ptrdiff_t __i)
199 _M_p += __n / int(_S_word_bit);
200 __n = __n % int(_S_word_bit);
203 __n += int(_S_word_bit);
206 _M_offset =
static_cast<unsigned int>(__n);
210 friend _GLIBCXX20_CONSTEXPR
bool
211 operator==(
const _Bit_iterator_base& __x,
const _Bit_iterator_base& __y)
212 {
return __x._M_p == __y._M_p && __x._M_offset == __y._M_offset; }
214#if __cpp_lib_three_way_comparison
216 friend constexpr strong_ordering
217 operator<=>(
const _Bit_iterator_base& __x,
const _Bit_iterator_base& __y)
220 if (
const auto __cmp = __x._M_p <=> __y._M_p; __cmp != 0)
222 return __x._M_offset <=> __y._M_offset;
227 operator<(
const _Bit_iterator_base& __x,
const _Bit_iterator_base& __y)
229 return __x._M_p < __y._M_p
230 || (__x._M_p == __y._M_p && __x._M_offset < __y._M_offset);
235 operator!=(
const _Bit_iterator_base& __x,
const _Bit_iterator_base& __y)
236 {
return !(__x == __y); }
240 operator>(
const _Bit_iterator_base& __x,
const _Bit_iterator_base& __y)
241 {
return __y < __x; }
245 operator<=(
const _Bit_iterator_base& __x,
const _Bit_iterator_base& __y)
246 {
return !(__y < __x); }
250 operator>=(
const _Bit_iterator_base& __x,
const _Bit_iterator_base& __y)
251 {
return !(__x < __y); }
254 friend _GLIBCXX20_CONSTEXPR ptrdiff_t
255 operator-(
const _Bit_iterator_base& __x,
const _Bit_iterator_base& __y)
257 return (
int(_S_word_bit) * (__x._M_p - __y._M_p)
258 + __x._M_offset - __y._M_offset);
261#pragma GCC diagnostic pop
263 struct _Bit_iterator :
public _Bit_iterator_base
265 typedef _Bit_reference reference;
266#if __cplusplus > 201703L
267 typedef void pointer;
269 typedef _Bit_reference* pointer;
271 typedef _Bit_iterator iterator;
274 _Bit_iterator() : _Bit_iterator_base(0, 0) { }
277 _Bit_iterator(_Bit_type * __x,
unsigned int __y)
278 : _Bit_iterator_base(__x, __y) { }
282 _M_const_cast()
const
285 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
288 {
return reference(_M_p, 1UL << _M_offset); }
302 iterator __tmp = *
this;
319 iterator __tmp = *
this;
340 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
343 {
return *(*
this + __i); }
346 friend _GLIBCXX20_CONSTEXPR iterator
349 iterator __tmp = __x;
355 friend _GLIBCXX20_CONSTEXPR iterator
357 {
return __x + __n; }
360 friend _GLIBCXX20_CONSTEXPR iterator
363 iterator __tmp = __x;
369 struct _Bit_const_iterator :
public _Bit_iterator_base
371 typedef bool reference;
372 typedef bool const_reference;
373#if __cplusplus > 201703L
374 typedef void pointer;
376 typedef const bool* pointer;
378 typedef _Bit_const_iterator const_iterator;
381 _Bit_const_iterator() : _Bit_iterator_base(0, 0) { }
384 _Bit_const_iterator(_Bit_type * __x,
unsigned int __y)
385 : _Bit_iterator_base(__x, __y) { }
388 _Bit_const_iterator(
const _Bit_iterator& __x)
389 : _Bit_iterator_base(__x._M_p, __x._M_offset) { }
393 _M_const_cast()
const
394 {
return _Bit_iterator(_M_p, _M_offset); }
396 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
399 {
return _Bit_reference(_M_p, 1UL << _M_offset); }
413 const_iterator __tmp = *
this;
430 const_iterator __tmp = *
this;
451 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
454 {
return *(*
this + __i); }
457 friend _GLIBCXX20_CONSTEXPR const_iterator
460 const_iterator __tmp = __x;
466 friend _GLIBCXX20_CONSTEXPR const_iterator
469 const_iterator __tmp = __x;
475 friend _GLIBCXX20_CONSTEXPR const_iterator
477 {
return __x + __n; }
480 template<
typename _Alloc>
484 rebind<_Bit_type>::other _Bit_alloc_type;
487 typedef typename _Bit_alloc_traits::pointer _Bit_pointer;
489 struct _Bvector_impl_data
491#if !_GLIBCXX_INLINE_VERSION
492 _Bit_iterator _M_start;
499 void operator=(_Bit_iterator __it) { _M_p = __it._M_p; }
502 _Bit_iterator _M_finish;
503 _Bit_pointer _M_end_of_storage;
506 _Bvector_impl_data() _GLIBCXX_NOEXCEPT
507 : _M_start(), _M_finish(), _M_end_of_storage()
510#if __cplusplus >= 201103L
511 _Bvector_impl_data(
const _Bvector_impl_data&) =
default;
514 operator=(
const _Bvector_impl_data&) =
default;
517 _Bvector_impl_data(_Bvector_impl_data&& __x) noexcept
518 : _Bvector_impl_data(__x)
523 _M_move_data(_Bvector_impl_data&& __x)
noexcept
532 _M_reset() _GLIBCXX_NOEXCEPT
533 { *
this = _Bvector_impl_data(); }
537 _M_swap_data(_Bvector_impl_data& __x) _GLIBCXX_NOEXCEPT
546 :
public _Bit_alloc_type,
public _Bvector_impl_data
549 _Bvector_impl() _GLIBCXX_NOEXCEPT_IF(
550 is_nothrow_default_constructible<_Bit_alloc_type>::value)
555 _Bvector_impl(
const _Bit_alloc_type& __a) _GLIBCXX_NOEXCEPT
556 : _Bit_alloc_type(__a)
559#if __cplusplus >= 201103L
563 _Bvector_impl(_Bvector_impl&& __x) noexcept
568 _Bvector_impl(_Bit_alloc_type&& __a, _Bvector_impl&& __x) noexcept
575 _M_end_addr() const _GLIBCXX_NOEXCEPT
577 if (this->_M_end_of_storage)
584 typedef _Alloc allocator_type;
588 _M_get_Bit_allocator() _GLIBCXX_NOEXCEPT
589 {
return this->_M_impl; }
592 const _Bit_alloc_type&
593 _M_get_Bit_allocator() const _GLIBCXX_NOEXCEPT
594 {
return this->_M_impl; }
598 get_allocator() const _GLIBCXX_NOEXCEPT
599 {
return allocator_type(_M_get_Bit_allocator()); }
601#if __cplusplus >= 201103L
602 _Bvector_base() =
default;
608 _Bvector_base(
const allocator_type& __a)
611#if __cplusplus >= 201103L
612 _Bvector_base(_Bvector_base&&) =
default;
615 _Bvector_base(_Bvector_base&& __x,
const allocator_type& __a) noexcept
616 : _M_impl(_Bit_alloc_type(__a),
std::move(__x._M_impl))
622 { this->_M_deallocate(); }
625 _Bvector_impl _M_impl;
629 _M_allocate(
size_t __n)
632#if __cpp_lib_is_constant_evaluated
636 for (
size_t __i = 0; __i < __n; ++__i)
647 if (_M_impl._M_start._M_p)
649 const size_t __n = _M_impl._M_end_addr() - _M_impl._M_start._M_p;
651 _M_impl._M_end_of_storage - __n,
657#if __cplusplus >= 201103L
660 _M_move_data(_Bvector_base&& __x)
noexcept
661 { _M_impl._M_move_data(
std::move(__x._M_impl)); }
667 {
return (__n +
int(_S_word_bit) - 1) / int(_S_word_bit); }
689 template<
typename _Alloc>
690 class vector<bool, _Alloc> :
protected _Bvector_base<_Alloc>
692 typedef _Bvector_base<_Alloc> _Base;
693 typedef typename _Base::_Bit_pointer _Bit_pointer;
696#if __cplusplus >= 201103L
701 typedef bool value_type;
702 typedef size_t size_type;
703 typedef ptrdiff_t difference_type;
704 typedef _Bit_reference reference;
705 typedef bool const_reference;
706 typedef _Bit_reference* pointer;
707 typedef const bool* const_pointer;
708 typedef _Bit_iterator iterator;
709 typedef _Bit_const_iterator const_iterator;
712 typedef _Alloc allocator_type;
717 {
return _Base::get_allocator(); }
720 using _Base::_M_allocate;
721 using _Base::_M_deallocate;
722 using _Base::_S_nword;
723 using _Base::_M_get_Bit_allocator;
726#if __cplusplus >= 201103L
734 vector(
const allocator_type& __a)
737#if __cplusplus >= 201103L
740 vector(size_type __n,
const allocator_type& __a = allocator_type())
745 vector(size_type __n,
const bool& __value,
746 const allocator_type& __a = allocator_type())
749 vector(size_type __n,
const bool& __value =
bool(),
750 const allocator_type& __a = allocator_type())
755 _M_initialize_value(__value);
760 : _Base(_Bit_alloc_traits::_S_select_on_copy(__x._M_get_Bit_allocator()))
762 _M_initialize(__x.
size());
766#if __cplusplus >= 201103L
783 _M_initialize(__x.
size());
791 vector(
vector&& __x,
const __type_identity_t<allocator_type>& __a)
792 noexcept(_Bit_alloc_traits::_S_always_equal())
798 vector(
const vector& __x,
const __type_identity_t<allocator_type>& __a)
801 _M_initialize(__x.
size());
807 const allocator_type& __a = allocator_type())
810 _M_initialize_range(__l.begin(), __l.end(),
815#if __cplusplus >= 201103L
816 template<
typename _InputIterator,
817 typename = std::_RequireInputIter<_InputIterator>>
819 vector(_InputIterator __first, _InputIterator __last,
820 const allocator_type& __a = allocator_type())
823 _M_initialize_range(__first, __last,
827 template<
typename _InputIterator>
828 vector(_InputIterator __first, _InputIterator __last,
829 const allocator_type& __a = allocator_type())
833 typedef typename std::__is_integer<_InputIterator>::__type _Integral;
834 _M_initialize_dispatch(__first, __last, _Integral());
839 ~vector() _GLIBCXX_NOEXCEPT { }
847#if __cplusplus >= 201103L
848 if (_Bit_alloc_traits::_S_propagate_on_copy_assign())
850 if (this->_M_get_Bit_allocator() != __x._M_get_Bit_allocator())
852 this->_M_deallocate();
853 std::__alloc_on_copy(_M_get_Bit_allocator(),
854 __x._M_get_Bit_allocator());
855 _M_initialize(__x.
size());
858 std::__alloc_on_copy(_M_get_Bit_allocator(),
859 __x._M_get_Bit_allocator());
864 this->_M_deallocate();
865 _M_initialize(__x.
size());
867 this->_M_impl._M_finish = _M_copy_aligned(__x.
begin(), __x.
end(),
872#if __cplusplus >= 201103L
877 if (_Bit_alloc_traits::_S_propagate_on_move_assign()
878 || this->_M_get_Bit_allocator() == __x._M_get_Bit_allocator())
880 this->_M_deallocate();
882 std::__alloc_on_move(_M_get_Bit_allocator(),
883 __x._M_get_Bit_allocator());
889 this->_M_deallocate();
890 _M_initialize(__x.
size());
892 this->_M_impl._M_finish = _M_copy_aligned(__x.
begin(), __x.
end(),
903 this->
assign(__l.begin(), __l.end());
914 assign(size_type __n,
const bool& __x)
915 { _M_fill_assign(__n, __x); }
917#if __cplusplus >= 201103L
918 template<
typename _InputIterator,
919 typename = std::_RequireInputIter<_InputIterator>>
922 assign(_InputIterator __first, _InputIterator __last)
925 template<
typename _InputIterator>
927 assign(_InputIterator __first, _InputIterator __last)
930 typedef typename std::__is_integer<_InputIterator>::__type _Integral;
931 _M_assign_dispatch(__first, __last, _Integral());
935#if __cplusplus >= 201103L
942 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
944 begin() _GLIBCXX_NOEXCEPT
945 {
return iterator(this->_M_impl._M_start._M_p, 0); }
947 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
949 begin()
const _GLIBCXX_NOEXCEPT
950 {
return const_iterator(this->_M_impl._M_start._M_p, 0); }
952 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
954 end() _GLIBCXX_NOEXCEPT
955 {
return this->_M_impl._M_finish; }
957 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
959 end()
const _GLIBCXX_NOEXCEPT
960 {
return this->_M_impl._M_finish; }
962 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
964 rbegin() _GLIBCXX_NOEXCEPT
967 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
969 rbegin()
const _GLIBCXX_NOEXCEPT
972 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
974 rend() _GLIBCXX_NOEXCEPT
977 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
979 rend()
const _GLIBCXX_NOEXCEPT
982#if __cplusplus >= 201103L
983 [[__nodiscard__]] _GLIBCXX20_CONSTEXPR
986 {
return const_iterator(this->_M_impl._M_start._M_p, 0); }
988 [[__nodiscard__]] _GLIBCXX20_CONSTEXPR
990 cend()
const noexcept
991 {
return this->_M_impl._M_finish; }
993 [[__nodiscard__]] _GLIBCXX20_CONSTEXPR
998 [[__nodiscard__]] _GLIBCXX20_CONSTEXPR
1000 crend()
const noexcept
1004 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
1006 size()
const _GLIBCXX_NOEXCEPT
1007 {
return size_type(
end() -
begin()); }
1009 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
1013 const size_type __isize =
1014 __gnu_cxx::__numeric_traits<difference_type>::__max
1015 - int(_S_word_bit) + 1;
1016 const size_type __asize
1017 = _Bit_alloc_traits::max_size(_M_get_Bit_allocator());
1018 return (__asize <= __isize /
int(_S_word_bit)
1019 ? __asize *
int(_S_word_bit) : __isize);
1022 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
1025 {
return size_type(const_iterator(this->_M_impl._M_end_addr(), 0)
1028 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
1030 empty()
const _GLIBCXX_NOEXCEPT
1033 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
1036 {
return begin()[__n]; }
1038 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
1041 {
return begin()[__n]; }
1044 _GLIBCXX20_CONSTEXPR
1048 if (__n >= this->
size())
1049 __throw_out_of_range_fmt(__N(
"vector<bool>::_M_range_check: __n "
1050 "(which is %zu) >= this->size() "
1056 _GLIBCXX20_CONSTEXPR
1061 return (*
this)[__n];
1064 _GLIBCXX20_CONSTEXPR
1066 at(size_type __n)
const
1069 return (*
this)[__n];
1072 _GLIBCXX20_CONSTEXPR
1077 __throw_length_error(__N(
"vector::reserve"));
1082 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
1085 {
return *
begin(); }
1087 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
1090 {
return *
begin(); }
1092 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
1095 {
return *(
end() - 1); }
1097 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
1100 {
return *(
end() - 1); }
1102 _GLIBCXX20_CONSTEXPR
1106 if (this->_M_impl._M_finish._M_p != this->_M_impl._M_end_addr())
1107 *this->_M_impl._M_finish++ = __x;
1109 _M_insert_aux(
end(), __x);
1112 _GLIBCXX20_CONSTEXPR
1116#if __cplusplus >= 201103L
1117 __glibcxx_assert(_Bit_alloc_traits::propagate_on_container_swap::value
1118 || _M_get_Bit_allocator() == __x._M_get_Bit_allocator());
1120 this->_M_impl._M_swap_data(__x._M_impl);
1121 _Bit_alloc_traits::_S_on_swap(_M_get_Bit_allocator(),
1122 __x._M_get_Bit_allocator());
1126 _GLIBCXX20_CONSTEXPR
1128 swap(reference __x, reference __y) _GLIBCXX_NOEXCEPT
1135 _GLIBCXX20_CONSTEXPR
1137#if __cplusplus >= 201103L
1138 insert(const_iterator __position,
const bool& __x)
1140 insert(iterator __position,
const bool& __x)
1143 const difference_type __n = __position -
begin();
1144 if (this->_M_impl._M_finish._M_p != this->_M_impl._M_end_addr()
1145 && __position ==
end())
1146 *this->_M_impl._M_finish++ = __x;
1148 _M_insert_aux(__position._M_const_cast(), __x);
1149 return begin() + __n;
1152#if _GLIBCXX_USE_DEPRECATED
1153 _GLIBCXX_DEPRECATED_SUGGEST(
"insert(position, false)")
1155 insert(const_iterator __position)
1156 {
return this->
insert(__position._M_const_cast(),
false); }
1159#if __cplusplus >= 201103L
1160 template<
typename _InputIterator,
1161 typename = std::_RequireInputIter<_InputIterator>>
1162 _GLIBCXX20_CONSTEXPR
1164 insert(const_iterator __position,
1165 _InputIterator __first, _InputIterator __last)
1167 difference_type __offset = __position -
cbegin();
1168 _M_insert_range(__position._M_const_cast(),
1171 return begin() + __offset;
1174 template<
typename _InputIterator>
1176 insert(iterator __position,
1177 _InputIterator __first, _InputIterator __last)
1180 typedef typename std::__is_integer<_InputIterator>::__type _Integral;
1181 _M_insert_dispatch(__position, __first, __last, _Integral());
1185#if __cplusplus >= 201103L
1186 _GLIBCXX20_CONSTEXPR
1188 insert(const_iterator __position, size_type __n,
const bool& __x)
1190 difference_type __offset = __position -
cbegin();
1191 _M_fill_insert(__position._M_const_cast(), __n, __x);
1192 return begin() + __offset;
1196 insert(iterator __position, size_type __n,
const bool& __x)
1197 { _M_fill_insert(__position, __n, __x); }
1200#if __cplusplus >= 201103L
1201 _GLIBCXX20_CONSTEXPR
1204 {
return this->
insert(__p, __l.begin(), __l.end()); }
1207 _GLIBCXX20_CONSTEXPR
1210 { --this->_M_impl._M_finish; }
1212 _GLIBCXX20_CONSTEXPR
1214#if __cplusplus >= 201103L
1215 erase(const_iterator __position)
1217 erase(iterator __position)
1219 {
return _M_erase(__position._M_const_cast()); }
1221 _GLIBCXX20_CONSTEXPR
1223#if __cplusplus >= 201103L
1224 erase(const_iterator __first, const_iterator __last)
1226 erase(iterator __first, iterator __last)
1228 {
return _M_erase(__first._M_const_cast(), __last._M_const_cast()); }
1230 _GLIBCXX20_CONSTEXPR
1232 resize(size_type __new_size,
bool __x =
bool())
1234 if (__new_size <
size())
1235 _M_erase_at_end(
begin() + difference_type(__new_size));
1240#if __cplusplus >= 201103L
1241 _GLIBCXX20_CONSTEXPR
1244 { _M_shrink_to_fit(); }
1247 _GLIBCXX20_CONSTEXPR
1249 flip() _GLIBCXX_NOEXCEPT
1251 _Bit_type *
const __end = this->_M_impl._M_end_addr();
1252 for (_Bit_type * __p = this->_M_impl._M_start._M_p; __p != __end; ++__p)
1256 _GLIBCXX20_CONSTEXPR
1258 clear() _GLIBCXX_NOEXCEPT
1259 { _M_erase_at_end(
begin()); }
1261#if __cplusplus >= 201103L
1262 template<
typename... _Args>
1263#if __cplusplus > 201402L
1264 _GLIBCXX20_CONSTEXPR
1269 emplace_back(_Args&&... __args)
1272#if __cplusplus > 201402L
1277 template<
typename... _Args>
1278 _GLIBCXX20_CONSTEXPR
1280 emplace(const_iterator __pos, _Args&&... __args)
1281 {
return insert(__pos,
bool(__args...)); }
1286 _GLIBCXX20_CONSTEXPR
1288 _M_copy_aligned(const_iterator __first, const_iterator __last,
1291 _Bit_type* __q = std::copy(__first._M_p, __last._M_p, __result._M_p);
1292 return std::copy(const_iterator(__last._M_p, 0), __last,
1296 _GLIBCXX20_CONSTEXPR
1298 _M_initialize(size_type __n)
1302 _Bit_pointer __q = this->_M_allocate(__n);
1303 this->_M_impl._M_end_of_storage = __q + _S_nword(__n);
1305 this->_M_impl._M_start = __start;
1306 this->_M_impl._M_finish = __start + difference_type(__n);
1310 _GLIBCXX20_CONSTEXPR
1312 _M_initialize_value(
bool __x) _GLIBCXX_NOEXCEPT
1314 if (_Bit_type* __p = this->_M_impl._M_start._M_p)
1315 __fill_bvector_n(__p, this->_M_impl._M_end_addr() - __p, __x);
1318 _GLIBCXX20_CONSTEXPR
1320 _M_reallocate(size_type __n);
1322#if __cplusplus >= 201103L
1323 _GLIBCXX20_CONSTEXPR
1328#if __cplusplus < 201103L
1331 template<
typename _Integer>
1333 _M_initialize_dispatch(_Integer __n, _Integer __x, __true_type)
1335 _M_initialize(
static_cast<size_type
>(__n));
1336 _M_initialize_value(__x);
1339 template<
typename _InputIterator>
1341 _M_initialize_dispatch(_InputIterator __first, _InputIterator __last,
1343 { _M_initialize_range(__first, __last,
1347 template<
typename _InputIterator>
1348 _GLIBCXX20_CONSTEXPR
1350 _M_initialize_range(_InputIterator __first, _InputIterator __last,
1353 for (; __first != __last; ++__first)
1357 template<
typename _ForwardIterator>
1358 _GLIBCXX20_CONSTEXPR
1360 _M_initialize_range(_ForwardIterator __first, _ForwardIterator __last,
1365 std::copy(__first, __last,
begin());
1368#if __cplusplus < 201103L
1371 template<
typename _Integer>
1373 _M_assign_dispatch(_Integer __n, _Integer __val, __true_type)
1374 { _M_fill_assign(__n, __val); }
1376 template<
class _InputIterator>
1378 _M_assign_dispatch(_InputIterator __first, _InputIterator __last,
1383 _GLIBCXX20_CONSTEXPR
1385 _M_fill_assign(
size_t __n,
bool __x)
1389 _M_initialize_value(__x);
1394 _M_erase_at_end(
begin() + __n);
1395 _M_initialize_value(__x);
1399 template<
typename _InputIterator>
1400 _GLIBCXX20_CONSTEXPR
1402 _M_assign_aux(_InputIterator __first, _InputIterator __last,
1405 iterator __cur =
begin();
1406 for (; __first != __last && __cur !=
end(); ++__cur, (void)++__first)
1408 if (__first == __last)
1409 _M_erase_at_end(__cur);
1414 template<
typename _ForwardIterator>
1415 _GLIBCXX20_CONSTEXPR
1417 _M_assign_aux(_ForwardIterator __first, _ForwardIterator __last,
1422 _M_erase_at_end(std::copy(__first, __last,
begin()));
1425 _ForwardIterator __mid = __first;
1427 std::copy(__first, __mid,
begin());
1432#if __cplusplus < 201103L
1435 template<
typename _Integer>
1437 _M_insert_dispatch(iterator __pos, _Integer __n, _Integer __x,
1439 { _M_fill_insert(__pos, __n, __x); }
1441 template<
typename _InputIterator>
1443 _M_insert_dispatch(iterator __pos,
1444 _InputIterator __first, _InputIterator __last,
1446 { _M_insert_range(__pos, __first, __last,
1450 _GLIBCXX20_CONSTEXPR
1452 _M_fill_insert(iterator __position, size_type __n,
bool __x);
1454 template<
typename _InputIterator>
1455 _GLIBCXX20_CONSTEXPR
1457 _M_insert_range(iterator __pos, _InputIterator __first,
1460 for (; __first != __last; ++__first)
1462 __pos =
insert(__pos, *__first);
1467 template<
typename _ForwardIterator>
1468 _GLIBCXX20_CONSTEXPR
1470 _M_insert_range(iterator __position, _ForwardIterator __first,
1473 _GLIBCXX20_CONSTEXPR
1475 _M_insert_aux(iterator __position,
bool __x);
1477 _GLIBCXX20_CONSTEXPR
1479 _M_check_len(size_type __n,
const char* __s)
const
1482 __throw_length_error(__N(__s));
1488 _GLIBCXX20_CONSTEXPR
1490 _M_erase_at_end(iterator __pos)
1491 { this->_M_impl._M_finish = __pos; }
1493 _GLIBCXX20_CONSTEXPR
1495 _M_erase(iterator __pos);
1497 _GLIBCXX20_CONSTEXPR
1499 _M_erase(iterator __first, iterator __last);
1507#if __cplusplus >= 201103L
1508 void data() =
delete;
1514_GLIBCXX_END_NAMESPACE_CONTAINER
1517 _GLIBCXX20_CONSTEXPR
1519 __fill_bvector(_Bit_type* __v,
unsigned int __first,
unsigned int __last,
1520 bool __x) _GLIBCXX_NOEXCEPT
1522 const _Bit_type __fmask = ~0ul << __first;
1523 const _Bit_type __lmask = ~0ul >> (_S_word_bit - __last);
1524 const _Bit_type __mask = __fmask & __lmask;
1533 __attribute__((__nonnull__))
1534 _GLIBCXX20_CONSTEXPR
1536 __fill_bvector_n(_Bit_type* __p,
size_t __n,
bool __x) _GLIBCXX_NOEXCEPT
1538#if __cpp_lib_is_constant_evaluated
1541 for (
size_t __i = 0; __i < __n; ++__i)
1542 __p[__i] = __x ? ~0ul : 0ul;
1546 __builtin_memset(__p, __x ? ~0 : 0, __n * sizeof(_Bit_type));
1550 _GLIBCXX20_CONSTEXPR
1552 __fill_a1(_GLIBCXX_STD_C::_Bit_iterator __first,
1553 _GLIBCXX_STD_C::_Bit_iterator __last,
const bool& __x)
1555 if (__first._M_p != __last._M_p)
1557 _Bit_type* __first_p = __first._M_p;
1558 if (__first._M_offset != 0)
1559 __fill_bvector(__first_p++, __first._M_offset, _S_word_bit, __x);
1561 __fill_bvector_n(__first_p, __last._M_p - __first_p, __x);
1563 if (__last._M_offset != 0)
1564 __fill_bvector(__last._M_p, 0, __last._M_offset, __x);
1566 else if (__first._M_offset != __last._M_offset)
1567 __fill_bvector(__first._M_p, __first._M_offset, __last._M_offset, __x);
1570#if __cplusplus >= 201103L
1573 template<
typename _Alloc>
1575 :
public __hash_base<size_t, _GLIBCXX_STD_C::vector<bool, _Alloc>>
1578 operator()(
const _GLIBCXX_STD_C::vector<bool, _Alloc>&)
const noexcept;
1582_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.
__detected_or_t< typename is_empty< _Alloc >::type, __equal, _Alloc > 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 void swap(vector &__x) noexcept
Swaps data with another 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.