61 namespace std _GLIBCXX_VISIBILITY(default)
63 _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
65 #ifdef __GXX_EXPERIMENTAL_CXX0X__
66 template <
typename _Tp,
typename _Alloc>
69 _M_default_initialize()
74 for (__cur = this->_M_impl._M_start._M_node;
75 __cur < this->_M_impl._M_finish._M_node;
77 std::__uninitialized_default_a(*__cur, *__cur + _S_buffer_size(),
78 _M_get_Tp_allocator());
79 std::__uninitialized_default_a(this->_M_impl._M_finish._M_first,
80 this->_M_impl._M_finish._M_cur,
81 _M_get_Tp_allocator());
85 std::_Destroy(this->_M_impl._M_start, iterator(*__cur, __cur),
86 _M_get_Tp_allocator());
87 __throw_exception_again;
92 template <
typename _Tp,
typename _Alloc>
97 const size_type __len =
size();
100 if (__len >= __x.
size())
101 _M_erase_at_end(std::copy(__x.
begin(), __x.
end(),
102 this->_M_impl._M_start));
106 std::copy(__x.
begin(), __mid, this->_M_impl._M_start);
107 insert(this->_M_impl._M_finish, __mid, __x.
end());
113 #ifdef __GXX_EXPERIMENTAL_CXX0X__
114 template<
typename _Tp,
typename _Alloc>
115 template<
typename... _Args>
120 if (this->_M_impl._M_start._M_cur != this->_M_impl._M_start._M_first)
122 this->_M_impl.construct(this->_M_impl._M_start._M_cur - 1,
123 std::forward<_Args>(__args)...);
124 --this->_M_impl._M_start._M_cur;
127 _M_push_front_aux(std::forward<_Args>(__args)...);
130 template<
typename _Tp,
typename _Alloc>
131 template<
typename... _Args>
134 emplace_back(_Args&&... __args)
136 if (this->_M_impl._M_finish._M_cur
137 != this->_M_impl._M_finish._M_last - 1)
139 this->_M_impl.construct(this->_M_impl._M_finish._M_cur,
140 std::forward<_Args>(__args)...);
141 ++this->_M_impl._M_finish._M_cur;
144 _M_push_back_aux(std::forward<_Args>(__args)...);
148 template <
typename _Tp,
typename _Alloc>
149 typename deque<_Tp, _Alloc>::iterator
153 if (__position._M_cur == this->_M_impl._M_start._M_cur)
156 return this->_M_impl._M_start;
158 else if (__position._M_cur == this->_M_impl._M_finish._M_cur)
161 iterator __tmp = this->_M_impl._M_finish;
166 return _M_insert_aux(__position, __x);
169 #ifdef __GXX_EXPERIMENTAL_CXX0X__
170 template<
typename _Tp,
typename _Alloc>
171 template<
typename... _Args>
176 if (__position._M_cur == this->_M_impl._M_start._M_cur)
178 push_front(std::forward<_Args>(__args)...);
179 return this->_M_impl._M_start;
181 else if (__position._M_cur == this->_M_impl._M_finish._M_cur)
183 push_back(std::forward<_Args>(__args)...);
184 iterator __tmp = this->_M_impl._M_finish;
189 return _M_insert_aux(__position, std::forward<_Args>(__args)...);
193 template <
typename _Tp,
typename _Alloc>
194 typename deque<_Tp, _Alloc>::iterator
200 const difference_type __index = __position -
begin();
201 if (static_cast<size_type>(__index) < (
size() >> 1))
203 if (__position !=
begin())
204 _GLIBCXX_MOVE_BACKWARD3(
begin(), __position, __next);
210 _GLIBCXX_MOVE3(__next,
end(), __position);
213 return begin() + __index;
216 template <
typename _Tp,
typename _Alloc>
221 if (__first == __last)
223 else if (__first ==
begin() && __last ==
end())
230 const difference_type __n = __last - __first;
231 const difference_type __elems_before = __first -
begin();
232 if (static_cast<size_type>(__elems_before) <= (
size() - __n) / 2)
234 if (__first !=
begin())
235 _GLIBCXX_MOVE_BACKWARD3(
begin(), __first, __last);
236 _M_erase_at_begin(
begin() + __n);
241 _GLIBCXX_MOVE3(__last,
end(), __first);
242 _M_erase_at_end(
end() - __n);
244 return begin() + __elems_before;
248 template <
typename _Tp,
class _Alloc>
249 template <
typename _InputIterator>
256 for (; __first != __last && __cur !=
end(); ++__cur, ++__first)
258 if (__first == __last)
259 _M_erase_at_end(__cur);
261 insert(
end(), __first, __last);
264 template <
typename _Tp,
typename _Alloc>
267 _M_fill_insert(iterator __pos, size_type __n,
const value_type& __x)
269 if (__pos._M_cur == this->_M_impl._M_start._M_cur)
271 iterator __new_start = _M_reserve_elements_at_front(__n);
274 std::__uninitialized_fill_a(__new_start, this->_M_impl._M_start,
275 __x, _M_get_Tp_allocator());
276 this->_M_impl._M_start = __new_start;
280 _M_destroy_nodes(__new_start._M_node,
281 this->_M_impl._M_start._M_node);
282 __throw_exception_again;
285 else if (__pos._M_cur == this->_M_impl._M_finish._M_cur)
287 iterator __new_finish = _M_reserve_elements_at_back(__n);
290 std::__uninitialized_fill_a(this->_M_impl._M_finish,
292 _M_get_Tp_allocator());
293 this->_M_impl._M_finish = __new_finish;
297 _M_destroy_nodes(this->_M_impl._M_finish._M_node + 1,
298 __new_finish._M_node + 1);
299 __throw_exception_again;
303 _M_insert_aux(__pos, __n, __x);
306 #ifdef __GXX_EXPERIMENTAL_CXX0X__
307 template <
typename _Tp,
typename _Alloc>
310 _M_default_append(size_type __n)
314 iterator __new_finish = _M_reserve_elements_at_back(__n);
317 std::__uninitialized_default_a(this->_M_impl._M_finish,
319 _M_get_Tp_allocator());
320 this->_M_impl._M_finish = __new_finish;
324 _M_destroy_nodes(this->_M_impl._M_finish._M_node + 1,
325 __new_finish._M_node + 1);
326 __throw_exception_again;
332 template <
typename _Tp,
typename _Alloc>
340 for (__cur = this->_M_impl._M_start._M_node;
341 __cur < this->_M_impl._M_finish._M_node;
343 std::__uninitialized_fill_a(*__cur, *__cur + _S_buffer_size(),
344 __value, _M_get_Tp_allocator());
345 std::__uninitialized_fill_a(this->_M_impl._M_finish._M_first,
346 this->_M_impl._M_finish._M_cur,
347 __value, _M_get_Tp_allocator());
352 _M_get_Tp_allocator());
353 __throw_exception_again;
357 template <
typename _Tp,
typename _Alloc>
358 template <
typename _InputIterator>
364 this->_M_initialize_map(0);
367 for (; __first != __last; ++__first)
373 __throw_exception_again;
377 template <
typename _Tp,
typename _Alloc>
378 template <
typename _ForwardIterator>
385 this->_M_initialize_map(__n);
387 _Map_pointer __cur_node;
390 for (__cur_node = this->_M_impl._M_start._M_node;
391 __cur_node < this->_M_impl._M_finish._M_node;
394 _ForwardIterator __mid = __first;
396 std::__uninitialized_copy_a(__first, __mid, *__cur_node,
397 _M_get_Tp_allocator());
400 std::__uninitialized_copy_a(__first, __last,
401 this->_M_impl._M_finish._M_first,
402 _M_get_Tp_allocator());
408 _M_get_Tp_allocator());
409 __throw_exception_again;
414 template<
typename _Tp,
typename _Alloc>
415 #ifdef __GXX_EXPERIMENTAL_CXX0X__
416 template<
typename... _Args>
426 _M_reserve_map_at_back();
427 *(this->_M_impl._M_finish._M_node + 1) = this->_M_allocate_node();
430 #ifdef __GXX_EXPERIMENTAL_CXX0X__
431 this->_M_impl.construct(this->_M_impl._M_finish._M_cur,
432 std::forward<_Args>(__args)...);
434 this->_M_impl.construct(this->_M_impl._M_finish._M_cur, __t);
436 this->_M_impl._M_finish._M_set_node(this->_M_impl._M_finish._M_node
438 this->_M_impl._M_finish._M_cur = this->_M_impl._M_finish._M_first;
442 _M_deallocate_node(*(this->_M_impl._M_finish._M_node + 1));
443 __throw_exception_again;
448 template<
typename _Tp,
typename _Alloc>
449 #ifdef __GXX_EXPERIMENTAL_CXX0X__
450 template<
typename... _Args>
460 _M_reserve_map_at_front();
461 *(this->_M_impl._M_start._M_node - 1) = this->_M_allocate_node();
464 this->_M_impl._M_start._M_set_node(this->_M_impl._M_start._M_node
466 this->_M_impl._M_start._M_cur = this->_M_impl._M_start._M_last - 1;
467 #ifdef __GXX_EXPERIMENTAL_CXX0X__
468 this->_M_impl.construct(this->_M_impl._M_start._M_cur,
469 std::forward<_Args>(__args)...);
471 this->_M_impl.construct(this->_M_impl._M_start._M_cur, __t);
476 ++this->_M_impl._M_start;
477 _M_deallocate_node(*(this->_M_impl._M_start._M_node - 1));
478 __throw_exception_again;
483 template <
typename _Tp,
typename _Alloc>
487 _M_deallocate_node(this->_M_impl._M_finish._M_first);
488 this->_M_impl._M_finish._M_set_node(this->_M_impl._M_finish._M_node - 1);
489 this->_M_impl._M_finish._M_cur = this->_M_impl._M_finish._M_last - 1;
490 this->_M_impl.destroy(this->_M_impl._M_finish._M_cur);
498 template <
typename _Tp,
typename _Alloc>
502 this->_M_impl.destroy(this->_M_impl._M_start._M_cur);
503 _M_deallocate_node(this->_M_impl._M_start._M_first);
504 this->_M_impl._M_start._M_set_node(this->_M_impl._M_start._M_node + 1);
505 this->_M_impl._M_start._M_cur = this->_M_impl._M_start._M_first;
508 template <
typename _Tp,
typename _Alloc>
509 template <
typename _InputIterator>
513 _InputIterator __first, _InputIterator __last,
517 template <
typename _Tp,
typename _Alloc>
518 template <
typename _ForwardIterator>
521 _M_range_insert_aux(iterator __pos,
522 _ForwardIterator __first, _ForwardIterator __last,
526 if (__pos._M_cur == this->_M_impl._M_start._M_cur)
528 iterator __new_start = _M_reserve_elements_at_front(__n);
531 std::__uninitialized_copy_a(__first, __last, __new_start,
532 _M_get_Tp_allocator());
533 this->_M_impl._M_start = __new_start;
537 _M_destroy_nodes(__new_start._M_node,
538 this->_M_impl._M_start._M_node);
539 __throw_exception_again;
542 else if (__pos._M_cur == this->_M_impl._M_finish._M_cur)
544 iterator __new_finish = _M_reserve_elements_at_back(__n);
547 std::__uninitialized_copy_a(__first, __last,
548 this->_M_impl._M_finish,
549 _M_get_Tp_allocator());
550 this->_M_impl._M_finish = __new_finish;
554 _M_destroy_nodes(this->_M_impl._M_finish._M_node + 1,
555 __new_finish._M_node + 1);
556 __throw_exception_again;
560 _M_insert_aux(__pos, __first, __last, __n);
563 template<
typename _Tp,
typename _Alloc>
564 #ifdef __GXX_EXPERIMENTAL_CXX0X__
565 template<
typename... _Args>
566 typename deque<_Tp, _Alloc>::iterator
568 _M_insert_aux(iterator __pos, _Args&&... __args)
570 value_type __x_copy(std::forward<_Args>(__args)...);
572 typename deque<_Tp, _Alloc>::iterator
574 _M_insert_aux(iterator __pos,
const value_type& __x)
576 value_type __x_copy = __x;
578 difference_type __index = __pos - this->_M_impl._M_start;
579 if (static_cast<size_type>(__index) <
size() / 2)
581 push_front(_GLIBCXX_MOVE(front()));
582 iterator __front1 = this->_M_impl._M_start;
584 iterator __front2 = __front1;
586 __pos = this->_M_impl._M_start + __index;
587 iterator __pos1 = __pos;
589 _GLIBCXX_MOVE3(__front2, __pos1, __front1);
593 push_back(_GLIBCXX_MOVE(back()));
594 iterator __back1 = this->_M_impl._M_finish;
596 iterator __back2 = __back1;
598 __pos = this->_M_impl._M_start + __index;
599 _GLIBCXX_MOVE_BACKWARD3(__pos, __back2, __back1);
601 *__pos = _GLIBCXX_MOVE(__x_copy);
605 template <
typename _Tp,
typename _Alloc>
608 _M_insert_aux(iterator __pos, size_type __n,
const value_type& __x)
610 const difference_type __elems_before = __pos - this->_M_impl._M_start;
611 const size_type __length = this->
size();
612 value_type __x_copy = __x;
613 if (__elems_before < difference_type(__length / 2))
615 iterator __new_start = _M_reserve_elements_at_front(__n);
616 iterator __old_start = this->_M_impl._M_start;
617 __pos = this->_M_impl._M_start + __elems_before;
620 if (__elems_before >= difference_type(__n))
622 iterator __start_n = (this->_M_impl._M_start
623 + difference_type(__n));
624 std::__uninitialized_move_a(this->_M_impl._M_start,
625 __start_n, __new_start,
626 _M_get_Tp_allocator());
627 this->_M_impl._M_start = __new_start;
628 _GLIBCXX_MOVE3(__start_n, __pos, __old_start);
629 std::fill(__pos - difference_type(__n), __pos, __x_copy);
633 std::__uninitialized_move_fill(this->_M_impl._M_start,
635 this->_M_impl._M_start,
637 _M_get_Tp_allocator());
638 this->_M_impl._M_start = __new_start;
639 std::fill(__old_start, __pos, __x_copy);
644 _M_destroy_nodes(__new_start._M_node,
645 this->_M_impl._M_start._M_node);
646 __throw_exception_again;
651 iterator __new_finish = _M_reserve_elements_at_back(__n);
652 iterator __old_finish = this->_M_impl._M_finish;
653 const difference_type __elems_after =
654 difference_type(__length) - __elems_before;
655 __pos = this->_M_impl._M_finish - __elems_after;
658 if (__elems_after > difference_type(__n))
660 iterator __finish_n = (this->_M_impl._M_finish
661 - difference_type(__n));
662 std::__uninitialized_move_a(__finish_n,
663 this->_M_impl._M_finish,
664 this->_M_impl._M_finish,
665 _M_get_Tp_allocator());
666 this->_M_impl._M_finish = __new_finish;
667 _GLIBCXX_MOVE_BACKWARD3(__pos, __finish_n, __old_finish);
668 std::fill(__pos, __pos + difference_type(__n), __x_copy);
672 std::__uninitialized_fill_move(this->_M_impl._M_finish,
673 __pos + difference_type(__n),
675 this->_M_impl._M_finish,
676 _M_get_Tp_allocator());
677 this->_M_impl._M_finish = __new_finish;
678 std::fill(__pos, __old_finish, __x_copy);
683 _M_destroy_nodes(this->_M_impl._M_finish._M_node + 1,
684 __new_finish._M_node + 1);
685 __throw_exception_again;
690 template <
typename _Tp,
typename _Alloc>
691 template <
typename _ForwardIterator>
694 _M_insert_aux(iterator __pos,
695 _ForwardIterator __first, _ForwardIterator __last,
698 const difference_type __elemsbefore = __pos - this->_M_impl._M_start;
699 const size_type __length =
size();
700 if (static_cast<size_type>(__elemsbefore) < __length / 2)
702 iterator __new_start = _M_reserve_elements_at_front(__n);
703 iterator __old_start = this->_M_impl._M_start;
704 __pos = this->_M_impl._M_start + __elemsbefore;
707 if (__elemsbefore >= difference_type(__n))
709 iterator __start_n = (this->_M_impl._M_start
710 + difference_type(__n));
711 std::__uninitialized_move_a(this->_M_impl._M_start,
712 __start_n, __new_start,
713 _M_get_Tp_allocator());
714 this->_M_impl._M_start = __new_start;
715 _GLIBCXX_MOVE3(__start_n, __pos, __old_start);
716 std::copy(__first, __last, __pos - difference_type(__n));
720 _ForwardIterator __mid = __first;
721 std::advance(__mid, difference_type(__n) - __elemsbefore);
722 std::__uninitialized_move_copy(this->_M_impl._M_start,
723 __pos, __first, __mid,
725 _M_get_Tp_allocator());
726 this->_M_impl._M_start = __new_start;
727 std::copy(__mid, __last, __old_start);
732 _M_destroy_nodes(__new_start._M_node,
733 this->_M_impl._M_start._M_node);
734 __throw_exception_again;
739 iterator __new_finish = _M_reserve_elements_at_back(__n);
740 iterator __old_finish = this->_M_impl._M_finish;
741 const difference_type __elemsafter =
742 difference_type(__length) - __elemsbefore;
743 __pos = this->_M_impl._M_finish - __elemsafter;
746 if (__elemsafter > difference_type(__n))
748 iterator __finish_n = (this->_M_impl._M_finish
749 - difference_type(__n));
750 std::__uninitialized_move_a(__finish_n,
751 this->_M_impl._M_finish,
752 this->_M_impl._M_finish,
753 _M_get_Tp_allocator());
754 this->_M_impl._M_finish = __new_finish;
755 _GLIBCXX_MOVE_BACKWARD3(__pos, __finish_n, __old_finish);
756 std::copy(__first, __last, __pos);
760 _ForwardIterator __mid = __first;
762 std::__uninitialized_copy_move(__mid, __last, __pos,
763 this->_M_impl._M_finish,
764 this->_M_impl._M_finish,
765 _M_get_Tp_allocator());
766 this->_M_impl._M_finish = __new_finish;
767 std::copy(__first, __mid, __pos);
772 _M_destroy_nodes(this->_M_impl._M_finish._M_node + 1,
773 __new_finish._M_node + 1);
774 __throw_exception_again;
779 template<
typename _Tp,
typename _Alloc>
782 _M_destroy_data_aux(iterator __first, iterator __last)
784 for (_Map_pointer __node = __first._M_node + 1;
785 __node < __last._M_node; ++__node)
787 _M_get_Tp_allocator());
789 if (__first._M_node != __last._M_node)
792 _M_get_Tp_allocator());
794 _M_get_Tp_allocator());
798 _M_get_Tp_allocator());
801 template <
typename _Tp,
typename _Alloc>
806 if (this->max_size() - this->
size() < __new_elems)
807 __throw_length_error(__N(
"deque::_M_new_elements_at_front"));
809 const size_type __new_nodes = ((__new_elems + _S_buffer_size() - 1)
811 _M_reserve_map_at_front(__new_nodes);
815 for (__i = 1; __i <= __new_nodes; ++__i)
816 *(this->_M_impl._M_start._M_node - __i) = this->_M_allocate_node();
820 for (size_type __j = 1; __j < __i; ++__j)
821 _M_deallocate_node(*(this->_M_impl._M_start._M_node - __j));
822 __throw_exception_again;
826 template <
typename _Tp,
typename _Alloc>
831 if (this->max_size() - this->
size() < __new_elems)
832 __throw_length_error(__N(
"deque::_M_new_elements_at_back"));
834 const size_type __new_nodes = ((__new_elems + _S_buffer_size() - 1)
836 _M_reserve_map_at_back(__new_nodes);
840 for (__i = 1; __i <= __new_nodes; ++__i)
841 *(this->_M_impl._M_finish._M_node + __i) = this->_M_allocate_node();
845 for (size_type __j = 1; __j < __i; ++__j)
846 _M_deallocate_node(*(this->_M_impl._M_finish._M_node + __j));
847 __throw_exception_again;
851 template <
typename _Tp,
typename _Alloc>
856 const size_type __old_num_nodes
857 = this->_M_impl._M_finish._M_node - this->_M_impl._M_start._M_node + 1;
858 const size_type __new_num_nodes = __old_num_nodes + __nodes_to_add;
860 _Map_pointer __new_nstart;
861 if (this->_M_impl._M_map_size > 2 * __new_num_nodes)
863 __new_nstart = this->_M_impl._M_map + (this->_M_impl._M_map_size
864 - __new_num_nodes) / 2
865 + (__add_at_front ? __nodes_to_add : 0);
866 if (__new_nstart < this->_M_impl._M_start._M_node)
867 std::copy(this->_M_impl._M_start._M_node,
868 this->_M_impl._M_finish._M_node + 1,
871 std::copy_backward(this->_M_impl._M_start._M_node,
872 this->_M_impl._M_finish._M_node + 1,
873 __new_nstart + __old_num_nodes);
877 size_type __new_map_size = this->_M_impl._M_map_size
878 +
std::max(this->_M_impl._M_map_size,
881 _Map_pointer __new_map = this->_M_allocate_map(__new_map_size);
882 __new_nstart = __new_map + (__new_map_size - __new_num_nodes) / 2
883 + (__add_at_front ? __nodes_to_add : 0);
884 std::copy(this->_M_impl._M_start._M_node,
885 this->_M_impl._M_finish._M_node + 1,
887 _M_deallocate_map(this->_M_impl._M_map, this->_M_impl._M_map_size);
889 this->_M_impl._M_map = __new_map;
890 this->_M_impl._M_map_size = __new_map_size;
893 this->_M_impl._M_start._M_set_node(__new_nstart);
894 this->_M_impl._M_finish._M_set_node(__new_nstart + __old_num_nodes - 1);
899 template<
typename _Tp>
906 for (
typename _Self::_Map_pointer __node = __first._M_node + 1;
907 __node < __last._M_node; ++__node)
908 std::fill(*__node, *__node + _Self::_S_buffer_size(), __value);
910 if (__first._M_node != __last._M_node)
912 std::fill(__first._M_cur, __first._M_last, __value);
913 std::fill(__last._M_first, __last._M_cur, __value);
916 std::fill(__first._M_cur, __last._M_cur, __value);
919 template<
typename _Tp>
920 _Deque_iterator<_Tp, _Tp&, _Tp*>
921 copy(_Deque_iterator<_Tp, const _Tp&, const _Tp*> __first,
922 _Deque_iterator<_Tp, const _Tp&, const _Tp*> __last,
923 _Deque_iterator<_Tp, _Tp&, _Tp*> __result)
925 typedef typename _Deque_iterator<_Tp, _Tp&, _Tp*>::_Self _Self;
926 typedef typename _Self::difference_type difference_type;
928 difference_type __len = __last - __first;
931 const difference_type __clen
933 __result._M_last - __result._M_cur));
934 std::copy(__first._M_cur, __first._M_cur + __clen, __result._M_cur);
942 template<
typename _Tp>
943 _Deque_iterator<_Tp, _Tp&, _Tp*>
944 copy_backward(_Deque_iterator<_Tp, const _Tp&, const _Tp*> __first,
945 _Deque_iterator<_Tp, const _Tp&, const _Tp*> __last,
946 _Deque_iterator<_Tp, _Tp&, _Tp*> __result)
948 typedef typename _Deque_iterator<_Tp, _Tp&, _Tp*>::_Self _Self;
949 typedef typename _Self::difference_type difference_type;
951 difference_type __len = __last - __first;
954 difference_type __llen = __last._M_cur - __last._M_first;
955 _Tp* __lend = __last._M_cur;
957 difference_type __rlen = __result._M_cur - __result._M_first;
958 _Tp* __rend = __result._M_cur;
962 __llen = _Self::_S_buffer_size();
963 __lend = *(__last._M_node - 1) + __llen;
967 __rlen = _Self::_S_buffer_size();
968 __rend = *(__result._M_node - 1) + __rlen;
971 const difference_type __clen =
std::min(__len,
973 std::copy_backward(__lend - __clen, __lend, __rend);
981 #ifdef __GXX_EXPERIMENTAL_CXX0X__
982 template<
typename _Tp>
983 _Deque_iterator<_Tp, _Tp&, _Tp*>
984 move(_Deque_iterator<_Tp, const _Tp&, const _Tp*> __first,
985 _Deque_iterator<_Tp, const _Tp&, const _Tp*> __last,
986 _Deque_iterator<_Tp, _Tp&, _Tp*> __result)
988 typedef typename _Deque_iterator<_Tp, _Tp&, _Tp*>::_Self _Self;
989 typedef typename _Self::difference_type difference_type;
991 difference_type __len = __last - __first;
994 const difference_type __clen
996 __result._M_last - __result._M_cur));
997 std::move(__first._M_cur, __first._M_cur + __clen, __result._M_cur);
1005 template<
typename _Tp>
1006 _Deque_iterator<_Tp, _Tp&, _Tp*>
1007 move_backward(_Deque_iterator<_Tp, const _Tp&, const _Tp*> __first,
1008 _Deque_iterator<_Tp, const _Tp&, const _Tp*> __last,
1009 _Deque_iterator<_Tp, _Tp&, _Tp*> __result)
1011 typedef typename _Deque_iterator<_Tp, _Tp&, _Tp*>::_Self _Self;
1012 typedef typename _Self::difference_type difference_type;
1014 difference_type __len = __last - __first;
1017 difference_type __llen = __last._M_cur - __last._M_first;
1018 _Tp* __lend = __last._M_cur;
1020 difference_type __rlen = __result._M_cur - __result._M_first;
1021 _Tp* __rend = __result._M_cur;
1025 __llen = _Self::_S_buffer_size();
1026 __lend = *(__last._M_node - 1) + __llen;
1030 __rlen = _Self::_S_buffer_size();
1031 __rend = *(__result._M_node - 1) + __rlen;
1034 const difference_type __clen =
std::min(__len,
1036 std::move_backward(__lend - __clen, __lend, __rend);
1045 _GLIBCXX_END_NAMESPACE_CONTAINER
constexpr const _Tp * begin(initializer_list< _Tp > __ils)
Return an iterator pointing to the first element of the initilizer_list.
void _Destroy(_Tp *__pointer)
void _M_push_front_aux(_Args &&...__args)
Helper functions for push_* and pop_*.
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.
void _M_push_back_aux(_Args &&...__args)
Helper functions for push_* and pop_*.
Forward iterators support a superset of input iterator operations.
void _M_range_initialize(_InputIterator __first, _InputIterator __last, std::input_iterator_tag)
Fills the deque with whatever is in [first,last).
insert_iterator< _Container > inserter(_Container &__x, _Iterator __i)
A standard container using fixed-size memory allocation and constant-time manipulation of elements at...
constexpr size_t size() const
Returns the total number of bits.
void _M_new_elements_at_back(size_type __new_elements)
Memory-handling helpers for the previous internal insert functions.
iterator erase(iterator __position)
Remove element at given position.
void _M_new_elements_at_front(size_type __new_elements)
Memory-handling helpers for the previous internal insert functions.
void _M_fill_initialize(const value_type &__value)
Fills the deque with copies of value.
constexpr const _Tp * end(initializer_list< _Tp > __ils)
Return an iterator pointing to one past the last element of the initilizer_list.
iterator_traits< _InputIterator >::difference_type distance(_InputIterator __first, _InputIterator __last)
A generalization of pointer arithmetic.
iterator emplace(iterator __position, _Args &&...__args)
Inserts an object in deque before specified iterator.
const _Tp & min(const _Tp &, const _Tp &)
This does what you think it does.
void _M_pop_back_aux()
Helper functions for push_* and pop_*.
void advance(_InputIterator &__i, _Distance __n)
A generalization of pointer arithmetic.
deque & operator=(const deque &__x)
Deque assignment operator.
void _M_reallocate_map(size_type __nodes_to_add, bool __add_at_front)
Memory-handling helpers for the major map.