61namespace std _GLIBCXX_VISIBILITY(default)
63_GLIBCXX_BEGIN_NAMESPACE_VERSION
64_GLIBCXX_BEGIN_NAMESPACE_CONTAINER
66#if __cplusplus >= 201103L
67 template <
typename _Tp,
typename _Alloc>
70 _M_default_initialize()
75 for (__cur = this->_M_impl._M_start._M_node;
76 __cur < this->_M_impl._M_finish._M_node;
79 _M_get_Tp_allocator());
81 this->_M_impl._M_finish._M_cur,
82 _M_get_Tp_allocator());
86 std::_Destroy(this->_M_impl._M_start, iterator(*__cur, __cur),
87 _M_get_Tp_allocator());
88 __throw_exception_again;
93 template <
typename _Tp,
typename _Alloc>
100#if __cplusplus >= 201103L
101 if (_Alloc_traits::_S_propagate_on_copy_assign())
103 if (!_Alloc_traits::_S_always_equal()
104 && _M_get_Tp_allocator() != __x._M_get_Tp_allocator())
109 std::__alloc_on_copy(_M_get_Tp_allocator(),
110 __x._M_get_Tp_allocator());
113 std::__alloc_on_copy(_M_get_Tp_allocator(),
114 __x._M_get_Tp_allocator());
117 const size_type
__len = size();
119 _M_erase_at_end(std::copy(__x.
begin(), __x.
end(),
120 this->_M_impl._M_start));
125 _M_range_insert_aux(this->_M_impl._M_finish,
__mid, __x.
end(),
132#if __cplusplus >= 201103L
133 template<
typename _Tp,
typename _Alloc>
134 template<
typename...
_Args>
135#if __cplusplus > 201402L
136 typename deque<_Tp, _Alloc>::reference
143 if (this->_M_impl._M_start._M_cur !=
this->_M_impl._M_start._M_first)
145 _Alloc_traits::construct(this->_M_impl,
146 this->_M_impl._M_start._M_cur - 1,
148 --this->_M_impl._M_start._M_cur;
152#if __cplusplus > 201402L
157 template<
typename _Tp,
typename _Alloc>
158 template<
typename... _Args>
159#if __cplusplus > 201402L
160 typename deque<_Tp, _Alloc>::reference
165 emplace_back(_Args&&... __args)
167 if (this->_M_impl._M_finish._M_cur
168 != this->_M_impl._M_finish._M_last - 1)
170 _Alloc_traits::construct(this->_M_impl,
171 this->_M_impl._M_finish._M_cur,
173 ++this->_M_impl._M_finish._M_cur;
177#if __cplusplus > 201402L
183#if __cplusplus >= 201103L
184 template<
typename _Tp,
typename _Alloc>
185 template<
typename... _Args>
186 typename deque<_Tp, _Alloc>::iterator
193 return this->_M_impl._M_start;
203 return _M_insert_aux(
__position._M_const_cast(),
208 template <
typename _Tp,
typename _Alloc>
211#if __cplusplus >= 201103L
220 return this->_M_impl._M_start;
230 return _M_insert_aux(
__position._M_const_cast(), __x);
233 template <
typename _Tp,
typename _Alloc>
241 if (
static_cast<size_type
>(
__index) < (size() >> 1))
250 _GLIBCXX_MOVE3(__next,
end(), __position);
253 return begin() + __index;
256 template <
typename _Tp,
typename _Alloc>
257 typename deque<_Tp, _Alloc>::iterator
259 _M_erase(iterator __first, iterator __last)
261 if (__first == __last)
263 else if (__first ==
begin() && __last ==
end())
270 const difference_type __n = __last - __first;
271 const difference_type __elems_before = __first -
begin();
272 if (
static_cast<size_type
>(__elems_before) <= (size() - __n) / 2)
274 if (__first !=
begin())
275 _GLIBCXX_MOVE_BACKWARD3(
begin(), __first, __last);
276 _M_erase_at_begin(
begin() + __n);
281 _GLIBCXX_MOVE3(__last,
end(), __first);
282 _M_erase_at_end(
end() - __n);
284 return begin() + __elems_before;
288 template <
typename _Tp,
class _Alloc>
289 template <
typename _InputIterator>
292 _M_assign_aux(_InputIterator __first, _InputIterator __last,
295 iterator __cur =
begin();
296 for (; __first != __last && __cur !=
end(); ++__cur, (void)++__first)
298 if (__first == __last)
299 _M_erase_at_end(__cur);
301 _M_range_insert_aux(
end(), __first, __last,
305 template <
typename _Tp,
typename _Alloc>
308 _M_fill_insert(iterator __pos, size_type __n,
const value_type& __x)
310 if (__pos._M_cur == this->_M_impl._M_start._M_cur)
312 iterator __new_start = _M_reserve_elements_at_front(__n);
316 __x, _M_get_Tp_allocator());
317 this->_M_impl._M_start = __new_start;
321 _M_destroy_nodes(__new_start._M_node,
322 this->_M_impl._M_start._M_node);
323 __throw_exception_again;
326 else if (__pos._M_cur == this->_M_impl._M_finish._M_cur)
328 iterator __new_finish = _M_reserve_elements_at_back(__n);
333 _M_get_Tp_allocator());
334 this->_M_impl._M_finish = __new_finish;
338 _M_destroy_nodes(this->_M_impl._M_finish._M_node + 1,
339 __new_finish._M_node + 1);
340 __throw_exception_again;
344 _M_insert_aux(__pos, __n, __x);
347#if __cplusplus >= 201103L
348 template <
typename _Tp,
typename _Alloc>
351 _M_default_append(size_type __n)
355 iterator __new_finish = _M_reserve_elements_at_back(__n);
360 _M_get_Tp_allocator());
361 this->_M_impl._M_finish = __new_finish;
365 _M_destroy_nodes(this->_M_impl._M_finish._M_node + 1,
366 __new_finish._M_node + 1);
367 __throw_exception_again;
372 template <
typename _Tp,
typename _Alloc>
377 const difference_type __front_capacity
378 = (this->_M_impl._M_start._M_cur - this->_M_impl._M_start._M_first);
379 if (__front_capacity == 0)
382 const difference_type __back_capacity
383 = (this->_M_impl._M_finish._M_last - this->_M_impl._M_finish._M_cur);
384 if (__front_capacity + __back_capacity < _S_buffer_size())
387 return std::__shrink_to_fit_aux<deque>::_S_do_it(*
this);
391 template <
typename _Tp,
typename _Alloc>
399 for (
__cur = this->_M_impl._M_start._M_node;
400 __cur < this->_M_impl._M_finish._M_node;
403 __value, _M_get_Tp_allocator());
405 this->_M_impl._M_finish._M_cur,
406 __value, _M_get_Tp_allocator());
411 _M_get_Tp_allocator());
412 __throw_exception_again;
416 template <
typename _Tp,
typename _Alloc>
417 template <
typename _InputIterator>
423 this->_M_initialize_map(0);
426 for (; __first != __last; ++__first)
428 emplace_back(*__first);
436 __throw_exception_again;
440 template <
typename _Tp,
typename _Alloc>
441 template <
typename _ForwardIterator>
448 this->_M_initialize_map(_S_check_init_len(__n, _M_get_Tp_allocator()));
453 for (
__cur_node = this->_M_impl._M_start._M_node;
460 _M_get_Tp_allocator());
464 this->_M_impl._M_finish._M_first,
465 _M_get_Tp_allocator());
471 _M_get_Tp_allocator());
472 __throw_exception_again;
477 template<
typename _Tp,
typename _Alloc>
478#if __cplusplus >= 201103L
479 template<
typename...
_Args>
489 if (size() == max_size())
490 __throw_length_error(
491 __N(
"cannot create std::deque larger than max_size()"));
493 _M_reserve_map_at_back();
494 *(this->_M_impl._M_finish._M_node + 1) = this->_M_allocate_node();
497#if __cplusplus >= 201103L
498 _Alloc_traits::construct(this->_M_impl,
499 this->_M_impl._M_finish._M_cur,
502 this->_M_impl.construct(this->_M_impl._M_finish._M_cur, __t);
504 this->_M_impl._M_finish._M_set_node(this->_M_impl._M_finish._M_node
506 this->_M_impl._M_finish._M_cur = this->_M_impl._M_finish._M_first;
510 _M_deallocate_node(*(this->_M_impl._M_finish._M_node + 1));
511 __throw_exception_again;
516 template<
typename _Tp,
typename _Alloc>
517#if __cplusplus >= 201103L
518 template<
typename...
_Args>
528 if (size() == max_size())
529 __throw_length_error(
530 __N(
"cannot create std::deque larger than max_size()"));
532 _M_reserve_map_at_front();
533 *(this->_M_impl._M_start._M_node - 1) = this->_M_allocate_node();
536 this->_M_impl._M_start._M_set_node(this->_M_impl._M_start._M_node
538 this->_M_impl._M_start._M_cur = this->_M_impl._M_start._M_last - 1;
539#if __cplusplus >= 201103L
540 _Alloc_traits::construct(this->_M_impl,
541 this->_M_impl._M_start._M_cur,
544 this->_M_impl.construct(this->_M_impl._M_start._M_cur, __t);
549 ++this->_M_impl._M_start;
550 _M_deallocate_node(*(this->_M_impl._M_start._M_node - 1));
551 __throw_exception_again;
556 template <
typename _Tp,
typename _Alloc>
560 _M_deallocate_node(this->_M_impl._M_finish._M_first);
561 this->_M_impl._M_finish._M_set_node(this->_M_impl._M_finish._M_node - 1);
562 this->_M_impl._M_finish._M_cur = this->_M_impl._M_finish._M_last - 1;
563 _Alloc_traits::destroy(_M_get_Tp_allocator(),
564 this->_M_impl._M_finish._M_cur);
572 template <
typename _Tp,
typename _Alloc>
576 _Alloc_traits::destroy(_M_get_Tp_allocator(),
577 this->_M_impl._M_start._M_cur);
578 _M_deallocate_node(this->_M_impl._M_start._M_first);
579 this->_M_impl._M_start._M_set_node(this->_M_impl._M_start._M_node + 1);
580 this->_M_impl._M_start._M_cur = this->_M_impl._M_start._M_first;
583 template <
typename _Tp,
typename _Alloc>
584 template <
typename _InputIterator>
592 template <
typename _Tp,
typename _Alloc>
593 template <
typename _ForwardIterator>
596 _M_range_insert_aux(iterator __pos,
597 _ForwardIterator __first, _ForwardIterator __last,
601 if (__pos._M_cur == this->_M_impl._M_start._M_cur)
603 iterator __new_start = _M_reserve_elements_at_front(__n);
607 _M_get_Tp_allocator());
608 this->_M_impl._M_start = __new_start;
612 _M_destroy_nodes(__new_start._M_node,
613 this->_M_impl._M_start._M_node);
614 __throw_exception_again;
617 else if (__pos._M_cur == this->_M_impl._M_finish._M_cur)
619 iterator __new_finish = _M_reserve_elements_at_back(__n);
623 this->_M_impl._M_finish,
624 _M_get_Tp_allocator());
625 this->_M_impl._M_finish = __new_finish;
629 _M_destroy_nodes(this->_M_impl._M_finish._M_node + 1,
630 __new_finish._M_node + 1);
631 __throw_exception_again;
635 _M_insert_aux(__pos, __first, __last, __n);
638 template<
typename _Tp,
typename _Alloc>
639#if __cplusplus >= 201103L
640 template<
typename... _Args>
641 typename deque<_Tp, _Alloc>::iterator
643 _M_insert_aux(iterator __pos, _Args&&... __args)
647 typename deque<_Tp, _Alloc>::iterator
649 _M_insert_aux(iterator __pos,
const value_type& __x)
651 value_type __x_copy = __x;
653 difference_type __index = __pos - this->_M_impl._M_start;
654 if (
static_cast<size_type
>(__index) < size() / 2)
656 push_front(_GLIBCXX_MOVE(front()));
657 iterator __front1 = this->_M_impl._M_start;
659 iterator __front2 = __front1;
661 __pos = this->_M_impl._M_start + __index;
662 iterator __pos1 = __pos;
664 _GLIBCXX_MOVE3(__front2, __pos1, __front1);
668 push_back(_GLIBCXX_MOVE(back()));
669 iterator __back1 = this->_M_impl._M_finish;
671 iterator __back2 = __back1;
673 __pos = this->_M_impl._M_start + __index;
674 _GLIBCXX_MOVE_BACKWARD3(__pos, __back2, __back1);
676 *__pos = _GLIBCXX_MOVE(__x_copy);
680 template <
typename _Tp,
typename _Alloc>
683 _M_insert_aux(iterator __pos, size_type __n,
const value_type& __x)
685 const difference_type __elems_before = __pos - this->_M_impl._M_start;
686 const size_type __length = this->size();
687 value_type __x_copy = __x;
688 if (__elems_before < difference_type(__length / 2))
690 iterator __new_start = _M_reserve_elements_at_front(__n);
691 iterator __old_start = this->_M_impl._M_start;
692 __pos = this->_M_impl._M_start + __elems_before;
695 if (__elems_before >= difference_type(__n))
697 iterator __start_n = (this->_M_impl._M_start
698 + difference_type(__n));
700 __start_n, __new_start,
701 _M_get_Tp_allocator());
702 this->_M_impl._M_start = __new_start;
703 _GLIBCXX_MOVE3(__start_n, __pos, __old_start);
704 std::fill(__pos - difference_type(__n), __pos, __x_copy);
710 this->_M_impl._M_start,
712 _M_get_Tp_allocator());
713 this->_M_impl._M_start = __new_start;
714 std::fill(__old_start, __pos, __x_copy);
719 _M_destroy_nodes(__new_start._M_node,
720 this->_M_impl._M_start._M_node);
721 __throw_exception_again;
726 iterator __new_finish = _M_reserve_elements_at_back(__n);
727 iterator __old_finish = this->_M_impl._M_finish;
728 const difference_type __elems_after =
729 difference_type(__length) - __elems_before;
730 __pos = this->_M_impl._M_finish - __elems_after;
733 if (__elems_after > difference_type(__n))
735 iterator __finish_n = (this->_M_impl._M_finish
736 - difference_type(__n));
738 this->_M_impl._M_finish,
739 this->_M_impl._M_finish,
740 _M_get_Tp_allocator());
741 this->_M_impl._M_finish = __new_finish;
742 _GLIBCXX_MOVE_BACKWARD3(__pos, __finish_n, __old_finish);
743 std::fill(__pos, __pos + difference_type(__n), __x_copy);
748 __pos + difference_type(__n),
750 this->_M_impl._M_finish,
751 _M_get_Tp_allocator());
752 this->_M_impl._M_finish = __new_finish;
753 std::fill(__pos, __old_finish, __x_copy);
758 _M_destroy_nodes(this->_M_impl._M_finish._M_node + 1,
759 __new_finish._M_node + 1);
760 __throw_exception_again;
765 template <
typename _Tp,
typename _Alloc>
766 template <
typename _ForwardIterator>
769 _M_insert_aux(iterator __pos,
770 _ForwardIterator __first, _ForwardIterator __last,
773 const difference_type __elemsbefore = __pos - this->_M_impl._M_start;
774 const size_type __length = size();
775 if (
static_cast<size_type
>(__elemsbefore) < __length / 2)
777 iterator __new_start = _M_reserve_elements_at_front(__n);
778 iterator __old_start = this->_M_impl._M_start;
779 __pos = this->_M_impl._M_start + __elemsbefore;
782 if (__elemsbefore >= difference_type(__n))
784 iterator __start_n = (this->_M_impl._M_start
785 + difference_type(__n));
787 __start_n, __new_start,
788 _M_get_Tp_allocator());
789 this->_M_impl._M_start = __new_start;
790 _GLIBCXX_MOVE3(__start_n, __pos, __old_start);
791 std::copy(__first, __last, __pos - difference_type(__n));
795 _ForwardIterator __mid = __first;
796 std::advance(__mid, difference_type(__n) - __elemsbefore);
798 __pos, __first, __mid,
800 _M_get_Tp_allocator());
801 this->_M_impl._M_start = __new_start;
802 std::copy(__mid, __last, __old_start);
807 _M_destroy_nodes(__new_start._M_node,
808 this->_M_impl._M_start._M_node);
809 __throw_exception_again;
814 iterator __new_finish = _M_reserve_elements_at_back(__n);
815 iterator __old_finish = this->_M_impl._M_finish;
816 const difference_type __elemsafter =
817 difference_type(__length) - __elemsbefore;
818 __pos = this->_M_impl._M_finish - __elemsafter;
821 if (__elemsafter > difference_type(__n))
823 iterator __finish_n = (this->_M_impl._M_finish
824 - difference_type(__n));
826 this->_M_impl._M_finish,
827 this->_M_impl._M_finish,
828 _M_get_Tp_allocator());
829 this->_M_impl._M_finish = __new_finish;
830 _GLIBCXX_MOVE_BACKWARD3(__pos, __finish_n, __old_finish);
831 std::copy(__first, __last, __pos);
835 _ForwardIterator __mid = __first;
838 this->_M_impl._M_finish,
839 this->_M_impl._M_finish,
840 _M_get_Tp_allocator());
841 this->_M_impl._M_finish = __new_finish;
842 std::copy(__first, __mid, __pos);
847 _M_destroy_nodes(this->_M_impl._M_finish._M_node + 1,
848 __new_finish._M_node + 1);
849 __throw_exception_again;
854 template<
typename _Tp,
typename _Alloc>
857 _M_destroy_data_aux(iterator __first, iterator __last)
859 for (_Map_pointer __node = __first._M_node + 1;
860 __node < __last._M_node; ++__node)
862 _M_get_Tp_allocator());
864 if (__first._M_node != __last._M_node)
867 _M_get_Tp_allocator());
869 _M_get_Tp_allocator());
873 _M_get_Tp_allocator());
876 template <
typename _Tp,
typename _Alloc>
882 __throw_length_error(__N(
"deque::_M_new_elements_at_front"));
891 *(this->_M_impl._M_start._M_node - __i) = this->_M_allocate_node();
895 for (size_type __j = 1; __j < __i; ++__j)
896 _M_deallocate_node(*(this->_M_impl._M_start._M_node - __j));
897 __throw_exception_again;
901 template <
typename _Tp,
typename _Alloc>
907 __throw_length_error(__N(
"deque::_M_new_elements_at_back"));
916 *(this->_M_impl._M_finish._M_node + __i) = this->_M_allocate_node();
920 for (size_type __j = 1; __j < __i; ++__j)
921 _M_deallocate_node(*(this->_M_impl._M_finish._M_node + __j));
922 __throw_exception_again;
926 template <
typename _Tp,
typename _Alloc>
932 = this->_M_impl._M_finish._M_node - this->_M_impl._M_start._M_node + 1;
938 __new_nstart = this->_M_impl._M_map + (this->_M_impl._M_map_size
942 std::copy(this->_M_impl._M_start._M_node,
943 this->_M_impl._M_finish._M_node + 1,
946 std::copy_backward(this->_M_impl._M_start._M_node,
947 this->_M_impl._M_finish._M_node + 1,
953 +
std::max(this->_M_impl._M_map_size,
959 std::copy(this->_M_impl._M_start._M_node,
960 this->_M_impl._M_finish._M_node + 1,
962 _M_deallocate_map(this->_M_impl._M_map,
this->_M_impl._M_map_size);
972_GLIBCXX_END_NAMESPACE_CONTAINER
976 template<
typename _Tp,
typename _VTp>
978 __fill_a1(
const _GLIBCXX_STD_C::_Deque_iterator<_Tp, _Tp&, _Tp*>& __first,
979 const _GLIBCXX_STD_C::_Deque_iterator<_Tp, _Tp&, _Tp*>& __last,
982 typedef _GLIBCXX_STD_C::_Deque_iterator<_Tp, _Tp&, _Tp*> _Iter;
983 if (__first._M_node != __last._M_node)
985 std::__fill_a1(__first._M_cur, __first._M_last, __value);
987 for (
typename _Iter::_Map_pointer
__node = __first._M_node + 1;
989 std::__fill_a1(*
__node, *
__node + _Iter::_S_buffer_size(), __value);
991 std::__fill_a1(__last._M_first, __last._M_cur, __value);
994 std::__fill_a1(__first._M_cur, __last._M_cur, __value);
997 template<
bool _IsMove,
998 typename _Tp,
typename _Ref,
typename _Ptr,
typename _OI>
1000 __copy_move_dit(_GLIBCXX_STD_C::_Deque_iterator<_Tp, _Ref, _Ptr> __first,
1001 _GLIBCXX_STD_C::_Deque_iterator<_Tp, _Ref, _Ptr> __last,
1004 typedef _GLIBCXX_STD_C::_Deque_iterator<_Tp, _Ref, _Ptr> _Iter;
1005 if (__first._M_node != __last._M_node)
1011 for (
typename _Iter::_Map_pointer __node = __first._M_node + 1;
1012 __node != __last._M_node; ++__node)
1015 *__node + _Iter::_S_buffer_size(),
1026 template<
bool _IsMove,
1027 typename _Tp,
typename _Ref,
typename _Ptr,
typename _OI>
1029 __copy_move_a1(_GLIBCXX_STD_C::_Deque_iterator<_Tp, _Ref, _Ptr> __first,
1030 _GLIBCXX_STD_C::_Deque_iterator<_Tp, _Ref, _Ptr> __last,
1032 {
return __copy_move_dit<_IsMove>(__first, __last, __result); }
1034 template<
bool _IsMove,
1035 typename _ITp,
typename _IRef,
typename _IPtr,
typename _OTp>
1036 _GLIBCXX_STD_C::_Deque_iterator<_OTp, _OTp&, _OTp*>
1037 __copy_move_a1(_GLIBCXX_STD_C::_Deque_iterator<_ITp, _IRef, _IPtr> __first,
1038 _GLIBCXX_STD_C::_Deque_iterator<_ITp, _IRef, _IPtr> __last,
1039 _GLIBCXX_STD_C::_Deque_iterator<_OTp, _OTp&, _OTp*> __result)
1040 {
return __copy_move_dit<_IsMove>(__first, __last, __result); }
1042 template<
bool _IsMove,
typename _II,
typename _Tp>
1043 typename __gnu_cxx::__enable_if<
1044 __is_random_access_iter<_II>::__value,
1045 _GLIBCXX_STD_C::_Deque_iterator<_Tp, _Tp&, _Tp*> >::__type
1046 __copy_move_a1(_II __first, _II __last,
1047 _GLIBCXX_STD_C::_Deque_iterator<_Tp, _Tp&, _Tp*> __result)
1049 typedef _GLIBCXX_STD_C::_Deque_iterator<_Tp, _Tp&, _Tp*> _Iter;
1050 typedef typename _Iter::difference_type difference_type;
1052 difference_type __len = __last - __first;
1055 const difference_type __clen
1056 =
std::min(__len, __result._M_last - __result._M_cur);
1068 template<
bool _IsMove,
1069 typename _Tp,
typename _Ref,
typename _Ptr,
typename _OI>
1071 __copy_move_backward_dit(
1072 _GLIBCXX_STD_C::_Deque_iterator<_Tp, _Ref, _Ptr> __first,
1073 _GLIBCXX_STD_C::_Deque_iterator<_Tp, _Ref, _Ptr> __last,
1076 typedef _GLIBCXX_STD_C::_Deque_iterator<_Tp, _Ref, _Ptr> _Iter;
1077 if (__first._M_node != __last._M_node)
1080 __last._M_first, __last._M_cur, __result);
1082 for (
typename _Iter::_Map_pointer __node = __last._M_node - 1;
1083 __node != __first._M_node; --__node)
1085 *__node, *__node + _Iter::_S_buffer_size(), __result);
1088 __first._M_cur, __first._M_last, __result);
1092 __first._M_cur, __last._M_cur, __result);
1095 template<
bool _IsMove,
1096 typename _Tp,
typename _Ref,
typename _Ptr,
typename _OI>
1098 __copy_move_backward_a1(
1099 _GLIBCXX_STD_C::_Deque_iterator<_Tp, _Ref, _Ptr> __first,
1100 _GLIBCXX_STD_C::_Deque_iterator<_Tp, _Ref, _Ptr> __last,
1102 {
return __copy_move_backward_dit<_IsMove>(__first, __last, __result); }
1104 template<
bool _IsMove,
1105 typename _ITp,
typename _IRef,
typename _IPtr,
typename _OTp>
1106 _GLIBCXX_STD_C::_Deque_iterator<_OTp, _OTp&, _OTp*>
1107 __copy_move_backward_a1(
1108 _GLIBCXX_STD_C::_Deque_iterator<_ITp, _IRef, _IPtr> __first,
1109 _GLIBCXX_STD_C::_Deque_iterator<_ITp, _IRef, _IPtr> __last,
1110 _GLIBCXX_STD_C::_Deque_iterator<_OTp, _OTp&, _OTp*> __result)
1111 {
return __copy_move_backward_dit<_IsMove>(__first, __last, __result); }
1113 template<
bool _IsMove,
typename _II,
typename _Tp>
1114 typename __gnu_cxx::__enable_if<
1115 __is_random_access_iter<_II>::__value,
1116 _GLIBCXX_STD_C::_Deque_iterator<_Tp, _Tp&, _Tp*> >::__type
1117 __copy_move_backward_a1(_II __first, _II __last,
1118 _GLIBCXX_STD_C::_Deque_iterator<_Tp, _Tp&, _Tp*> __result)
1120 typedef _GLIBCXX_STD_C::_Deque_iterator<_Tp, _Tp&, _Tp*> _Iter;
1121 typedef typename _Iter::difference_type difference_type;
1123 difference_type __len = __last - __first;
1126 difference_type __rlen = __result._M_cur - __result._M_first;
1127 _Tp* __rend = __result._M_cur;
1130 __rlen = _Iter::_S_buffer_size();
1131 __rend = *(__result._M_node - 1) + __rlen;
1134 const difference_type __clen =
std::min(__len, __rlen);
1145 template<
typename _Tp,
typename _Ref,
typename _Ptr,
typename _II>
1148 const _GLIBCXX_STD_C::_Deque_iterator<_Tp, _Ref, _Ptr>& __first1,
1149 const _GLIBCXX_STD_C::_Deque_iterator<_Tp, _Ref, _Ptr>& __last1,
1152 typedef _GLIBCXX_STD_C::_Deque_iterator<_Tp, _Ref, _Ptr> _Iter;
1153 if (__first1._M_node != __last1._M_node)
1155 if (!std::__equal_aux1(__first1._M_cur, __first1._M_last, __first2))
1158 __first2 += __first1._M_last - __first1._M_cur;
1159 for (
typename _Iter::_Map_pointer __node = __first1._M_node + 1;
1160 __node != __last1._M_node;
1161 __first2 += _Iter::_S_buffer_size(), ++__node)
1162 if (!std::__equal_aux1(*__node, *__node + _Iter::_S_buffer_size(),
1166 return std::__equal_aux1(__last1._M_first, __last1._M_cur, __first2);
1169 return std::__equal_aux1(__first1._M_cur, __last1._M_cur, __first2);
1172 template<
typename _Tp,
typename _Ref,
typename _Ptr,
typename _II>
1173 typename __gnu_cxx::__enable_if<
1174 __is_random_access_iter<_II>::__value,
bool>::__type
1175 __equal_aux1(_GLIBCXX_STD_C::_Deque_iterator<_Tp, _Ref, _Ptr> __first1,
1176 _GLIBCXX_STD_C::_Deque_iterator<_Tp, _Ref, _Ptr> __last1,
1178 {
return std::__equal_dit(__first1, __last1, __first2); }
1180 template<
typename _Tp1,
typename _Ref1,
typename _Ptr1,
1181 typename _Tp2,
typename _Ref2,
typename _Ptr2>
1183 __equal_aux1(_GLIBCXX_STD_C::_Deque_iterator<_Tp1, _Ref1, _Ptr1> __first1,
1184 _GLIBCXX_STD_C::_Deque_iterator<_Tp1, _Ref1, _Ptr1> __last1,
1185 _GLIBCXX_STD_C::_Deque_iterator<_Tp2, _Ref2, _Ptr2> __first2)
1186 {
return std::__equal_dit(__first1, __last1, __first2); }
1188 template<
typename _II,
typename _Tp,
typename _Ref,
typename _Ptr>
1189 typename __gnu_cxx::__enable_if<
1190 __is_random_access_iter<_II>::__value,
bool>::__type
1191 __equal_aux1(_II __first1, _II __last1,
1192 _GLIBCXX_STD_C::_Deque_iterator<_Tp, _Ref, _Ptr> __first2)
1194 typedef _GLIBCXX_STD_C::_Deque_iterator<_Tp, _Ref, _Ptr> _Iter;
1195 typedef typename _Iter::difference_type difference_type;
1197 difference_type __len = __last1 - __first1;
1200 const difference_type __clen
1201 =
std::min(__len, __first2._M_last - __first2._M_cur);
1202 if (!std::__equal_aux1(__first1, __first1 + __clen, __first2._M_cur))
1213_GLIBCXX_END_NAMESPACE_VERSION
_Tp * end(valarray< _Tp > &__va) noexcept
Return an iterator pointing to one past the last element of the valarray.
_Tp * begin(valarray< _Tp > &__va) noexcept
Return an iterator pointing to the first element of the valarray.
constexpr const _Tp & max(const _Tp &, const _Tp &)
This does what you think it does.
constexpr const _Tp & min(const _Tp &, const _Tp &)
This does what you think it does.
constexpr iterator_traits< _Iter >::iterator_category __iterator_category(const _Iter &)
insert_iterator< _Container > inserter(_Container &__x, typename _Container::iterator __i)
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.
void _Destroy(_ForwardIterator __first, _ForwardIterator __last, _Allocator &__alloc)
A standard container using fixed-size memory allocation and constant-time manipulation of elements at...
void _M_pop_front_aux()
Helper functions for push_* and pop_*.
size_type size() const noexcept
void _M_reallocate_map(size_type __nodes_to_add, bool __add_at_front)
Memory-handling helpers for the major map.
iterator emplace(const_iterator __position, _Args &&... __args)
Inserts an object in deque before specified iterator.
allocator_type get_allocator() const noexcept
Get a copy of the memory allocation object.
void _M_fill_initialize(const value_type &__value)
Fills the deque with copies of value.
void _M_new_elements_at_back(size_type __new_elements)
Memory-handling helpers for the previous internal insert functions.
void _M_new_elements_at_front(size_type __new_elements)
Memory-handling helpers for the previous internal insert functions.
void _M_push_back_aux(_Args &&... __args)
Helper functions for push_* and pop_*.
void _M_push_front_aux(_Args &&... __args)
Helper functions for push_* and pop_*.
deque & operator=(const deque &__x)
Deque assignment operator.
void _M_pop_back_aux()
Helper functions for push_* and pop_*.
void _M_range_initialize(_InputIterator __first, _InputIterator __last, std::input_iterator_tag)
Fills the deque with whatever is in [first,last).
iterator begin() noexcept
Forward iterators support a superset of input iterator operations.
Random-access iterators support a superset of bidirectional iterator operations.