57#define _STL_BVECTOR_H 1
59#ifndef _GLIBCXX_ALWAYS_INLINE
60#define _GLIBCXX_ALWAYS_INLINE inline __attribute__((__always_inline__))
63#if __cplusplus >= 201103L
68namespace std _GLIBCXX_VISIBILITY(default)
70_GLIBCXX_BEGIN_NAMESPACE_VERSION
72 typedef unsigned long _Bit_type;
73 enum { _S_word_bit = int(__CHAR_BIT__ *
sizeof(_Bit_type)) };
75 __attribute__((__nonnull__))
78 __fill_bvector_n(_Bit_type*,
size_t,
bool) _GLIBCXX_NOEXCEPT;
80_GLIBCXX_BEGIN_NAMESPACE_CONTAINER
88 _Bit_reference(_Bit_type * __x, _Bit_type __y)
89 : _M_p(__x), _M_mask(__y) { }
92 _Bit_reference() _GLIBCXX_NOEXCEPT : _M_p(0), _M_mask(0) { }
94#if __cplusplus >= 201103L
95 _Bit_reference(
const _Bit_reference&) =
default;
98 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
99 operator bool() const _GLIBCXX_NOEXCEPT
100 {
return !!(*_M_p & _M_mask); }
104 operator=(
bool __x) _GLIBCXX_NOEXCEPT
113#if __cplusplus > 202002L
114 constexpr const _Bit_reference&
115 operator=(
bool __x)
const noexcept
127 operator=(
const _Bit_reference& __x) _GLIBCXX_NOEXCEPT
128 {
return *
this = bool(__x); }
130 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
132 operator==(
const _Bit_reference& __x)
const
133 {
return bool(*
this) == bool(__x); }
135 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
137 operator<(
const _Bit_reference& __x)
const
138 {
return !bool(*
this) && bool(__x); }
142 flip() _GLIBCXX_NOEXCEPT
143 { *_M_p ^= _M_mask; }
145#if __cplusplus >= 201103L
148 swap(_Bit_reference __x, _Bit_reference __y)
noexcept
157 swap(_Bit_reference __x,
bool& __y)
noexcept
166 swap(
bool& __x, _Bit_reference __y)
noexcept
176#pragma GCC diagnostic push
177#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
178 struct _Bit_iterator_base
179 :
public std::iterator<std::random_access_iterator_tag, bool>
182 unsigned int _M_offset;
184 _GLIBCXX20_CONSTEXPR _GLIBCXX_ALWAYS_INLINE
186 _M_assume_normalized()
const
188#if __has_attribute(__assume__) && !defined(__clang__)
189 unsigned int __ofst = _M_offset;
190 __attribute__ ((__assume__ (__ofst <
unsigned(_S_word_bit))));
195 _Bit_iterator_base(_Bit_type * __x,
unsigned int __y)
196 : _M_p(__x), _M_offset(__y) { }
202 _M_assume_normalized();
203 if (_M_offset++ ==
int(_S_word_bit) - 1)
214 _M_assume_normalized();
215 if (_M_offset-- == 0)
217 _M_offset = int(_S_word_bit) - 1;
224 _M_incr(ptrdiff_t __i)
226 _M_assume_normalized();
228 _M_p += __n / int(_S_word_bit);
229 __n = __n % int(_S_word_bit);
232 __n += int(_S_word_bit);
235 _M_offset =
static_cast<unsigned int>(__n);
239 friend _GLIBCXX20_CONSTEXPR
bool
240 operator==(
const _Bit_iterator_base& __x,
const _Bit_iterator_base& __y)
242 __x._M_assume_normalized();
243 __y._M_assume_normalized();
244 return __x._M_p == __y._M_p && __x._M_offset == __y._M_offset;
247#if __cpp_lib_three_way_comparison
249 friend constexpr strong_ordering
250 operator<=>(
const _Bit_iterator_base& __x,
const _Bit_iterator_base& __y)
253 __x._M_assume_normalized();
254 __y._M_assume_normalized();
255 if (
const auto __cmp = __x._M_p <=> __y._M_p; __cmp != 0)
257 return __x._M_offset <=> __y._M_offset;
262 operator<(
const _Bit_iterator_base& __x,
const _Bit_iterator_base& __y)
264 __x._M_assume_normalized();
265 __y._M_assume_normalized();
266 return __x._M_p < __y._M_p
267 || (__x._M_p == __y._M_p && __x._M_offset < __y._M_offset);
272 operator!=(
const _Bit_iterator_base& __x,
const _Bit_iterator_base& __y)
273 {
return !(__x == __y); }
277 operator>(
const _Bit_iterator_base& __x,
const _Bit_iterator_base& __y)
278 {
return __y < __x; }
282 operator<=(
const _Bit_iterator_base& __x,
const _Bit_iterator_base& __y)
283 {
return !(__y < __x); }
287 operator>=(
const _Bit_iterator_base& __x,
const _Bit_iterator_base& __y)
288 {
return !(__x < __y); }
291 friend _GLIBCXX20_CONSTEXPR ptrdiff_t
292 operator-(
const _Bit_iterator_base& __x,
const _Bit_iterator_base& __y)
294 __x._M_assume_normalized();
295 __y._M_assume_normalized();
296 return (
int(_S_word_bit) * (__x._M_p - __y._M_p)
297 + __x._M_offset - __y._M_offset);
300#pragma GCC diagnostic pop
302 struct _Bit_iterator :
public _Bit_iterator_base
304 typedef _Bit_reference reference;
305#if __cplusplus > 201703L
306 typedef void pointer;
308 typedef _Bit_reference* pointer;
310 typedef _Bit_iterator iterator;
313 _Bit_iterator() : _Bit_iterator_base(0, 0) { }
316 _Bit_iterator(_Bit_type * __x,
unsigned int __y)
317 : _Bit_iterator_base(__x, __y) { }
321 _M_const_cast()
const
324 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
328 _M_assume_normalized();
329 return reference(_M_p, 1UL << _M_offset);
344 iterator __tmp = *
this;
361 iterator __tmp = *
this;
382 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
385 {
return *(*
this + __i); }
388 friend _GLIBCXX20_CONSTEXPR iterator
391 iterator __tmp = __x;
397 friend _GLIBCXX20_CONSTEXPR iterator
399 {
return __x + __n; }
402 friend _GLIBCXX20_CONSTEXPR iterator
405 iterator __tmp = __x;
411 struct _Bit_const_iterator :
public _Bit_iterator_base
413 typedef bool reference;
414 typedef bool const_reference;
415#if __cplusplus > 201703L
416 typedef void pointer;
418 typedef const bool* pointer;
420 typedef _Bit_const_iterator const_iterator;
423 _Bit_const_iterator() : _Bit_iterator_base(0, 0) { }
426 _Bit_const_iterator(_Bit_type * __x,
unsigned int __y)
427 : _Bit_iterator_base(__x, __y) { }
430 _Bit_const_iterator(
const _Bit_iterator& __x)
431 : _Bit_iterator_base(__x._M_p, __x._M_offset) { }
435 _M_const_cast()
const
436 {
return _Bit_iterator(_M_p, _M_offset); }
438 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
442 _M_assume_normalized();
443 return _Bit_reference(_M_p, 1UL << _M_offset);
458 const_iterator __tmp = *
this;
475 const_iterator __tmp = *
this;
496 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
499 {
return *(*
this + __i); }
502 friend _GLIBCXX20_CONSTEXPR const_iterator
505 const_iterator __tmp = __x;
511 friend _GLIBCXX20_CONSTEXPR const_iterator
514 const_iterator __tmp = __x;
520 friend _GLIBCXX20_CONSTEXPR const_iterator
522 {
return __x + __n; }
525 template<
typename _Alloc>
529 rebind<_Bit_type>::other _Bit_alloc_type;
532 typedef typename _Bit_alloc_traits::pointer _Bit_pointer;
534 struct _Bvector_impl_data
536#if !_GLIBCXX_INLINE_VERSION
537 _Bit_iterator _M_start;
544 void operator=(_Bit_iterator __it) { _M_p = __it._M_p; }
547 _Bit_iterator _M_finish;
548 _Bit_pointer _M_end_of_storage;
551 _Bvector_impl_data() _GLIBCXX_NOEXCEPT
552 : _M_start(), _M_finish(), _M_end_of_storage()
555#if __cplusplus >= 201103L
556 _Bvector_impl_data(
const _Bvector_impl_data&) =
default;
559 operator=(
const _Bvector_impl_data&) =
default;
562 _Bvector_impl_data(_Bvector_impl_data&& __x) noexcept
563 : _Bvector_impl_data(__x)
568 _M_move_data(_Bvector_impl_data&& __x)
noexcept
577 _M_reset() _GLIBCXX_NOEXCEPT
578 { *
this = _Bvector_impl_data(); }
582 _M_swap_data(_Bvector_impl_data& __x) _GLIBCXX_NOEXCEPT
586 std::swap(*
this, __x);
591 :
public _Bit_alloc_type,
public _Bvector_impl_data
594 _Bvector_impl() _GLIBCXX_NOEXCEPT_IF(
595 is_nothrow_default_constructible<_Bit_alloc_type>::value)
600 _Bvector_impl(
const _Bit_alloc_type& __a) _GLIBCXX_NOEXCEPT
601 : _Bit_alloc_type(__a)
604#if __cplusplus >= 201103L
608 _Bvector_impl(_Bvector_impl&& __x) noexcept
613 _Bvector_impl(_Bit_alloc_type&& __a, _Bvector_impl&& __x) noexcept
620 _M_end_addr() const _GLIBCXX_NOEXCEPT
622 if (this->_M_end_of_storage)
629 typedef _Alloc allocator_type;
633 _M_get_Bit_allocator() _GLIBCXX_NOEXCEPT
634 {
return this->_M_impl; }
637 const _Bit_alloc_type&
638 _M_get_Bit_allocator() const _GLIBCXX_NOEXCEPT
639 {
return this->_M_impl; }
643 get_allocator() const _GLIBCXX_NOEXCEPT
644 {
return allocator_type(_M_get_Bit_allocator()); }
646#if __cplusplus >= 201103L
647 _Bvector_base() =
default;
653 _Bvector_base(
const allocator_type& __a)
656#if __cplusplus >= 201103L
657 _Bvector_base(_Bvector_base&&) =
default;
660 _Bvector_base(_Bvector_base&& __x,
const allocator_type& __a) noexcept
661 : _M_impl(_Bit_alloc_type(__a),
std::move(__x._M_impl))
667 { this->_M_deallocate(); }
670 _Bvector_impl _M_impl;
674 _M_allocate(
size_t __n)
677#if __cpp_lib_is_constant_evaluated
678 if (std::is_constant_evaluated())
681 for (
size_t __i = 0; __i < __n; ++__i)
692 if (_M_impl._M_start._M_p)
694 const size_t __n = _M_impl._M_end_addr() - _M_impl._M_start._M_p;
696 _M_impl._M_end_of_storage - __n,
702#if __cplusplus >= 201103L
705 _M_move_data(_Bvector_base&& __x)
noexcept
706 { _M_impl._M_move_data(
std::move(__x._M_impl)); }
712 {
return (__n +
int(_S_word_bit) - 1) / int(_S_word_bit); }
736 template<
typename _Alloc>
737 class vector<bool, _Alloc> :
protected _Bvector_base<_Alloc>
739 typedef _Bvector_base<_Alloc> _Base;
740 typedef typename _Base::_Bit_pointer _Bit_pointer;
743#if __cplusplus >= 201103L
748 typedef bool value_type;
749 typedef size_t size_type;
750 typedef ptrdiff_t difference_type;
751 typedef _Bit_reference reference;
752 typedef bool const_reference;
753 typedef _Bit_reference* pointer;
754 typedef const bool* const_pointer;
755 typedef _Bit_iterator iterator;
756 typedef _Bit_const_iterator const_iterator;
759 typedef _Alloc allocator_type;
764 {
return _Base::get_allocator(); }
767 using _Base::_M_allocate;
768 using _Base::_M_deallocate;
769 using _Base::_S_nword;
770 using _Base::_M_get_Bit_allocator;
773#if __cplusplus >= 201103L
781 vector(
const allocator_type& __a)
784#if __cplusplus >= 201103L
787 vector(size_type __n,
const allocator_type& __a = allocator_type())
792 vector(size_type __n,
const bool& __value,
793 const allocator_type& __a = allocator_type())
796 vector(size_type __n,
const bool& __value =
bool(),
797 const allocator_type& __a = allocator_type())
802 _M_initialize_value(__value);
807 : _Base(_Bit_alloc_traits::_S_select_on_copy(__x._M_get_Bit_allocator()))
809 const_iterator __xbegin = __x.
begin(), __xend = __x.
end();
810 _M_initialize(__x.
size());
811 _M_copy_aligned(__xbegin, __xend,
begin());
814#if __cplusplus >= 201103L
831 _M_initialize(__x.
size());
839 vector(
vector&& __x,
const __type_identity_t<allocator_type>& __a)
840 noexcept(_Bit_alloc_traits::_S_always_equal())
846 vector(
const vector& __x,
const __type_identity_t<allocator_type>& __a)
849 _M_initialize(__x.
size());
855 const allocator_type& __a = allocator_type())
858 _M_initialize_range(__l.begin(), __l.end(),
863#if __cplusplus >= 201103L
864 template<
typename _InputIterator,
865 typename = std::_RequireInputIter<_InputIterator>>
867 vector(_InputIterator __first, _InputIterator __last,
868 const allocator_type& __a = allocator_type())
871 _M_initialize_range(__first, __last,
875 template<
typename _InputIterator>
876 vector(_InputIterator __first, _InputIterator __last,
877 const allocator_type& __a = allocator_type())
881 typedef typename std::__is_integer<_InputIterator>::__type _Integral;
882 _M_initialize_dispatch(__first, __last, _Integral());
887 ~vector() _GLIBCXX_NOEXCEPT { }
895#if __cplusplus >= 201103L
896 if (_Bit_alloc_traits::_S_propagate_on_copy_assign())
898 if (this->_M_get_Bit_allocator() != __x._M_get_Bit_allocator())
900 this->_M_deallocate();
901 std::__alloc_on_copy(_M_get_Bit_allocator(),
902 __x._M_get_Bit_allocator());
903 _M_initialize(__x.
size());
906 std::__alloc_on_copy(_M_get_Bit_allocator(),
907 __x._M_get_Bit_allocator());
912 this->_M_deallocate();
913 _M_initialize(__x.
size());
915 this->_M_impl._M_finish = _M_copy_aligned(__x.
begin(), __x.
end(),
920#if __cplusplus >= 201103L
925 if (_Bit_alloc_traits::_S_propagate_on_move_assign()
926 || this->_M_get_Bit_allocator() == __x._M_get_Bit_allocator())
928 this->_M_deallocate();
930 std::__alloc_on_move(_M_get_Bit_allocator(),
931 __x._M_get_Bit_allocator());
937 this->_M_deallocate();
938 _M_initialize(__x.
size());
940 this->_M_impl._M_finish = _M_copy_aligned(__x.
begin(), __x.
end(),
951 this->
assign(__l.begin(), __l.end());
962 assign(size_type __n,
const bool& __x)
963 { _M_fill_assign(__n, __x); }
965#if __cplusplus >= 201103L
966 template<
typename _InputIterator,
967 typename = std::_RequireInputIter<_InputIterator>>
970 assign(_InputIterator __first, _InputIterator __last)
973 template<
typename _InputIterator>
975 assign(_InputIterator __first, _InputIterator __last)
978 typedef typename std::__is_integer<_InputIterator>::__type _Integral;
979 _M_assign_dispatch(__first, __last, _Integral());
983#if __cplusplus >= 201103L
990 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
992 begin() _GLIBCXX_NOEXCEPT
993 {
return iterator(this->_M_impl._M_start._M_p, 0); }
995 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
997 begin()
const _GLIBCXX_NOEXCEPT
998 {
return const_iterator(this->_M_impl._M_start._M_p, 0); }
1000 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
1002 end() _GLIBCXX_NOEXCEPT
1003 {
return this->_M_impl._M_finish; }
1005 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
1007 end()
const _GLIBCXX_NOEXCEPT
1008 {
return this->_M_impl._M_finish; }
1010 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
1012 rbegin() _GLIBCXX_NOEXCEPT
1015 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
1017 rbegin()
const _GLIBCXX_NOEXCEPT
1020 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
1022 rend() _GLIBCXX_NOEXCEPT
1025 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
1027 rend()
const _GLIBCXX_NOEXCEPT
1030#if __cplusplus >= 201103L
1031 [[__nodiscard__]] _GLIBCXX20_CONSTEXPR
1034 {
return const_iterator(this->_M_impl._M_start._M_p, 0); }
1036 [[__nodiscard__]] _GLIBCXX20_CONSTEXPR
1038 cend()
const noexcept
1039 {
return this->_M_impl._M_finish; }
1041 [[__nodiscard__]] _GLIBCXX20_CONSTEXPR
1046 [[__nodiscard__]] _GLIBCXX20_CONSTEXPR
1048 crend()
const noexcept
1052 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
1054 size()
const _GLIBCXX_NOEXCEPT
1055 {
return size_type(
end() -
begin()); }
1057 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
1061 const size_type __isize =
1062 __gnu_cxx::__numeric_traits<difference_type>::__max
1063 - int(_S_word_bit) + 1;
1064 const size_type __asize
1065 = _Bit_alloc_traits::max_size(_M_get_Bit_allocator());
1066 return (__asize <= __isize /
int(_S_word_bit)
1067 ? __asize *
int(_S_word_bit) : __isize);
1070 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
1073 {
return size_type(const_iterator(this->_M_impl._M_end_addr(), 0)
1076 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
1078 empty()
const _GLIBCXX_NOEXCEPT
1081 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
1084 {
return begin()[__n]; }
1086 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
1089 {
return begin()[__n]; }
1092 _GLIBCXX20_CONSTEXPR
1096 if (__n >= this->
size())
1097 __throw_out_of_range_fmt(__N(
"vector<bool>::_M_range_check: __n "
1098 "(which is %zu) >= this->size() "
1104 _GLIBCXX20_CONSTEXPR
1109 return (*
this)[__n];
1112 _GLIBCXX20_CONSTEXPR
1114 at(size_type __n)
const
1117 return (*
this)[__n];
1120 _GLIBCXX20_CONSTEXPR
1125 __throw_length_error(__N(
"vector::reserve"));
1130 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
1133 {
return *
begin(); }
1135 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
1138 {
return *
begin(); }
1140 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
1143 {
return *(
end() - 1); }
1145 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
1148 {
return *(
end() - 1); }
1150 _GLIBCXX20_CONSTEXPR
1154 if (this->_M_impl._M_finish._M_p != this->_M_impl._M_end_addr())
1155 *this->_M_impl._M_finish++ = __x;
1157 _M_insert_aux(
end(), __x);
1160 _GLIBCXX20_CONSTEXPR
1162 swap(
vector& __x) _GLIBCXX_NOEXCEPT
1164#if __cplusplus >= 201103L
1165 __glibcxx_assert(_Bit_alloc_traits::propagate_on_container_swap::value
1166 || _M_get_Bit_allocator() == __x._M_get_Bit_allocator());
1168 this->_M_impl._M_swap_data(__x._M_impl);
1169 _Bit_alloc_traits::_S_on_swap(_M_get_Bit_allocator(),
1170 __x._M_get_Bit_allocator());
1174 _GLIBCXX20_CONSTEXPR
1176 swap(reference __x, reference __y) _GLIBCXX_NOEXCEPT
1183 _GLIBCXX20_CONSTEXPR
1185#if __cplusplus >= 201103L
1186 insert(const_iterator __position,
const bool& __x)
1188 insert(iterator __position,
const bool& __x)
1191 const difference_type __n = __position -
begin();
1192 if (this->_M_impl._M_finish._M_p != this->_M_impl._M_end_addr()
1193 && __position ==
end())
1194 *this->_M_impl._M_finish++ = __x;
1196 _M_insert_aux(__position._M_const_cast(), __x);
1197 return begin() + __n;
1200#if _GLIBCXX_USE_DEPRECATED
1201 _GLIBCXX_DEPRECATED_SUGGEST(
"insert(position, false)")
1203 insert(const_iterator __position)
1204 {
return this->
insert(__position._M_const_cast(),
false); }
1207#if __cplusplus >= 201103L
1208 template<
typename _InputIterator,
1209 typename = std::_RequireInputIter<_InputIterator>>
1210 _GLIBCXX20_CONSTEXPR
1212 insert(const_iterator __position,
1213 _InputIterator __first, _InputIterator __last)
1215 difference_type __offset = __position -
cbegin();
1216 _M_insert_range(__position._M_const_cast(),
1219 return begin() + __offset;
1222 template<
typename _InputIterator>
1224 insert(iterator __position,
1225 _InputIterator __first, _InputIterator __last)
1228 typedef typename std::__is_integer<_InputIterator>::__type _Integral;
1229 _M_insert_dispatch(__position, __first, __last, _Integral());
1233#if __cplusplus >= 201103L
1234 _GLIBCXX20_CONSTEXPR
1236 insert(const_iterator __position, size_type __n,
const bool& __x)
1238 difference_type __offset = __position -
cbegin();
1239 _M_fill_insert(__position._M_const_cast(), __n, __x);
1240 return begin() + __offset;
1244 insert(iterator __position, size_type __n,
const bool& __x)
1245 { _M_fill_insert(__position, __n, __x); }
1248#if __cplusplus >= 201103L
1249 _GLIBCXX20_CONSTEXPR
1252 {
return this->
insert(__p, __l.begin(), __l.end()); }
1255 _GLIBCXX20_CONSTEXPR
1258 { --this->_M_impl._M_finish; }
1260 _GLIBCXX20_CONSTEXPR
1262#if __cplusplus >= 201103L
1263 erase(const_iterator __position)
1265 erase(iterator __position)
1267 {
return _M_erase(__position._M_const_cast()); }
1269 _GLIBCXX20_CONSTEXPR
1271#if __cplusplus >= 201103L
1272 erase(const_iterator __first, const_iterator __last)
1274 erase(iterator __first, iterator __last)
1276 {
return _M_erase(__first._M_const_cast(), __last._M_const_cast()); }
1278 _GLIBCXX20_CONSTEXPR
1280 resize(size_type __new_size,
bool __x =
bool())
1282 if (__new_size <
size())
1283 _M_erase_at_end(
begin() + difference_type(__new_size));
1288#if __cplusplus >= 201103L
1289 _GLIBCXX20_CONSTEXPR
1292 { _M_shrink_to_fit(); }
1295 _GLIBCXX20_CONSTEXPR
1297 flip() _GLIBCXX_NOEXCEPT
1299 _Bit_type *
const __end = this->_M_impl._M_end_addr();
1300 for (_Bit_type * __p = this->_M_impl._M_start._M_p; __p != __end; ++__p)
1304 _GLIBCXX20_CONSTEXPR
1306 clear() _GLIBCXX_NOEXCEPT
1307 { _M_erase_at_end(
begin()); }
1309#if __cplusplus >= 201103L
1310 template<
typename... _Args>
1311#if __cplusplus > 201402L
1312 _GLIBCXX20_CONSTEXPR
1317 emplace_back(_Args&&... __args)
1320#if __cplusplus > 201402L
1325 template<
typename... _Args>
1326 _GLIBCXX20_CONSTEXPR
1328 emplace(const_iterator __pos, _Args&&... __args)
1329 {
return insert(__pos,
bool(__args...)); }
1334 _GLIBCXX20_CONSTEXPR
1336 _M_copy_aligned(const_iterator __first, const_iterator __last,
1339 _Bit_type* __q = std::copy(__first._M_p, __last._M_p, __result._M_p);
1340 return std::copy(const_iterator(__last._M_p, 0), __last,
1344 _GLIBCXX20_CONSTEXPR
1346 _M_initialize(size_type __n)
1350 _Bit_pointer __q = this->_M_allocate(__n);
1351 this->_M_impl._M_end_of_storage = __q + _S_nword(__n);
1353 this->_M_impl._M_start = __start;
1354 this->_M_impl._M_finish = __start + difference_type(__n);
1358 _GLIBCXX20_CONSTEXPR
1360 _M_initialize_value(
bool __x) _GLIBCXX_NOEXCEPT
1362 if (_Bit_type* __p = this->_M_impl._M_start._M_p)
1363 __fill_bvector_n(__p, this->_M_impl._M_end_addr() - __p, __x);
1366 _GLIBCXX20_CONSTEXPR
1368 _M_reallocate(size_type __n);
1370#if __cplusplus >= 201103L
1371 _GLIBCXX20_CONSTEXPR
1376#if __cplusplus < 201103L
1379 template<
typename _Integer>
1381 _M_initialize_dispatch(_Integer __n, _Integer __x, __true_type)
1383 _M_initialize(
static_cast<size_type
>(__n));
1384 _M_initialize_value(__x);
1387 template<
typename _InputIterator>
1389 _M_initialize_dispatch(_InputIterator __first, _InputIterator __last,
1391 { _M_initialize_range(__first, __last,
1395 template<
typename _InputIterator>
1396 _GLIBCXX20_CONSTEXPR
1398 _M_initialize_range(_InputIterator __first, _InputIterator __last,
1401 for (; __first != __last; ++__first)
1405 template<
typename _ForwardIterator>
1406 _GLIBCXX20_CONSTEXPR
1408 _M_initialize_range(_ForwardIterator __first, _ForwardIterator __last,
1413 std::copy(__first, __last,
begin());
1416#if __cplusplus < 201103L
1419 template<
typename _Integer>
1421 _M_assign_dispatch(_Integer __n, _Integer __val, __true_type)
1422 { _M_fill_assign(__n, __val); }
1424 template<
class _InputIterator>
1426 _M_assign_dispatch(_InputIterator __first, _InputIterator __last,
1431 _GLIBCXX20_CONSTEXPR
1433 _M_fill_assign(
size_t __n,
bool __x)
1437 _M_initialize_value(__x);
1442 _M_erase_at_end(
begin() + __n);
1443 _M_initialize_value(__x);
1447 template<
typename _InputIterator>
1448 _GLIBCXX20_CONSTEXPR
1450 _M_assign_aux(_InputIterator __first, _InputIterator __last,
1453 iterator __cur =
begin();
1454 for (; __first != __last && __cur !=
end(); ++__cur, (void)++__first)
1456 if (__first == __last)
1457 _M_erase_at_end(__cur);
1462 template<
typename _ForwardIterator>
1463 _GLIBCXX20_CONSTEXPR
1465 _M_assign_aux(_ForwardIterator __first, _ForwardIterator __last,
1470 _M_erase_at_end(std::copy(__first, __last,
begin()));
1473 _ForwardIterator __mid = __first;
1475 std::copy(__first, __mid,
begin());
1480#if __cplusplus < 201103L
1483 template<
typename _Integer>
1485 _M_insert_dispatch(iterator __pos, _Integer __n, _Integer __x,
1487 { _M_fill_insert(__pos, __n, __x); }
1489 template<
typename _InputIterator>
1491 _M_insert_dispatch(iterator __pos,
1492 _InputIterator __first, _InputIterator __last,
1494 { _M_insert_range(__pos, __first, __last,
1498 _GLIBCXX20_CONSTEXPR
1500 _M_fill_insert(iterator __position, size_type __n,
bool __x);
1502 template<
typename _InputIterator>
1503 _GLIBCXX20_CONSTEXPR
1505 _M_insert_range(iterator __pos, _InputIterator __first,
1508 for (; __first != __last; ++__first)
1510 __pos =
insert(__pos, *__first);
1515 template<
typename _ForwardIterator>
1516 _GLIBCXX20_CONSTEXPR
1518 _M_insert_range(iterator __position, _ForwardIterator __first,
1521 _GLIBCXX20_CONSTEXPR
1523 _M_insert_aux(iterator __position,
bool __x);
1525 _GLIBCXX20_CONSTEXPR
1527 _M_check_len(size_type __n,
const char* __s)
const
1530 __throw_length_error(__N(__s));
1536 _GLIBCXX20_CONSTEXPR
1538 _M_erase_at_end(iterator __pos)
1539 { this->_M_impl._M_finish = __pos; }
1541 _GLIBCXX20_CONSTEXPR
1543 _M_erase(iterator __pos);
1545 _GLIBCXX20_CONSTEXPR
1547 _M_erase(iterator __first, iterator __last);
1555#if __cplusplus >= 201103L
1556 void data() =
delete;
1562_GLIBCXX_END_NAMESPACE_CONTAINER
1565 _GLIBCXX20_CONSTEXPR
1567 __fill_bvector(_Bit_type* __v,
unsigned int __first,
unsigned int __last,
1568 bool __x) _GLIBCXX_NOEXCEPT
1570 const _Bit_type __fmask = ~0ul << __first;
1571 const _Bit_type __lmask = ~0ul >> (_S_word_bit - __last);
1572 const _Bit_type __mask = __fmask & __lmask;
1581 __attribute__((__nonnull__))
1582 _GLIBCXX20_CONSTEXPR
1584 __fill_bvector_n(_Bit_type* __p,
size_t __n,
bool __x) _GLIBCXX_NOEXCEPT
1586#if __cpp_lib_is_constant_evaluated
1587 if (std::is_constant_evaluated())
1589 for (
size_t __i = 0; __i < __n; ++__i)
1590 __p[__i] = __x ? ~0ul : 0ul;
1594 __builtin_memset(__p, __x ? ~0 : 0, __n * sizeof(_Bit_type));
1598 _GLIBCXX20_CONSTEXPR
1600 __fill_a1(_GLIBCXX_STD_C::_Bit_iterator __first,
1601 _GLIBCXX_STD_C::_Bit_iterator __last,
const bool& __x)
1603 if (__first._M_p != __last._M_p)
1605 _Bit_type* __first_p = __first._M_p;
1606 if (__first._M_offset != 0)
1607 __fill_bvector(__first_p++, __first._M_offset, _S_word_bit, __x);
1609 __fill_bvector_n(__first_p, __last._M_p - __first_p, __x);
1611 if (__last._M_offset != 0)
1612 __fill_bvector(__last._M_p, 0, __last._M_offset, __x);
1614 else if (__first._M_offset != __last._M_offset)
1615 __fill_bvector(__first._M_p, __first._M_offset, __last._M_offset, __x);
1618#if __cplusplus >= 201103L
1621 template<
typename _Alloc>
1623 :
public __hash_base<size_t, _GLIBCXX_STD_C::vector<bool, _Alloc>>
1626 operator()(
const _GLIBCXX_STD_C::vector<bool, _Alloc>&)
const noexcept;
1630_GLIBCXX_END_NAMESPACE_VERSION
constexpr bool operator<=(const duration< _Rep1, _Period1 > &__lhs, const duration< _Rep2, _Period2 > &__rhs)
constexpr bool operator>=(const duration< _Rep1, _Period1 > &__lhs, const duration< _Rep2, _Period2 > &__rhs)
constexpr bool operator<(const duration< _Rep1, _Period1 > &__lhs, const duration< _Rep2, _Period2 > &__rhs)
constexpr bool operator>(const duration< _Rep1, _Period1 > &__lhs, const duration< _Rep2, _Period2 > &__rhs)
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.
__bool_constant< true > true_type
The type used as a compile-time boolean with true value.
__bool_constant< false > false_type
The type used as a compile-time boolean with false value.
constexpr std::remove_reference< _Tp >::type && move(_Tp &&__t) noexcept
Convert a value to an rvalue.
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.