56 #ifndef _STL_BVECTOR_H 57 #define _STL_BVECTOR_H 1 59 #if __cplusplus >= 201103L 63 namespace std _GLIBCXX_VISIBILITY(default)
65 _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
67 typedef unsigned long _Bit_type;
68 enum { _S_word_bit = int(__CHAR_BIT__ *
sizeof(_Bit_type)) };
75 _Bit_reference(_Bit_type * __x, _Bit_type __y)
76 : _M_p(__x), _M_mask(__y) { }
78 _Bit_reference() _GLIBCXX_NOEXCEPT : _M_p(0), _M_mask(0) { }
80 operator bool() const _GLIBCXX_NOEXCEPT
81 {
return !!(*_M_p & _M_mask); }
84 operator=(
bool __x) _GLIBCXX_NOEXCEPT
94 operator=(
const _Bit_reference& __x) _GLIBCXX_NOEXCEPT
95 {
return *
this = bool(__x); }
98 operator==(
const _Bit_reference& __x)
const 99 {
return bool(*
this) == bool(__x); }
102 operator<(
const _Bit_reference& __x)
const 103 {
return !bool(*
this) && bool(__x); }
106 flip() _GLIBCXX_NOEXCEPT
107 { *_M_p ^= _M_mask; }
110 #if __cplusplus >= 201103L 112 swap(_Bit_reference __x, _Bit_reference __y) noexcept
120 swap(_Bit_reference __x,
bool& __y) noexcept
128 swap(
bool& __x, _Bit_reference __y) noexcept
136 struct _Bit_iterator_base
137 :
public std::iterator<std::random_access_iterator_tag, bool>
140 unsigned int _M_offset;
142 _Bit_iterator_base(_Bit_type * __x,
unsigned int __y)
143 : _M_p(__x), _M_offset(__y) { }
148 if (_M_offset++ ==
int(_S_word_bit) - 1)
158 if (_M_offset-- == 0)
160 _M_offset = int(_S_word_bit) - 1;
166 _M_incr(ptrdiff_t __i)
168 difference_type __n = __i + _M_offset;
169 _M_p += __n / int(_S_word_bit);
170 __n = __n % int(_S_word_bit);
173 __n += int(_S_word_bit);
176 _M_offset =
static_cast<unsigned int>(__n);
180 operator==(
const _Bit_iterator_base& __i)
const 181 {
return _M_p == __i._M_p && _M_offset == __i._M_offset; }
184 operator<(
const _Bit_iterator_base& __i)
const 186 return _M_p < __i._M_p
187 || (_M_p == __i._M_p && _M_offset < __i._M_offset);
191 operator!=(
const _Bit_iterator_base& __i)
const 192 {
return !(*
this == __i); }
195 operator>(
const _Bit_iterator_base& __i)
const 196 {
return __i < *
this; }
199 operator<=(
const _Bit_iterator_base& __i)
const 200 {
return !(__i < *
this); }
203 operator>=(
const _Bit_iterator_base& __i)
const 204 {
return !(*
this < __i); }
208 operator-(
const _Bit_iterator_base& __x,
const _Bit_iterator_base& __y)
210 return (
int(_S_word_bit) * (__x._M_p - __y._M_p)
211 + __x._M_offset - __y._M_offset);
214 struct _Bit_iterator :
public _Bit_iterator_base
216 typedef _Bit_reference reference;
217 typedef _Bit_reference* pointer;
218 typedef _Bit_iterator iterator;
220 _Bit_iterator() : _Bit_iterator_base(0, 0) { }
222 _Bit_iterator(_Bit_type * __x,
unsigned int __y)
223 : _Bit_iterator_base(__x, __y) { }
226 _M_const_cast()
const 231 {
return reference(_M_p, 1UL << _M_offset); }
243 iterator __tmp = *
this;
258 iterator __tmp = *
this;
264 operator+=(difference_type __i)
271 operator-=(difference_type __i)
280 iterator __tmp = *
this;
287 iterator __tmp = *
this;
292 operator[](difference_type __i)
const 293 {
return *(*
this + __i); }
297 operator+(ptrdiff_t __n,
const _Bit_iterator& __x)
298 {
return __x + __n; }
300 struct _Bit_const_iterator :
public _Bit_iterator_base
302 typedef bool reference;
303 typedef bool const_reference;
304 typedef const bool* pointer;
305 typedef _Bit_const_iterator const_iterator;
307 _Bit_const_iterator() : _Bit_iterator_base(0, 0) { }
309 _Bit_const_iterator(_Bit_type * __x,
unsigned int __y)
310 : _Bit_iterator_base(__x, __y) { }
312 _Bit_const_iterator(
const _Bit_iterator& __x)
313 : _Bit_iterator_base(__x._M_p, __x._M_offset) { }
316 _M_const_cast()
const 317 {
return _Bit_iterator(_M_p, _M_offset); }
321 {
return _Bit_reference(_M_p, 1UL << _M_offset); }
333 const_iterator __tmp = *
this;
348 const_iterator __tmp = *
this;
354 operator+=(difference_type __i)
361 operator-=(difference_type __i)
370 const_iterator __tmp = *
this;
377 const_iterator __tmp = *
this;
382 operator[](difference_type __i)
const 383 {
return *(*
this + __i); }
386 inline _Bit_const_iterator
387 operator+(ptrdiff_t __n,
const _Bit_const_iterator& __x)
388 {
return __x + __n; }
391 __fill_bvector(_Bit_iterator __first, _Bit_iterator __last,
bool __x)
393 for (; __first != __last; ++__first)
398 fill(_Bit_iterator __first, _Bit_iterator __last,
const bool& __x)
400 if (__first._M_p != __last._M_p)
402 std::fill(__first._M_p + 1, __last._M_p, __x ? ~0 : 0);
403 __fill_bvector(__first, _Bit_iterator(__first._M_p + 1, 0), __x);
404 __fill_bvector(_Bit_iterator(__last._M_p, 0), __last, __x);
407 __fill_bvector(__first, __last, __x);
410 template<
typename _Alloc>
414 rebind<_Bit_type>::other _Bit_alloc_type;
417 typedef typename _Bit_alloc_traits::pointer _Bit_pointer;
420 :
public _Bit_alloc_type
422 _Bit_iterator _M_start;
423 _Bit_iterator _M_finish;
424 _Bit_pointer _M_end_of_storage;
427 : _Bit_alloc_type(), _M_start(), _M_finish(), _M_end_of_storage()
430 _Bvector_impl(
const _Bit_alloc_type& __a)
431 : _Bit_alloc_type(__a), _M_start(), _M_finish(), _M_end_of_storage()
434 #if __cplusplus >= 201103L 435 _Bvector_impl(_Bit_alloc_type&& __a)
436 : _Bit_alloc_type(
std::move(__a)), _M_start(), _M_finish(),
442 _M_end_addr() const _GLIBCXX_NOEXCEPT
444 if (_M_end_of_storage)
451 typedef _Alloc allocator_type;
454 _M_get_Bit_allocator() _GLIBCXX_NOEXCEPT
455 {
return *
static_cast<_Bit_alloc_type*
>(&this->_M_impl); }
457 const _Bit_alloc_type&
458 _M_get_Bit_allocator() const _GLIBCXX_NOEXCEPT
459 {
return *
static_cast<const _Bit_alloc_type*
>(&this->_M_impl); }
462 get_allocator() const _GLIBCXX_NOEXCEPT
463 {
return allocator_type(_M_get_Bit_allocator()); }
468 _Bvector_base(
const allocator_type& __a)
471 #if __cplusplus >= 201103L 472 _Bvector_base(_Bvector_base&& __x) noexcept
473 : _M_impl(
std::move(__x._M_get_Bit_allocator()))
475 this->_M_impl._M_start = __x._M_impl._M_start;
476 this->_M_impl._M_finish = __x._M_impl._M_finish;
477 this->_M_impl._M_end_of_storage = __x._M_impl._M_end_of_storage;
478 __x._M_impl._M_start = _Bit_iterator();
479 __x._M_impl._M_finish = _Bit_iterator();
480 __x._M_impl._M_end_of_storage =
nullptr;
485 { this->_M_deallocate(); }
488 _Bvector_impl _M_impl;
491 _M_allocate(
size_t __n)
492 {
return _Bit_alloc_traits::allocate(_M_impl, _S_nword(__n)); }
497 if (_M_impl._M_start._M_p)
499 const size_t __n = _M_impl._M_end_addr() - _M_impl._M_start._M_p;
500 _Bit_alloc_traits::deallocate(_M_impl,
501 _M_impl._M_end_of_storage - __n,
508 {
return (__n +
int(_S_word_bit) - 1) / int(_S_word_bit); }
511 _GLIBCXX_END_NAMESPACE_CONTAINER
517 namespace std _GLIBCXX_VISIBILITY(default)
519 _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
540 template<
typename _Alloc>
541 class vector<bool, _Alloc> :
protected _Bvector_base<_Alloc>
543 typedef _Bvector_base<_Alloc> _Base;
544 typedef typename _Base::_Bit_pointer _Bit_pointer;
547 #if __cplusplus >= 201103L 548 template<
typename>
friend struct hash;
552 typedef bool value_type;
553 typedef size_t size_type;
554 typedef ptrdiff_t difference_type;
555 typedef _Bit_reference reference;
556 typedef bool const_reference;
557 typedef _Bit_reference* pointer;
558 typedef const bool* const_pointer;
559 typedef _Bit_iterator iterator;
560 typedef _Bit_const_iterator const_iterator;
563 typedef _Alloc allocator_type;
565 allocator_type get_allocator()
const 566 {
return _Base::get_allocator(); }
569 using _Base::_M_allocate;
570 using _Base::_M_deallocate;
571 using _Base::_S_nword;
572 using _Base::_M_get_Bit_allocator;
576 #if __cplusplus >= 201103L 577 noexcept(is_nothrow_default_constructible<allocator_type>::value)
582 vector(
const allocator_type& __a)
585 #if __cplusplus >= 201103L 587 vector(size_type __n,
const allocator_type& __a = allocator_type())
591 vector(size_type __n,
const bool& __value,
592 const allocator_type& __a = allocator_type())
596 std::fill(this->_M_impl._M_start._M_p, this->_M_impl._M_end_addr(),
601 vector(size_type __n,
const bool& __value =
bool(),
602 const allocator_type& __a = allocator_type())
606 std::fill(this->_M_impl._M_start._M_p, this->_M_impl._M_end_addr(),
611 vector(
const vector& __x)
612 : _Base(_Bit_alloc_traits::_S_select_on_copy(__x._M_get_Bit_allocator()))
614 _M_initialize(__x.
size());
615 _M_copy_aligned(__x.
begin(), __x.
end(), this->_M_impl._M_start);
618 #if __cplusplus >= 201103L 619 vector(vector&& __x) noexcept
620 : _Base(std::move(__x)) { }
622 vector(vector&& __x,
const allocator_type& __a)
623 noexcept(_Bit_alloc_traits::_S_always_equal())
626 if (__x.get_allocator() == __a)
628 this->_M_impl._M_start = __x._M_impl._M_start;
629 this->_M_impl._M_finish = __x._M_impl._M_finish;
630 this->_M_impl._M_end_of_storage = __x._M_impl._M_end_of_storage;
631 __x._M_impl._M_start = _Bit_iterator();
632 __x._M_impl._M_finish = _Bit_iterator();
633 __x._M_impl._M_end_of_storage =
nullptr;
637 _M_initialize(__x.
size());
643 vector(
const vector& __x,
const allocator_type& __a)
646 _M_initialize(__x.
size());
647 _M_copy_aligned(__x.
begin(), __x.
end(), this->_M_impl._M_start);
651 const allocator_type& __a = allocator_type())
654 _M_initialize_range(__l.begin(), __l.end(),
659 #if __cplusplus >= 201103L 660 template<
typename _InputIterator,
661 typename = std::_RequireInputIter<_InputIterator>>
662 vector(_InputIterator __first, _InputIterator __last,
663 const allocator_type& __a = allocator_type())
665 { _M_initialize_dispatch(__first, __last, __false_type()); }
667 template<
typename _InputIterator>
668 vector(_InputIterator __first, _InputIterator __last,
669 const allocator_type& __a = allocator_type())
672 typedef typename std::__is_integer<_InputIterator>::__type _Integral;
673 _M_initialize_dispatch(__first, __last, _Integral());
677 ~vector() _GLIBCXX_NOEXCEPT { }
680 operator=(
const vector& __x)
684 #if __cplusplus >= 201103L 685 if (_Bit_alloc_traits::_S_propagate_on_copy_assign())
687 if (this->_M_get_Bit_allocator() != __x._M_get_Bit_allocator())
689 this->_M_deallocate();
690 std::__alloc_on_copy(_M_get_Bit_allocator(),
691 __x._M_get_Bit_allocator());
692 _M_initialize(__x.
size());
695 std::__alloc_on_copy(_M_get_Bit_allocator(),
696 __x._M_get_Bit_allocator());
699 if (__x.
size() > capacity())
701 this->_M_deallocate();
702 _M_initialize(__x.
size());
704 this->_M_impl._M_finish = _M_copy_aligned(__x.
begin(), __x.
end(),
709 #if __cplusplus >= 201103L 711 operator=(vector&& __x) noexcept(_Bit_alloc_traits::_S_nothrow_move())
713 if (_Bit_alloc_traits::_S_propagate_on_move_assign()
714 || this->_M_get_Bit_allocator() == __x._M_get_Bit_allocator())
716 this->_M_deallocate();
717 this->_M_impl._M_start = __x._M_impl._M_start;
718 this->_M_impl._M_finish = __x._M_impl._M_finish;
719 this->_M_impl._M_end_of_storage = __x._M_impl._M_end_of_storage;
720 __x._M_impl._M_start = _Bit_iterator();
721 __x._M_impl._M_finish = _Bit_iterator();
722 __x._M_impl._M_end_of_storage =
nullptr;
723 std::__alloc_on_move(_M_get_Bit_allocator(),
724 __x._M_get_Bit_allocator());
728 if (__x.
size() > capacity())
730 this->_M_deallocate();
731 _M_initialize(__x.
size());
733 this->_M_impl._M_finish = _M_copy_aligned(__x.
begin(), __x.
end(),
743 this->assign (__l.begin(), __l.end());
753 assign(size_type __n,
const bool& __x)
754 { _M_fill_assign(__n, __x); }
756 #if __cplusplus >= 201103L 757 template<
typename _InputIterator,
758 typename = std::_RequireInputIter<_InputIterator>>
760 assign(_InputIterator __first, _InputIterator __last)
761 { _M_assign_dispatch(__first, __last, __false_type()); }
763 template<
typename _InputIterator>
765 assign(_InputIterator __first, _InputIterator __last)
767 typedef typename std::__is_integer<_InputIterator>::__type _Integral;
768 _M_assign_dispatch(__first, __last, _Integral());
772 #if __cplusplus >= 201103L 775 { this->assign(__l.begin(), __l.end()); }
779 begin() _GLIBCXX_NOEXCEPT
780 {
return this->_M_impl._M_start; }
783 begin()
const _GLIBCXX_NOEXCEPT
784 {
return this->_M_impl._M_start; }
787 end() _GLIBCXX_NOEXCEPT
788 {
return this->_M_impl._M_finish; }
791 end()
const _GLIBCXX_NOEXCEPT
792 {
return this->_M_impl._M_finish; }
795 rbegin() _GLIBCXX_NOEXCEPT
796 {
return reverse_iterator(
end()); }
798 const_reverse_iterator
799 rbegin()
const _GLIBCXX_NOEXCEPT
800 {
return const_reverse_iterator(
end()); }
803 rend() _GLIBCXX_NOEXCEPT
804 {
return reverse_iterator(
begin()); }
806 const_reverse_iterator
807 rend()
const _GLIBCXX_NOEXCEPT
808 {
return const_reverse_iterator(
begin()); }
810 #if __cplusplus >= 201103L 813 {
return this->_M_impl._M_start; }
816 cend()
const noexcept
817 {
return this->_M_impl._M_finish; }
819 const_reverse_iterator
821 {
return const_reverse_iterator(
end()); }
823 const_reverse_iterator
824 crend()
const noexcept
825 {
return const_reverse_iterator(
begin()); }
829 size()
const _GLIBCXX_NOEXCEPT
830 {
return size_type(
end() -
begin()); }
833 max_size()
const _GLIBCXX_NOEXCEPT
835 const size_type __isize =
836 __gnu_cxx::__numeric_traits<difference_type>::__max
837 - int(_S_word_bit) + 1;
838 const size_type __asize
839 = _Bit_alloc_traits::max_size(_M_get_Bit_allocator());
840 return (__asize <= __isize /
int(_S_word_bit)
841 ? __asize *
int(_S_word_bit) : __isize);
845 capacity()
const _GLIBCXX_NOEXCEPT
846 {
return size_type(const_iterator(this->_M_impl._M_end_addr(), 0)
850 empty()
const _GLIBCXX_NOEXCEPT
854 operator[](size_type __n)
856 return *iterator(this->_M_impl._M_start._M_p
857 + __n /
int(_S_word_bit), __n %
int(_S_word_bit));
861 operator[](size_type __n)
const 863 return *const_iterator(this->_M_impl._M_start._M_p
864 + __n /
int(_S_word_bit), __n %
int(_S_word_bit));
869 _M_range_check(size_type __n)
const 871 if (__n >= this->size())
872 __throw_out_of_range_fmt(__N(
"vector<bool>::_M_range_check: __n " 873 "(which is %zu) >= this->size() " 881 { _M_range_check(__n);
return (*
this)[__n]; }
884 at(size_type __n)
const 885 { _M_range_check(__n);
return (*
this)[__n]; }
888 reserve(size_type __n)
890 if (__n > max_size())
891 __throw_length_error(__N(
"vector::reserve"));
892 if (capacity() < __n)
906 {
return *(
end() - 1); }
910 {
return *(
end() - 1); }
918 data() _GLIBCXX_NOEXCEPT { }
923 if (this->_M_impl._M_finish._M_p != this->_M_impl._M_end_addr())
924 *this->_M_impl._M_finish++ = __x;
926 _M_insert_aux(
end(), __x);
930 swap(vector& __x) _GLIBCXX_NOEXCEPT
932 std::swap(this->_M_impl._M_start, __x._M_impl._M_start);
933 std::swap(this->_M_impl._M_finish, __x._M_impl._M_finish);
934 std::swap(this->_M_impl._M_end_of_storage,
935 __x._M_impl._M_end_of_storage);
936 _Bit_alloc_traits::_S_on_swap(_M_get_Bit_allocator(),
937 __x._M_get_Bit_allocator());
942 swap(reference __x, reference __y) _GLIBCXX_NOEXCEPT
950 #if __cplusplus >= 201103L 951 insert(const_iterator __position,
const bool& __x =
bool())
953 insert(iterator __position,
const bool& __x =
bool())
956 const difference_type __n = __position -
begin();
957 if (this->_M_impl._M_finish._M_p != this->_M_impl._M_end_addr()
958 && __position ==
end())
959 *this->_M_impl._M_finish++ = __x;
961 _M_insert_aux(__position._M_const_cast(), __x);
962 return begin() + __n;
965 #if __cplusplus >= 201103L 966 template<
typename _InputIterator,
967 typename = std::_RequireInputIter<_InputIterator>>
969 insert(const_iterator __position,
970 _InputIterator __first, _InputIterator __last)
972 difference_type __offset = __position -
cbegin();
973 _M_insert_dispatch(__position._M_const_cast(),
974 __first, __last, __false_type());
975 return begin() + __offset;
978 template<
typename _InputIterator>
980 insert(iterator __position,
981 _InputIterator __first, _InputIterator __last)
983 typedef typename std::__is_integer<_InputIterator>::__type _Integral;
984 _M_insert_dispatch(__position, __first, __last, _Integral());
988 #if __cplusplus >= 201103L 990 insert(const_iterator __position, size_type __n,
const bool& __x)
992 difference_type __offset = __position -
cbegin();
993 _M_fill_insert(__position._M_const_cast(), __n, __x);
994 return begin() + __offset;
998 insert(iterator __position, size_type __n,
const bool& __x)
999 { _M_fill_insert(__position, __n, __x); }
1002 #if __cplusplus >= 201103L 1005 {
return this->insert(__p, __l.begin(), __l.end()); }
1010 { --this->_M_impl._M_finish; }
1013 #if __cplusplus >= 201103L 1014 erase(const_iterator __position)
1016 erase(iterator __position)
1018 {
return _M_erase(__position._M_const_cast()); }
1021 #if __cplusplus >= 201103L 1022 erase(const_iterator __first, const_iterator __last)
1024 erase(iterator __first, iterator __last)
1026 {
return _M_erase(__first._M_const_cast(), __last._M_const_cast()); }
1029 resize(size_type __new_size,
bool __x =
bool())
1031 if (__new_size < size())
1032 _M_erase_at_end(
begin() + difference_type(__new_size));
1034 insert(
end(), __new_size - size(), __x);
1037 #if __cplusplus >= 201103L 1040 { _M_shrink_to_fit(); }
1044 flip() _GLIBCXX_NOEXCEPT
1046 _Bit_type *
const __end = this->_M_impl._M_end_addr();
1047 for (_Bit_type * __p = this->_M_impl._M_start._M_p; __p != __end; ++__p)
1052 clear() _GLIBCXX_NOEXCEPT
1053 { _M_erase_at_end(
begin()); }
1055 #if __cplusplus >= 201103L 1056 template<
typename... _Args>
1058 emplace_back(_Args&&... __args)
1059 { push_back(
bool(__args...)); }
1061 template<
typename... _Args>
1063 emplace(const_iterator __pos, _Args&&... __args)
1064 {
return insert(__pos,
bool(__args...)); }
1070 _M_copy_aligned(const_iterator __first, const_iterator __last,
1073 _Bit_type* __q = std::copy(__first._M_p, __last._M_p, __result._M_p);
1074 return std::copy(const_iterator(__last._M_p, 0), __last,
1079 _M_initialize(size_type __n)
1081 _Bit_pointer __q = this->_M_allocate(__n);
1082 this->_M_impl._M_end_of_storage = __q + _S_nword(__n);
1084 this->_M_impl._M_finish = this->_M_impl._M_start + difference_type(__n);
1088 _M_reallocate(size_type __n);
1090 #if __cplusplus >= 201103L 1099 template<
typename _Integer>
1101 _M_initialize_dispatch(_Integer __n, _Integer __x, __true_type)
1103 _M_initialize(static_cast<size_type>(__n));
1104 std::fill(this->_M_impl._M_start._M_p,
1105 this->_M_impl._M_end_addr(), __x ? ~0 : 0);
1108 template<
typename _InputIterator>
1110 _M_initialize_dispatch(_InputIterator __first, _InputIterator __last,
1112 { _M_initialize_range(__first, __last,
1115 template<
typename _InputIterator>
1117 _M_initialize_range(_InputIterator __first, _InputIterator __last,
1120 for (; __first != __last; ++__first)
1121 push_back(*__first);
1124 template<
typename _ForwardIterator>
1126 _M_initialize_range(_ForwardIterator __first, _ForwardIterator __last,
1131 std::copy(__first, __last, this->_M_impl._M_start);
1136 template<
typename _Integer>
1138 _M_assign_dispatch(_Integer __n, _Integer __val, __true_type)
1139 { _M_fill_assign(__n, __val); }
1141 template<
class _InputIterator>
1143 _M_assign_dispatch(_InputIterator __first, _InputIterator __last,
1148 _M_fill_assign(
size_t __n,
bool __x)
1152 std::fill(this->_M_impl._M_start._M_p,
1153 this->_M_impl._M_end_addr(), __x ? ~0 : 0);
1154 insert(
end(), __n - size(), __x);
1158 _M_erase_at_end(
begin() + __n);
1159 std::fill(this->_M_impl._M_start._M_p,
1160 this->_M_impl._M_end_addr(), __x ? ~0 : 0);
1164 template<
typename _InputIterator>
1166 _M_assign_aux(_InputIterator __first, _InputIterator __last,
1169 iterator __cur =
begin();
1170 for (; __first != __last && __cur !=
end(); ++__cur, ++__first)
1172 if (__first == __last)
1173 _M_erase_at_end(__cur);
1175 insert(
end(), __first, __last);
1178 template<
typename _ForwardIterator>
1180 _M_assign_aux(_ForwardIterator __first, _ForwardIterator __last,
1185 _M_erase_at_end(std::copy(__first, __last,
begin()));
1188 _ForwardIterator __mid = __first;
1190 std::copy(__first, __mid,
begin());
1191 insert(
end(), __mid, __last);
1199 template<
typename _Integer>
1201 _M_insert_dispatch(iterator __pos, _Integer __n, _Integer __x,
1203 { _M_fill_insert(__pos, __n, __x); }
1205 template<
typename _InputIterator>
1207 _M_insert_dispatch(iterator __pos,
1208 _InputIterator __first, _InputIterator __last,
1210 { _M_insert_range(__pos, __first, __last,
1214 _M_fill_insert(iterator __position, size_type __n,
bool __x);
1216 template<
typename _InputIterator>
1218 _M_insert_range(iterator __pos, _InputIterator __first,
1221 for (; __first != __last; ++__first)
1223 __pos = insert(__pos, *__first);
1228 template<
typename _ForwardIterator>
1230 _M_insert_range(iterator __position, _ForwardIterator __first,
1234 _M_insert_aux(iterator __position,
bool __x);
1237 _M_check_len(size_type __n,
const char* __s)
const 1239 if (max_size() - size() < __n)
1240 __throw_length_error(__N(__s));
1242 const size_type __len = size() +
std::max(size(), __n);
1243 return (__len < size() || __len > max_size()) ? max_size() : __len;
1247 _M_erase_at_end(iterator __pos)
1248 { this->_M_impl._M_finish = __pos; }
1251 _M_erase(iterator __pos);
1254 _M_erase(iterator __first, iterator __last);
1257 _GLIBCXX_END_NAMESPACE_CONTAINER
1260 #if __cplusplus >= 201103L 1264 namespace std _GLIBCXX_VISIBILITY(default)
1266 _GLIBCXX_BEGIN_NAMESPACE_VERSION
1270 template<
typename _Alloc>
1272 :
public __hash_base<size_t, _GLIBCXX_STD_C::vector<bool, _Alloc>>
1275 operator()(
const _GLIBCXX_STD_C::vector<bool, _Alloc>&)
const noexcept;
1278 _GLIBCXX_END_NAMESPACE_VERSION
complex< _Tp > operator*(const complex< _Tp > &__x, const complex< _Tp > &__y)
Return new complex value x times y.
Uniform interface to C++98 and C++11 allocators.
constexpr auto cend(const _Container &__cont) noexcept(noexcept(std::end(__cont))) -> decltype(std::end(__cont))
Return an iterator pointing to one past the last element of the const container.
void advance(_InputIterator &__i, _Distance __n)
A generalization of pointer arithmetic.
_GLIBCXX14_CONSTEXPR const _Tp & max(const _Tp &, const _Tp &)
This does what you think it does.
constexpr const _Tp * begin(initializer_list< _Tp > __ils) noexcept
Return an iterator pointing to the first element of the initializer_list.
constexpr const _Tp * end(initializer_list< _Tp > __ils) noexcept
Return an iterator pointing to one past the last element of the initializer_list. ...
complex< _Tp > operator-(const complex< _Tp > &__x, const complex< _Tp > &__y)
Return new complex value x minus y.
auto rbegin(_Container &__cont) -> decltype(__cont.rbegin())
Return a reverse iterator pointing to the last element of the container.
auto crend(const _Container &__cont) -> decltype(std::rend(__cont))
Return a reverse iterator pointing one past the first element of the const container.
constexpr auto cbegin(const _Container &__cont) noexcept(noexcept(std::begin(__cont))) -> decltype(std::begin(__cont))
Return an iterator pointing to the first element of the const container.
_Tp * __addressof(_Tp &__r) noexcept
Same as C++11 std::addressof.
complex< _Tp > operator+(const complex< _Tp > &__x, const complex< _Tp > &__y)
Return new complex value x plus y.
A standard container which offers fixed time access to individual elements in any order...
Random-access iterators support a superset of bidirectional iterator operations.
auto crbegin(const _Container &__cont) -> decltype(std::rbegin(__cont))
Return a reverse iterator pointing to the last element of the const container.
auto rend(_Container &__cont) -> decltype(__cont.rend())
Return a reverse iterator pointing one past the first element of the container.
size_type size() const noexcept
Forward iterators support a superset of input iterator operations.
iterator begin() noexcept
ISO C++ entities toplevel namespace is std.
Primary class template hash.
iterator_traits< _InputIterator >::difference_type distance(_InputIterator __first, _InputIterator __last)
A generalization of pointer arithmetic.
iterator_traits< _Iter >::iterator_category __iterator_category(const _Iter &)