59 namespace std _GLIBCXX_VISIBILITY(default)
61 _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
63 #if __cplusplus >= 201103L
64 template <
typename _Tp,
typename _Alloc>
67 _M_default_initialize()
72 for (__cur = this->_M_impl._M_start._M_node;
73 __cur < this->_M_impl._M_finish._M_node;
75 std::__uninitialized_default_a(*__cur, *__cur + _S_buffer_size(),
76 _M_get_Tp_allocator());
77 std::__uninitialized_default_a(this->_M_impl._M_finish._M_first,
78 this->_M_impl._M_finish._M_cur,
79 _M_get_Tp_allocator());
83 std::_Destroy(this->_M_impl._M_start, iterator(*__cur, __cur),
84 _M_get_Tp_allocator());
85 __throw_exception_again;
90 template <
typename _Tp,
typename _Alloc>
95 const size_type __len =
size();
98 if (__len >= __x.
size())
99 _M_erase_at_end(std::copy(__x.
begin(), __x.
end(),
100 this->_M_impl._M_start));
104 std::copy(__x.
begin(), __mid, this->_M_impl._M_start);
105 insert(this->_M_impl._M_finish, __mid, __x.
end());
111 #if __cplusplus >= 201103L
112 template<
typename _Tp,
typename _Alloc>
113 template<
typename... _Args>
118 if (this->_M_impl._M_start._M_cur != this->_M_impl._M_start._M_first)
120 this->_M_impl.construct(this->_M_impl._M_start._M_cur - 1,
121 std::forward<_Args>(__args)...);
122 --this->_M_impl._M_start._M_cur;
125 _M_push_front_aux(std::forward<_Args>(__args)...);
128 template<
typename _Tp,
typename _Alloc>
129 template<
typename... _Args>
132 emplace_back(_Args&&... __args)
134 if (this->_M_impl._M_finish._M_cur
135 != this->_M_impl._M_finish._M_last - 1)
137 this->_M_impl.construct(this->_M_impl._M_finish._M_cur,
138 std::forward<_Args>(__args)...);
139 ++this->_M_impl._M_finish._M_cur;
142 _M_push_back_aux(std::forward<_Args>(__args)...);
146 template <
typename _Tp,
typename _Alloc>
147 typename deque<_Tp, _Alloc>::iterator
151 if (__position._M_cur == this->_M_impl._M_start._M_cur)
154 return this->_M_impl._M_start;
156 else if (__position._M_cur == this->_M_impl._M_finish._M_cur)
159 iterator __tmp = this->_M_impl._M_finish;
164 return _M_insert_aux(__position, __x);
167 #if __cplusplus >= 201103L
168 template<
typename _Tp,
typename _Alloc>
169 template<
typename... _Args>
174 if (__position._M_cur == this->_M_impl._M_start._M_cur)
176 emplace_front(std::forward<_Args>(__args)...);
177 return this->_M_impl._M_start;
179 else if (__position._M_cur == this->_M_impl._M_finish._M_cur)
181 emplace_back(std::forward<_Args>(__args)...);
182 iterator __tmp = this->_M_impl._M_finish;
187 return _M_insert_aux(__position, std::forward<_Args>(__args)...);
191 template <
typename _Tp,
typename _Alloc>
192 typename deque<_Tp, _Alloc>::iterator
198 const difference_type __index = __position -
begin();
199 if (static_cast<size_type>(__index) < (
size() >> 1))
201 if (__position !=
begin())
202 _GLIBCXX_MOVE_BACKWARD3(
begin(), __position, __next);
208 _GLIBCXX_MOVE3(__next,
end(), __position);
211 return begin() + __index;
214 template <
typename _Tp,
typename _Alloc>
219 if (__first == __last)
221 else if (__first ==
begin() && __last ==
end())
228 const difference_type __n = __last - __first;
229 const difference_type __elems_before = __first -
begin();
230 if (static_cast<size_type>(__elems_before) <= (
size() - __n) / 2)
232 if (__first !=
begin())
233 _GLIBCXX_MOVE_BACKWARD3(
begin(), __first, __last);
234 _M_erase_at_begin(
begin() + __n);
239 _GLIBCXX_MOVE3(__last,
end(), __first);
240 _M_erase_at_end(
end() - __n);
242 return begin() + __elems_before;
246 template <
typename _Tp,
class _Alloc>
247 template <
typename _InputIterator>
254 for (; __first != __last && __cur !=
end(); ++__cur, ++__first)
256 if (__first == __last)
257 _M_erase_at_end(__cur);
259 insert(
end(), __first, __last);
262 template <
typename _Tp,
typename _Alloc>
265 _M_fill_insert(iterator __pos, size_type __n,
const value_type& __x)
267 if (__pos._M_cur == this->_M_impl._M_start._M_cur)
269 iterator __new_start = _M_reserve_elements_at_front(__n);
272 std::__uninitialized_fill_a(__new_start, this->_M_impl._M_start,
273 __x, _M_get_Tp_allocator());
274 this->_M_impl._M_start = __new_start;
278 _M_destroy_nodes(__new_start._M_node,
279 this->_M_impl._M_start._M_node);
280 __throw_exception_again;
283 else if (__pos._M_cur == this->_M_impl._M_finish._M_cur)
285 iterator __new_finish = _M_reserve_elements_at_back(__n);
288 std::__uninitialized_fill_a(this->_M_impl._M_finish,
290 _M_get_Tp_allocator());
291 this->_M_impl._M_finish = __new_finish;
295 _M_destroy_nodes(this->_M_impl._M_finish._M_node + 1,
296 __new_finish._M_node + 1);
297 __throw_exception_again;
301 _M_insert_aux(__pos, __n, __x);
304 #if __cplusplus >= 201103L
305 template <
typename _Tp,
typename _Alloc>
308 _M_default_append(size_type __n)
312 iterator __new_finish = _M_reserve_elements_at_back(__n);
315 std::__uninitialized_default_a(this->_M_impl._M_finish,
317 _M_get_Tp_allocator());
318 this->_M_impl._M_finish = __new_finish;
322 _M_destroy_nodes(this->_M_impl._M_finish._M_node + 1,
323 __new_finish._M_node + 1);
324 __throw_exception_again;
329 template <
typename _Tp,
typename _Alloc>
334 const difference_type __front_capacity
335 = (this->_M_impl._M_start._M_cur - this->_M_impl._M_start._M_first);
336 if (__front_capacity == 0)
339 const difference_type __back_capacity
340 = (this->_M_impl._M_finish._M_last - this->_M_impl._M_finish._M_cur);
341 if (__front_capacity + __back_capacity < _S_buffer_size())
344 return std::__shrink_to_fit_aux<deque>::_S_do_it(*
this);
348 template <
typename _Tp,
typename _Alloc>
356 for (__cur = this->_M_impl._M_start._M_node;
357 __cur < this->_M_impl._M_finish._M_node;
359 std::__uninitialized_fill_a(*__cur, *__cur + _S_buffer_size(),
360 __value, _M_get_Tp_allocator());
361 std::__uninitialized_fill_a(this->_M_impl._M_finish._M_first,
362 this->_M_impl._M_finish._M_cur,
363 __value, _M_get_Tp_allocator());
368 _M_get_Tp_allocator());
369 __throw_exception_again;
373 template <
typename _Tp,
typename _Alloc>
374 template <
typename _InputIterator>
380 this->_M_initialize_map(0);
383 for (; __first != __last; ++__first)
384 #
if __cplusplus >= 201103L
385 emplace_back(*__first);
393 __throw_exception_again;
397 template <
typename _Tp,
typename _Alloc>
398 template <
typename _ForwardIterator>
405 this->_M_initialize_map(__n);
407 _Map_pointer __cur_node;
410 for (__cur_node = this->_M_impl._M_start._M_node;
411 __cur_node < this->_M_impl._M_finish._M_node;
414 _ForwardIterator __mid = __first;
416 std::__uninitialized_copy_a(__first, __mid, *__cur_node,
417 _M_get_Tp_allocator());
420 std::__uninitialized_copy_a(__first, __last,
421 this->_M_impl._M_finish._M_first,
422 _M_get_Tp_allocator());
428 _M_get_Tp_allocator());
429 __throw_exception_again;
434 template<
typename _Tp,
typename _Alloc>
435 #if __cplusplus >= 201103L
436 template<
typename... _Args>
446 _M_reserve_map_at_back();
447 *(this->_M_impl._M_finish._M_node + 1) = this->_M_allocate_node();
450 #if __cplusplus >= 201103L
451 this->_M_impl.construct(this->_M_impl._M_finish._M_cur,
452 std::forward<_Args>(__args)...);
454 this->_M_impl.construct(this->_M_impl._M_finish._M_cur, __t);
456 this->_M_impl._M_finish._M_set_node(this->_M_impl._M_finish._M_node
458 this->_M_impl._M_finish._M_cur = this->_M_impl._M_finish._M_first;
462 _M_deallocate_node(*(this->_M_impl._M_finish._M_node + 1));
463 __throw_exception_again;
468 template<
typename _Tp,
typename _Alloc>
469 #if __cplusplus >= 201103L
470 template<
typename... _Args>
480 _M_reserve_map_at_front();
481 *(this->_M_impl._M_start._M_node - 1) = this->_M_allocate_node();
484 this->_M_impl._M_start._M_set_node(this->_M_impl._M_start._M_node
486 this->_M_impl._M_start._M_cur = this->_M_impl._M_start._M_last - 1;
487 #if __cplusplus >= 201103L
488 this->_M_impl.construct(this->_M_impl._M_start._M_cur,
489 std::forward<_Args>(__args)...);
491 this->_M_impl.construct(this->_M_impl._M_start._M_cur, __t);
496 ++this->_M_impl._M_start;
497 _M_deallocate_node(*(this->_M_impl._M_start._M_node - 1));
498 __throw_exception_again;
503 template <
typename _Tp,
typename _Alloc>
507 _M_deallocate_node(this->_M_impl._M_finish._M_first);
508 this->_M_impl._M_finish._M_set_node(this->_M_impl._M_finish._M_node - 1);
509 this->_M_impl._M_finish._M_cur = this->_M_impl._M_finish._M_last - 1;
510 this->_M_impl.destroy(this->_M_impl._M_finish._M_cur);
518 template <
typename _Tp,
typename _Alloc>
522 this->_M_impl.destroy(this->_M_impl._M_start._M_cur);
523 _M_deallocate_node(this->_M_impl._M_start._M_first);
524 this->_M_impl._M_start._M_set_node(this->_M_impl._M_start._M_node + 1);
525 this->_M_impl._M_start._M_cur = this->_M_impl._M_start._M_first;
528 template <
typename _Tp,
typename _Alloc>
529 template <
typename _InputIterator>
533 _InputIterator __first, _InputIterator __last,
537 template <
typename _Tp,
typename _Alloc>
538 template <
typename _ForwardIterator>
541 _M_range_insert_aux(iterator __pos,
542 _ForwardIterator __first, _ForwardIterator __last,
546 if (__pos._M_cur == this->_M_impl._M_start._M_cur)
548 iterator __new_start = _M_reserve_elements_at_front(__n);
551 std::__uninitialized_copy_a(__first, __last, __new_start,
552 _M_get_Tp_allocator());
553 this->_M_impl._M_start = __new_start;
557 _M_destroy_nodes(__new_start._M_node,
558 this->_M_impl._M_start._M_node);
559 __throw_exception_again;
562 else if (__pos._M_cur == this->_M_impl._M_finish._M_cur)
564 iterator __new_finish = _M_reserve_elements_at_back(__n);
567 std::__uninitialized_copy_a(__first, __last,
568 this->_M_impl._M_finish,
569 _M_get_Tp_allocator());
570 this->_M_impl._M_finish = __new_finish;
574 _M_destroy_nodes(this->_M_impl._M_finish._M_node + 1,
575 __new_finish._M_node + 1);
576 __throw_exception_again;
580 _M_insert_aux(__pos, __first, __last, __n);
583 template<
typename _Tp,
typename _Alloc>
584 #if __cplusplus >= 201103L
585 template<
typename... _Args>
586 typename deque<_Tp, _Alloc>::iterator
588 _M_insert_aux(iterator __pos, _Args&&... __args)
590 value_type __x_copy(std::forward<_Args>(__args)...);
592 typename deque<_Tp, _Alloc>::iterator
594 _M_insert_aux(iterator __pos,
const value_type& __x)
596 value_type __x_copy = __x;
598 difference_type __index = __pos - this->_M_impl._M_start;
599 if (static_cast<size_type>(__index) <
size() / 2)
601 push_front(_GLIBCXX_MOVE(front()));
602 iterator __front1 = this->_M_impl._M_start;
604 iterator __front2 = __front1;
606 __pos = this->_M_impl._M_start + __index;
607 iterator __pos1 = __pos;
609 _GLIBCXX_MOVE3(__front2, __pos1, __front1);
613 push_back(_GLIBCXX_MOVE(back()));
614 iterator __back1 = this->_M_impl._M_finish;
616 iterator __back2 = __back1;
618 __pos = this->_M_impl._M_start + __index;
619 _GLIBCXX_MOVE_BACKWARD3(__pos, __back2, __back1);
621 *__pos = _GLIBCXX_MOVE(__x_copy);
625 template <
typename _Tp,
typename _Alloc>
628 _M_insert_aux(iterator __pos, size_type __n,
const value_type& __x)
630 const difference_type __elems_before = __pos - this->_M_impl._M_start;
631 const size_type __length = this->
size();
632 value_type __x_copy = __x;
633 if (__elems_before < difference_type(__length / 2))
635 iterator __new_start = _M_reserve_elements_at_front(__n);
636 iterator __old_start = this->_M_impl._M_start;
637 __pos = this->_M_impl._M_start + __elems_before;
640 if (__elems_before >= difference_type(__n))
642 iterator __start_n = (this->_M_impl._M_start
643 + difference_type(__n));
644 std::__uninitialized_move_a(this->_M_impl._M_start,
645 __start_n, __new_start,
646 _M_get_Tp_allocator());
647 this->_M_impl._M_start = __new_start;
648 _GLIBCXX_MOVE3(__start_n, __pos, __old_start);
649 std::fill(__pos - difference_type(__n), __pos, __x_copy);
653 std::__uninitialized_move_fill(this->_M_impl._M_start,
655 this->_M_impl._M_start,
657 _M_get_Tp_allocator());
658 this->_M_impl._M_start = __new_start;
659 std::fill(__old_start, __pos, __x_copy);
664 _M_destroy_nodes(__new_start._M_node,
665 this->_M_impl._M_start._M_node);
666 __throw_exception_again;
671 iterator __new_finish = _M_reserve_elements_at_back(__n);
672 iterator __old_finish = this->_M_impl._M_finish;
673 const difference_type __elems_after =
674 difference_type(__length) - __elems_before;
675 __pos = this->_M_impl._M_finish - __elems_after;
678 if (__elems_after > difference_type(__n))
680 iterator __finish_n = (this->_M_impl._M_finish
681 - difference_type(__n));
682 std::__uninitialized_move_a(__finish_n,
683 this->_M_impl._M_finish,
684 this->_M_impl._M_finish,
685 _M_get_Tp_allocator());
686 this->_M_impl._M_finish = __new_finish;
687 _GLIBCXX_MOVE_BACKWARD3(__pos, __finish_n, __old_finish);
688 std::fill(__pos, __pos + difference_type(__n), __x_copy);
692 std::__uninitialized_fill_move(this->_M_impl._M_finish,
693 __pos + difference_type(__n),
695 this->_M_impl._M_finish,
696 _M_get_Tp_allocator());
697 this->_M_impl._M_finish = __new_finish;
698 std::fill(__pos, __old_finish, __x_copy);
703 _M_destroy_nodes(this->_M_impl._M_finish._M_node + 1,
704 __new_finish._M_node + 1);
705 __throw_exception_again;
710 template <
typename _Tp,
typename _Alloc>
711 template <
typename _ForwardIterator>
714 _M_insert_aux(iterator __pos,
715 _ForwardIterator __first, _ForwardIterator __last,
718 const difference_type __elemsbefore = __pos - this->_M_impl._M_start;
719 const size_type __length =
size();
720 if (static_cast<size_type>(__elemsbefore) < __length / 2)
722 iterator __new_start = _M_reserve_elements_at_front(__n);
723 iterator __old_start = this->_M_impl._M_start;
724 __pos = this->_M_impl._M_start + __elemsbefore;
727 if (__elemsbefore >= difference_type(__n))
729 iterator __start_n = (this->_M_impl._M_start
730 + difference_type(__n));
731 std::__uninitialized_move_a(this->_M_impl._M_start,
732 __start_n, __new_start,
733 _M_get_Tp_allocator());
734 this->_M_impl._M_start = __new_start;
735 _GLIBCXX_MOVE3(__start_n, __pos, __old_start);
736 std::copy(__first, __last, __pos - difference_type(__n));
740 _ForwardIterator __mid = __first;
741 std::advance(__mid, difference_type(__n) - __elemsbefore);
742 std::__uninitialized_move_copy(this->_M_impl._M_start,
743 __pos, __first, __mid,
745 _M_get_Tp_allocator());
746 this->_M_impl._M_start = __new_start;
747 std::copy(__mid, __last, __old_start);
752 _M_destroy_nodes(__new_start._M_node,
753 this->_M_impl._M_start._M_node);
754 __throw_exception_again;
759 iterator __new_finish = _M_reserve_elements_at_back(__n);
760 iterator __old_finish = this->_M_impl._M_finish;
761 const difference_type __elemsafter =
762 difference_type(__length) - __elemsbefore;
763 __pos = this->_M_impl._M_finish - __elemsafter;
766 if (__elemsafter > difference_type(__n))
768 iterator __finish_n = (this->_M_impl._M_finish
769 - difference_type(__n));
770 std::__uninitialized_move_a(__finish_n,
771 this->_M_impl._M_finish,
772 this->_M_impl._M_finish,
773 _M_get_Tp_allocator());
774 this->_M_impl._M_finish = __new_finish;
775 _GLIBCXX_MOVE_BACKWARD3(__pos, __finish_n, __old_finish);
776 std::copy(__first, __last, __pos);
780 _ForwardIterator __mid = __first;
782 std::__uninitialized_copy_move(__mid, __last, __pos,
783 this->_M_impl._M_finish,
784 this->_M_impl._M_finish,
785 _M_get_Tp_allocator());
786 this->_M_impl._M_finish = __new_finish;
787 std::copy(__first, __mid, __pos);
792 _M_destroy_nodes(this->_M_impl._M_finish._M_node + 1,
793 __new_finish._M_node + 1);
794 __throw_exception_again;
799 template<
typename _Tp,
typename _Alloc>
802 _M_destroy_data_aux(iterator __first, iterator __last)
804 for (_Map_pointer __node = __first._M_node + 1;
805 __node < __last._M_node; ++__node)
807 _M_get_Tp_allocator());
809 if (__first._M_node != __last._M_node)
812 _M_get_Tp_allocator());
814 _M_get_Tp_allocator());
818 _M_get_Tp_allocator());
821 template <
typename _Tp,
typename _Alloc>
826 if (this->max_size() - this->
size() < __new_elems)
827 __throw_length_error(__N(
"deque::_M_new_elements_at_front"));
829 const size_type __new_nodes = ((__new_elems + _S_buffer_size() - 1)
831 _M_reserve_map_at_front(__new_nodes);
835 for (__i = 1; __i <= __new_nodes; ++__i)
836 *(this->_M_impl._M_start._M_node - __i) = this->_M_allocate_node();
840 for (size_type __j = 1; __j < __i; ++__j)
841 _M_deallocate_node(*(this->_M_impl._M_start._M_node - __j));
842 __throw_exception_again;
846 template <
typename _Tp,
typename _Alloc>
851 if (this->max_size() - this->
size() < __new_elems)
852 __throw_length_error(__N(
"deque::_M_new_elements_at_back"));
854 const size_type __new_nodes = ((__new_elems + _S_buffer_size() - 1)
856 _M_reserve_map_at_back(__new_nodes);
860 for (__i = 1; __i <= __new_nodes; ++__i)
861 *(this->_M_impl._M_finish._M_node + __i) = this->_M_allocate_node();
865 for (size_type __j = 1; __j < __i; ++__j)
866 _M_deallocate_node(*(this->_M_impl._M_finish._M_node + __j));
867 __throw_exception_again;
871 template <
typename _Tp,
typename _Alloc>
876 const size_type __old_num_nodes
877 = this->_M_impl._M_finish._M_node - this->_M_impl._M_start._M_node + 1;
878 const size_type __new_num_nodes = __old_num_nodes + __nodes_to_add;
880 _Map_pointer __new_nstart;
881 if (this->_M_impl._M_map_size > 2 * __new_num_nodes)
883 __new_nstart = this->_M_impl._M_map + (this->_M_impl._M_map_size
884 - __new_num_nodes) / 2
885 + (__add_at_front ? __nodes_to_add : 0);
886 if (__new_nstart < this->_M_impl._M_start._M_node)
887 std::copy(this->_M_impl._M_start._M_node,
888 this->_M_impl._M_finish._M_node + 1,
891 std::copy_backward(this->_M_impl._M_start._M_node,
892 this->_M_impl._M_finish._M_node + 1,
893 __new_nstart + __old_num_nodes);
897 size_type __new_map_size = this->_M_impl._M_map_size
898 +
std::max(this->_M_impl._M_map_size,
901 _Map_pointer __new_map = this->_M_allocate_map(__new_map_size);
902 __new_nstart = __new_map + (__new_map_size - __new_num_nodes) / 2
903 + (__add_at_front ? __nodes_to_add : 0);
904 std::copy(this->_M_impl._M_start._M_node,
905 this->_M_impl._M_finish._M_node + 1,
907 _M_deallocate_map(this->_M_impl._M_map, this->_M_impl._M_map_size);
909 this->_M_impl._M_map = __new_map;
910 this->_M_impl._M_map_size = __new_map_size;
913 this->_M_impl._M_start._M_set_node(__new_nstart);
914 this->_M_impl._M_finish._M_set_node(__new_nstart + __old_num_nodes - 1);
919 template<
typename _Tp>
926 for (
typename _Self::_Map_pointer __node = __first._M_node + 1;
927 __node < __last._M_node; ++__node)
928 std::fill(*__node, *__node + _Self::_S_buffer_size(), __value);
930 if (__first._M_node != __last._M_node)
932 std::fill(__first._M_cur, __first._M_last, __value);
933 std::fill(__last._M_first, __last._M_cur, __value);
936 std::fill(__first._M_cur, __last._M_cur, __value);
939 template<
typename _Tp>
940 _Deque_iterator<_Tp, _Tp&, _Tp*>
941 copy(_Deque_iterator<_Tp, const _Tp&, const _Tp*> __first,
942 _Deque_iterator<_Tp, const _Tp&, const _Tp*> __last,
943 _Deque_iterator<_Tp, _Tp&, _Tp*> __result)
945 typedef typename _Deque_iterator<_Tp, _Tp&, _Tp*>::_Self _Self;
946 typedef typename _Self::difference_type difference_type;
948 difference_type __len = __last - __first;
951 const difference_type __clen
953 __result._M_last - __result._M_cur));
954 std::copy(__first._M_cur, __first._M_cur + __clen, __result._M_cur);
962 template<
typename _Tp>
963 _Deque_iterator<_Tp, _Tp&, _Tp*>
964 copy_backward(_Deque_iterator<_Tp, const _Tp&, const _Tp*> __first,
965 _Deque_iterator<_Tp, const _Tp&, const _Tp*> __last,
966 _Deque_iterator<_Tp, _Tp&, _Tp*> __result)
968 typedef typename _Deque_iterator<_Tp, _Tp&, _Tp*>::_Self _Self;
969 typedef typename _Self::difference_type difference_type;
971 difference_type __len = __last - __first;
974 difference_type __llen = __last._M_cur - __last._M_first;
975 _Tp* __lend = __last._M_cur;
977 difference_type __rlen = __result._M_cur - __result._M_first;
978 _Tp* __rend = __result._M_cur;
982 __llen = _Self::_S_buffer_size();
983 __lend = *(__last._M_node - 1) + __llen;
987 __rlen = _Self::_S_buffer_size();
988 __rend = *(__result._M_node - 1) + __rlen;
991 const difference_type __clen =
std::min(__len,
993 std::copy_backward(__lend - __clen, __lend, __rend);
1001 #if __cplusplus >= 201103L
1002 template<
typename _Tp>
1003 _Deque_iterator<_Tp, _Tp&, _Tp*>
1004 move(_Deque_iterator<_Tp, const _Tp&, const _Tp*> __first,
1005 _Deque_iterator<_Tp, const _Tp&, const _Tp*> __last,
1006 _Deque_iterator<_Tp, _Tp&, _Tp*> __result)
1008 typedef typename _Deque_iterator<_Tp, _Tp&, _Tp*>::_Self _Self;
1009 typedef typename _Self::difference_type difference_type;
1011 difference_type __len = __last - __first;
1014 const difference_type __clen
1016 __result._M_last - __result._M_cur));
1017 std::move(__first._M_cur, __first._M_cur + __clen, __result._M_cur);
1025 template<
typename _Tp>
1026 _Deque_iterator<_Tp, _Tp&, _Tp*>
1027 move_backward(_Deque_iterator<_Tp, const _Tp&, const _Tp*> __first,
1028 _Deque_iterator<_Tp, const _Tp&, const _Tp*> __last,
1029 _Deque_iterator<_Tp, _Tp&, _Tp*> __result)
1031 typedef typename _Deque_iterator<_Tp, _Tp&, _Tp*>::_Self _Self;
1032 typedef typename _Self::difference_type difference_type;
1034 difference_type __len = __last - __first;
1037 difference_type __llen = __last._M_cur - __last._M_first;
1038 _Tp* __lend = __last._M_cur;
1040 difference_type __rlen = __result._M_cur - __result._M_first;
1041 _Tp* __rend = __result._M_cur;
1045 __llen = _Self::_S_buffer_size();
1046 __lend = *(__last._M_node - 1) + __llen;
1050 __rlen = _Self::_S_buffer_size();
1051 __rend = *(__result._M_node - 1) + __rlen;
1054 const difference_type __clen =
std::min(__len,
1056 std::move_backward(__lend - __clen, __lend, __rend);
1065 _GLIBCXX_END_NAMESPACE_CONTAINER
A standard container using fixed-size memory allocation and constant-time manipulation of elements at...
void advance(_InputIterator &__i, _Distance __n)
A generalization of pointer arithmetic.
void _M_fill_initialize(const value_type &__value)
Fills the deque with copies of value.
void _M_range_initialize(_InputIterator __first, _InputIterator __last, std::input_iterator_tag)
Fills the deque with whatever is in [first,last).
void _M_new_elements_at_front(size_type __new_elements)
Memory-handling helpers for the previous internal insert functions.
constexpr const _Tp * end(initializer_list< _Tp > __ils) noexcept
Return an iterator pointing to one past the last element of the initilizer_list.
void _Destroy(_Tp *__pointer)
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.
iterator_traits< _InputIterator >::difference_type distance(_InputIterator __first, _InputIterator __last)
A generalization of pointer arithmetic.
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.
Forward iterators support a superset of input iterator operations.
void _M_pop_back_aux()
Helper functions for push_* and pop_*.
iterator erase(iterator __position)
Remove element at given position.
constexpr size_t size() const noexcept
Returns the total number of bits.
void _M_pop_front_aux()
Helper functions for push_* and pop_*.
const _Tp & max(const _Tp &, const _Tp &)
This does what you think it does.
iterator insert(iterator __position, const value_type &__x)
Inserts given value into deque before specified iterator.
insert_iterator< _Container > inserter(_Container &__x, _Iterator __i)
iterator emplace(iterator __position, _Args &&...__args)
Inserts an object in deque before specified iterator.
iterator begin() noexcept
constexpr const _Tp * begin(initializer_list< _Tp > __ils) noexcept
Return an iterator pointing to the first element of the initilizer_list.
const _Tp & min(const _Tp &, const _Tp &)
This does what you think it does.
void _M_new_elements_at_back(size_type __new_elements)
Memory-handling helpers for the previous internal insert functions.