62#if __cplusplus >= 201103L
67#if __glibcxx_ranges_to_container
72namespace std _GLIBCXX_VISIBILITY(default)
74_GLIBCXX_BEGIN_NAMESPACE_VERSION
98 _M_reverse() _GLIBCXX_USE_NOEXCEPT;
104 _M_unhook() _GLIBCXX_USE_NOEXCEPT;
110#if _GLIBCXX_USE_CXX11_ABI
117#if __cplusplus >= 201103L
120# if _GLIBCXX_USE_CXX11_ABI
121 , _M_size(__x._M_size)
124 if (__x._M_base()->_M_next == __x._M_base())
125 this->_M_next = this->_M_prev =
this;
128 this->_M_next->_M_prev = this->_M_prev->_M_next = this->_M_base();
137 if (__xnode->_M_next == __xnode)
142 __node->_M_next = __xnode->_M_next;
143 __node->_M_prev = __xnode->_M_prev;
144 __node->_M_next->_M_prev = __node->_M_prev->_M_next = __node;
145# if _GLIBCXX_USE_CXX11_ABI
146 _M_size = __x._M_size;
154 _M_init() _GLIBCXX_NOEXCEPT
156 this->_M_next = this->_M_prev =
this;
157#if _GLIBCXX_USE_CXX11_ABI
169 _Scratch_list() { _M_next = _M_prev =
this; }
171 bool empty()
const {
return _M_next ==
this; }
173 void swap(_List_node_base& __l) { _List_node_base::swap(*
this, __l); }
175 template<
typename _Iter,
typename _Cmp>
181 operator()(__detail::_List_node_base* __lhs,
182 __detail::_List_node_base* __rhs)
183 {
return _M_cmp(*_Iter(__lhs), *_Iter(__rhs)); }
186 template<
typename _Iter>
187 struct _Ptr_cmp<_Iter, void>
190 operator()(__detail::_List_node_base* __lhs,
191 __detail::_List_node_base* __rhs)
const
192 {
return *_Iter(__lhs) < *_Iter(__rhs); }
196 template<
typename _Cmp>
198 merge(_List_node_base& __x, _Cmp __comp)
200 _List_node_base* __first1 = _M_next;
201 _List_node_base*
const __last1 =
this;
202 _List_node_base* __first2 = __x._M_next;
205 while (__first1 != __last1 && __first2 != __last2)
207 if (__comp(__first2, __first1))
209 _List_node_base* __next = __first2->_M_next;
210 __first1->_M_transfer(__first2, __next);
214 __first1 = __first1->_M_next;
216 if (__first2 != __last2)
217 this->_M_transfer(__first2, __last2);
221 void _M_take_one(_List_node_base* __i)
222 { this->_M_transfer(__i, __i->_M_next); }
225 void _M_put_all(_List_node_base* __i)
228 __i->_M_transfer(_M_next,
this);
234_GLIBCXX_BEGIN_NAMESPACE_CONTAINER
237 template<
typename _Tp>
240#if __cplusplus >= 201103L
241 __gnu_cxx::__aligned_membuf<_Tp> _M_storage;
242 _Tp* _M_valptr() {
return _M_storage._M_ptr(); }
243 _Tp
const* _M_valptr()
const {
return _M_storage._M_ptr(); }
256 template<
typename _Tp>
262 typedef ptrdiff_t difference_type;
264 typedef _Tp value_type;
265 typedef _Tp* pointer;
266 typedef _Tp& reference;
276 _M_const_cast()
const _GLIBCXX_NOEXCEPT
282 operator*()
const _GLIBCXX_NOEXCEPT
283 {
return *
static_cast<_Node*
>(_M_node)->_M_valptr(); }
287 operator->()
const _GLIBCXX_NOEXCEPT
288 {
return static_cast<_Node*
>(_M_node)->_M_valptr(); }
291 operator++() _GLIBCXX_NOEXCEPT
293 _M_node = _M_node->_M_next;
298 operator++(
int) _GLIBCXX_NOEXCEPT
301 _M_node = _M_node->_M_next;
306 operator--() _GLIBCXX_NOEXCEPT
308 _M_node = _M_node->_M_prev;
313 operator--(
int) _GLIBCXX_NOEXCEPT
316 _M_node = _M_node->_M_prev;
322 operator==(
const _Self& __x,
const _Self& __y) _GLIBCXX_NOEXCEPT
323 {
return __x._M_node == __y._M_node; }
325#if __cpp_impl_three_way_comparison < 201907L
328 operator!=(
const _Self& __x,
const _Self& __y) _GLIBCXX_NOEXCEPT
329 {
return __x._M_node != __y._M_node; }
341 template<
typename _Tp>
348 typedef ptrdiff_t difference_type;
350 typedef _Tp value_type;
351 typedef const _Tp* pointer;
352 typedef const _Tp& reference;
363 : _M_node(__x._M_node) { }
366 _M_const_cast()
const _GLIBCXX_NOEXCEPT
372 operator*()
const _GLIBCXX_NOEXCEPT
373 {
return *
static_cast<_Node*
>(_M_node)->_M_valptr(); }
377 operator->()
const _GLIBCXX_NOEXCEPT
378 {
return static_cast<_Node*
>(_M_node)->_M_valptr(); }
381 operator++() _GLIBCXX_NOEXCEPT
383 _M_node = _M_node->_M_next;
388 operator++(
int) _GLIBCXX_NOEXCEPT
391 _M_node = _M_node->_M_next;
396 operator--() _GLIBCXX_NOEXCEPT
398 _M_node = _M_node->_M_prev;
403 operator--(
int) _GLIBCXX_NOEXCEPT
406 _M_node = _M_node->_M_prev;
412 operator==(
const _Self& __x,
const _Self& __y) _GLIBCXX_NOEXCEPT
413 {
return __x._M_node == __y._M_node; }
415#if __cpp_impl_three_way_comparison < 201907L
418 operator!=(
const _Self& __x,
const _Self& __y) _GLIBCXX_NOEXCEPT
419 {
return __x._M_node != __y._M_node; }
426_GLIBCXX_BEGIN_NAMESPACE_CXX11
428 template<
typename _Tp,
typename _Alloc>
433 rebind<_Tp>::other _Tp_alloc_type;
435 typedef typename _Tp_alloc_traits::template
436 rebind<_List_node<_Tp> >::other _Node_alloc_type;
439#if !_GLIBCXX_INLINE_VERSION
445 while (__first != __last)
447 __first = __first->_M_next;
455 :
public _Node_alloc_type
459 _List_impl() _GLIBCXX_NOEXCEPT_IF(
464 _List_impl(
const _Node_alloc_type& __a) _GLIBCXX_NOEXCEPT
465 : _Node_alloc_type(__a)
468#if __cplusplus >= 201103L
469 _List_impl(_List_impl&&) =
default;
471 _List_impl(_Node_alloc_type&& __a, _List_impl&& __x)
475 _List_impl(_Node_alloc_type&& __a) noexcept
483#if _GLIBCXX_USE_CXX11_ABI
484 size_t _M_get_size()
const {
return _M_impl._M_node._M_size; }
486 void _M_set_size(
size_t __n) { _M_impl._M_node._M_size = __n; }
488 void _M_inc_size(
size_t __n) { _M_impl._M_node._M_size += __n; }
490 void _M_dec_size(
size_t __n) { _M_impl._M_node._M_size -= __n; }
492# if !_GLIBCXX_INLINE_VERSION
496 {
return _S_distance(__first, __last); }
499 size_t _M_node_count()
const {
return _M_get_size(); }
503 size_t _M_get_size()
const {
return 0; }
504 void _M_set_size(
size_t) { }
505 void _M_inc_size(
size_t) { }
506 void _M_dec_size(
size_t) { }
508# if !_GLIBCXX_INLINE_VERSION
509 size_t _M_distance(
const void*,
const void*)
const {
return 0; }
512 size_t _M_node_count()
const
514 return _S_distance(_M_impl._M_node._M_next,
520 typename _Node_alloc_traits::pointer
525 _M_put_node(
typename _Node_alloc_traits::pointer __p) _GLIBCXX_NOEXCEPT
529 typedef _Alloc allocator_type;
532 _M_get_Node_allocator() _GLIBCXX_NOEXCEPT
535 const _Node_alloc_type&
536 _M_get_Node_allocator()
const _GLIBCXX_NOEXCEPT
539#if __cplusplus >= 201103L
545 _List_base(
const _Node_alloc_type& __a) _GLIBCXX_NOEXCEPT
549#if __cplusplus >= 201103L
552# if !_GLIBCXX_INLINE_VERSION
556 if (__x._M_get_Node_allocator() == _M_get_Node_allocator())
574 { _M_impl._M_node._M_move_nodes(
std::move(__x._M_impl._M_node)); }
582 _M_clear() _GLIBCXX_NOEXCEPT;
585 _M_init() _GLIBCXX_NOEXCEPT
586 { this->_M_impl._M_node._M_init(); }
635 template<
typename _Tp,
typename _Alloc = std::allocator<_Tp> >
638#ifdef _GLIBCXX_CONCEPT_CHECKS
640 typedef typename _Alloc::value_type _Alloc_value_type;
641# if __cplusplus < 201103L
642 __glibcxx_class_requires(_Tp, _SGIAssignableConcept)
644 __glibcxx_class_requires2(_Tp, _Alloc_value_type, _SameTypeConcept)
647#if __cplusplus >= 201103L
649 "std::list must have a non-const, non-volatile value_type");
650# if __cplusplus > 201703L || defined __STRICT_ANSI__
652 "std::list must have the same value_type as its allocator");
657 typedef typename _Base::_Tp_alloc_type _Tp_alloc_type;
659 typedef typename _Base::_Node_alloc_type _Node_alloc_type;
663 typedef _Tp value_type;
664 typedef typename _Tp_alloc_traits::pointer pointer;
665 typedef typename _Tp_alloc_traits::const_pointer const_pointer;
666 typedef typename _Tp_alloc_traits::reference reference;
667 typedef typename _Tp_alloc_traits::const_reference const_reference;
672 typedef size_t size_type;
673 typedef ptrdiff_t difference_type;
674 typedef _Alloc allocator_type;
681 using _Base::_M_impl;
682 using _Base::_M_put_node;
683 using _Base::_M_get_node;
684 using _Base::_M_get_Node_allocator;
692#if __cplusplus < 201103L
696 _Node* __p = this->_M_get_node();
699 _Tp_alloc_type __alloc(_M_get_Node_allocator());
700 __alloc.construct(__p->_M_valptr(), __x);
705 __throw_exception_again;
710 template<
typename... _Args>
714 auto __p = this->_M_get_node();
715 auto& __alloc = _M_get_Node_allocator();
716 __allocated_ptr<_Node_alloc_type> __guard{__alloc, __p};
717 _Node_alloc_traits::construct(__alloc, __p->_M_valptr(),
718 std::forward<_Args>(__args)...);
724#if _GLIBCXX_USE_CXX11_ABI
726 _S_distance(const_iterator __first, const_iterator __last)
731 _M_node_count()
const
732 {
return this->_M_get_size(); }
736 _S_distance(const_iterator, const_iterator)
741 _M_node_count()
const
752#if __cplusplus >= 201103L
763 list(
const allocator_type& __a) _GLIBCXX_NOEXCEPT
764 :
_Base(_Node_alloc_type(__a)) { }
766#if __cplusplus >= 201103L
776 list(size_type __n,
const allocator_type& __a = allocator_type())
777 :
_Base(_Node_alloc_type(__a))
778 { _M_default_initialize(__n); }
788 list(size_type __n,
const value_type& __value,
789 const allocator_type& __a = allocator_type())
790 :
_Base(_Node_alloc_type(__a))
791 { _M_fill_initialize(__n, __value); }
802 list(size_type __n,
const value_type& __value = value_type(),
803 const allocator_type& __a = allocator_type())
804 : _Base(_Node_alloc_type(__a))
805 { _M_fill_initialize(__n, __value); }
817 _S_select_on_copy(__x._M_get_Node_allocator()))
818 { _M_initialize_dispatch(__x.
begin(), __x.
end(), __false_type()); }
820#if __cplusplus >= 201103L
839 const allocator_type& __a = allocator_type())
840 :
_Base(_Node_alloc_type(__a))
841 { _M_initialize_dispatch(__l.begin(), __l.end(), __false_type()); }
843 list(
const list& __x,
const __type_identity_t<allocator_type>& __a)
844 : _Base(_Node_alloc_type(__a))
845 { _M_initialize_dispatch(__x.
begin(), __x.
end(), __false_type()); }
849 : _Base(_Node_alloc_type(__a),
std::move(__x))
853 : _Base(_Node_alloc_type(__a))
855 if (__x._M_get_Node_allocator() == this->_M_get_Node_allocator())
859 std::__make_move_if_noexcept_iterator(__x.
end()));
863 list(
list&& __x,
const __type_identity_t<allocator_type>& __a)
864 noexcept(_Node_alloc_traits::_S_always_equal())
866 typename _Node_alloc_traits::is_always_equal{})
880#if __cplusplus >= 201103L
881 template<
typename _InputIterator,
882 typename = std::_RequireInputIter<_InputIterator>>
883 list(_InputIterator __first, _InputIterator __last,
884 const allocator_type& __a = allocator_type())
885 :
_Base(_Node_alloc_type(__a))
886 { _M_initialize_dispatch(__first, __last, __false_type()); }
888 template<
typename _InputIterator>
889 list(_InputIterator __first, _InputIterator __last,
890 const allocator_type& __a = allocator_type())
891 : _Base(_Node_alloc_type(__a))
894 typedef typename std::__is_integer<_InputIterator>::__type _Integral;
895 _M_initialize_dispatch(__first, __last, _Integral());
899#if __glibcxx_ranges_to_container
904 template<__detail::__container_compatible_range<_Tp> _Rg>
905 list(from_range_t, _Rg&& __rg,
const _Alloc& __a = _Alloc())
906 : _Base(_Node_alloc_type(__a))
908 auto __first = ranges::begin(__rg);
909 const auto __last = ranges::end(__rg);
910 for (; __first != __last; ++__first)
911 emplace_back(*__first);
915#if __cplusplus >= 201103L
937#if __cplusplus >= 201103L
950 noexcept(_Node_alloc_traits::_S_nothrow_move())
952 constexpr bool __move_storage =
953 _Node_alloc_traits::_S_propagate_on_move_assign()
954 || _Node_alloc_traits::_S_always_equal();
955 _M_move_assign(
std::move(__x), __bool_constant<__move_storage>());
969 this->
assign(__l.begin(), __l.end());
974#if __glibcxx_ranges_to_container
979 template<__detail::__container_compatible_range<_Tp> _Rg>
981 assign_range(_Rg&& __rg)
983 static_assert(assignable_from<_Tp&, ranges::range_reference_t<_Rg>>);
987 auto __first2 = ranges::begin(__rg);
988 const auto __last2 = ranges::end(__rg);
989 for (; __first1 != __last1 && __first2 != __last2;
990 ++__first1, (void)++__first2)
991 *__first1 = *__first2;
992 if (__first2 == __last2)
993 erase(__first1, __last1);
995 insert_range(__last1,
1011 assign(size_type __n,
const value_type& __val)
1012 { _M_fill_assign(__n, __val); }
1026#if __cplusplus >= 201103L
1027 template<
typename _InputIterator,
1028 typename = std::_RequireInputIter<_InputIterator>>
1030 assign(_InputIterator __first, _InputIterator __last)
1031 { _M_assign_dispatch(__first, __last, __false_type()); }
1033 template<
typename _InputIterator>
1035 assign(_InputIterator __first, _InputIterator __last)
1038 typedef typename std::__is_integer<_InputIterator>::__type _Integral;
1039 _M_assign_dispatch(__first, __last, _Integral());
1043#if __cplusplus >= 201103L
1053 { this->_M_assign_dispatch(__l.begin(), __l.end(), __false_type()); }
1059 {
return allocator_type(_Base::_M_get_Node_allocator()); }
1069 {
return iterator(this->_M_impl._M_node._M_next); }
1089 {
return iterator(&this->_M_impl._M_node); }
1117 const_reverse_iterator
1137 const_reverse_iterator
1141#if __cplusplus >= 201103L
1168 const_reverse_iterator
1178 const_reverse_iterator
1188 _GLIBCXX_NODISCARD
bool
1190 {
return this->_M_impl._M_node._M_next == &this->_M_impl._M_node; }
1196 {
return _M_node_count(); }
1204#if __cplusplus >= 201103L
1215 resize(size_type __new_size);
1228 resize(size_type __new_size,
const value_type& __x);
1241 resize(size_type __new_size, value_type __x = value_type());
1252 {
return *
begin(); }
1261 {
return *
begin(); }
1271 iterator __tmp =
end();
1302 { this->_M_insert(
begin(), __x); }
1304#if __cplusplus >= 201103L
1309 template<
typename... _Args>
1310#if __cplusplus > 201402L
1315 emplace_front(_Args&&... __args)
1317 this->_M_insert(
begin(), std::forward<_Args>(__args)...);
1318#if __cplusplus > 201402L
1324#if __glibcxx_ranges_to_container
1337 template<__detail::__container_compatible_range<_Tp> _Rg>
1339 prepend_range(_Rg&& __rg)
1358 template<__detail::__container_compatible_range<_Tp> _Rg>
1360 append_range(_Rg&& __rg)
1382 { this->_M_erase(
begin()); }
1396 { this->_M_insert(
end(), __x); }
1398#if __cplusplus >= 201103L
1403 template<
typename... _Args>
1404#if __cplusplus > 201402L
1409 emplace_back(_Args&&... __args)
1411 this->_M_insert(
end(), std::forward<_Args>(__args)...);
1412#if __cplusplus > 201402L
1431 { this->_M_erase(iterator(this->_M_impl._M_node._M_prev)); }
1433#if __cplusplus >= 201103L
1446 template<
typename... _Args>
1448 emplace(const_iterator __position, _Args&&... __args);
1462 insert(const_iterator __position,
const value_type& __x);
1479#if __cplusplus >= 201103L
1512 {
return this->
insert(__p, __l.begin(), __l.end()); }
1515#if __cplusplus >= 201103L
1531 insert(const_iterator __position, size_type __n,
const value_type& __x);
1546 insert(
iterator __position, size_type __n,
const value_type& __x)
1549 splice(__position, __tmp);
1553#if __cplusplus >= 201103L
1569 template<
typename _InputIterator,
1570 typename = std::_RequireInputIter<_InputIterator>>
1572 insert(const_iterator __position, _InputIterator __first,
1573 _InputIterator __last);
1588 template<
typename _InputIterator>
1590 insert(iterator __position, _InputIterator __first,
1591 _InputIterator __last)
1594 splice(__position, __tmp);
1598#if __glibcxx_ranges_to_container
1614 template<__detail::__container_compatible_range<_Tp> _Rg>
1616 insert_range(const_iterator __position, _Rg&& __rg)
1621 auto __it = __tmp.begin();
1622 splice(__position, __tmp);
1625 return __position._M_const_cast();
1645#if __cplusplus >= 201103L
1646 erase(const_iterator __position)
noexcept;
1648 erase(iterator __position);
1670#if __cplusplus >= 201103L
1673 erase(iterator __first, iterator __last)
1676 while (__first != __last)
1677 __first =
erase(__first);
1678 return __last._M_const_cast();
1695 __detail::_List_node_base::swap(this->_M_impl._M_node,
1696 __x._M_impl._M_node);
1698 size_t __xsize = __x._M_get_size();
1699 __x._M_set_size(this->_M_get_size());
1700 this->_M_set_size(__xsize);
1702 _Node_alloc_traits::_S_on_swap(this->_M_get_Node_allocator(),
1703 __x._M_get_Node_allocator());
1732#if __cplusplus >= 201103L
1740 _M_check_equal_allocators(__x);
1742 this->_M_transfer(__position._M_const_cast(),
1745 this->_M_inc_size(__x._M_get_size());
1750#if __cplusplus >= 201103L
1752 splice(const_iterator __position,
list& __x)
noexcept
1756#if __cplusplus >= 201103L
1780 splice(iterator __position,
list& __x, iterator __i)
1783 iterator __j = __i._M_const_cast();
1785 if (__position == __i || __position == __j)
1789 _M_check_equal_allocators(__x);
1791 this->_M_transfer(__position._M_const_cast(),
1792 __i._M_const_cast(), __j);
1794 this->_M_inc_size(1);
1798#if __cplusplus >= 201103L
1814#if __cplusplus >= 201103L
1845 splice(iterator __position,
list& __x, iterator __first,
1849 if (__first != __last)
1852 _M_check_equal_allocators(__x);
1854 size_t __n = _S_distance(__first, __last);
1855 this->_M_inc_size(__n);
1856 __x._M_dec_size(__n);
1858 this->_M_transfer(__position._M_const_cast(),
1859 __first._M_const_cast(),
1860 __last._M_const_cast());
1864#if __cplusplus >= 201103L
1885#ifdef __glibcxx_list_remove_return_type
1886 typedef size_type __remove_return_type;
1887# define _GLIBCXX_LIST_REMOVE_RETURN_TYPE_TAG \
1888 __attribute__((__abi_tag__("__cxx20")))
1890 typedef void __remove_return_type;
1891# define _GLIBCXX_LIST_REMOVE_RETURN_TYPE_TAG
1906 _GLIBCXX_LIST_REMOVE_RETURN_TYPE_TAG
1907 __remove_return_type
1908 remove(
const _Tp& __value);
1921 template<
typename _Predicate>
1922 __remove_return_type
1935 _GLIBCXX_LIST_REMOVE_RETURN_TYPE_TAG
1936 __remove_return_type
1951 template<
typename _BinaryPredicate>
1952 __remove_return_type
1953 unique(_BinaryPredicate);
1955#undef _GLIBCXX_LIST_REMOVE_RETURN_TYPE_TAG
1966#if __cplusplus >= 201103L
1991#if __cplusplus >= 201103L
1992 template<
typename _StrictWeakOrdering>
1994 merge(
list&& __x, _StrictWeakOrdering __comp);
1996 template<
typename _StrictWeakOrdering>
1998 merge(
list& __x, _StrictWeakOrdering __comp)
2001 template<
typename _StrictWeakOrdering>
2003 merge(
list& __x, _StrictWeakOrdering __comp);
2013 { this->_M_impl._M_node._M_reverse(); }
2030 template<
typename _StrictWeakOrdering>
2032 sort(_StrictWeakOrdering);
2041 template<
typename _Integer>
2043 _M_initialize_dispatch(_Integer __n, _Integer __x, __true_type)
2044 { _M_fill_initialize(
static_cast<size_type
>(__n), __x); }
2047 template<
typename _InputIterator>
2049 _M_initialize_dispatch(_InputIterator __first, _InputIterator __last,
2052 for (; __first != __last; ++__first)
2053#
if __cplusplus >= 201103L
2054 emplace_back(*__first);
2063 _M_fill_initialize(size_type __n,
const value_type& __x)
2069#if __cplusplus >= 201103L
2072 _M_default_initialize(size_type __n)
2080 _M_default_append(size_type __n);
2089 template<
typename _Integer>
2091 _M_assign_dispatch(_Integer __n, _Integer __val, __true_type)
2092 { _M_fill_assign(__n, __val); }
2095 template<
typename _InputIterator>
2097 _M_assign_dispatch(_InputIterator __first, _InputIterator __last,
2103 _M_fill_assign(size_type __n,
const value_type& __val);
2108 _M_transfer(iterator __position, iterator __first, iterator __last)
2109 { __position._M_node->_M_transfer(__first._M_node, __last._M_node); }
2112#if __cplusplus < 201103L
2114 _M_insert(iterator __position,
const value_type& __x)
2117 __tmp->_M_hook(__position._M_node);
2118 this->_M_inc_size(1);
2121 template<
typename... _Args>
2123 _M_insert(iterator __position, _Args&&... __args)
2126 __tmp->_M_hook(__position._M_node);
2127 this->_M_inc_size(1);
2133 _M_erase(iterator __position) _GLIBCXX_NOEXCEPT
2135 this->_M_dec_size(1);
2136 __position._M_node->_M_unhook();
2137 _Node* __n =
static_cast<_Node*
>(__position._M_node);
2138#if __cplusplus >= 201103L
2139 _Node_alloc_traits::destroy(_M_get_Node_allocator(), __n->_M_valptr());
2141 _Tp_alloc_type(_M_get_Node_allocator()).destroy(__n->_M_valptr());
2149 _M_check_equal_allocators(
const list& __x) _GLIBCXX_NOEXCEPT
2151 if (_M_get_Node_allocator() != __x._M_get_Node_allocator())
2157 _M_resize_pos(size_type& __new_size)
const;
2159#if __cplusplus >= 201103L
2165 std::__alloc_on_move(this->_M_get_Node_allocator(),
2166 __x._M_get_Node_allocator());
2172 if (__x._M_get_Node_allocator() == this->_M_get_Node_allocator())
2177 _M_assign_dispatch(std::make_move_iterator(__x.begin()),
2178 std::make_move_iterator(__x.end()),
2183#if _GLIBCXX_USE_CXX11_ABI
2185 struct _Finalize_merge
2188 _Finalize_merge(
list& __dest,
list& __src,
const iterator& __src_next)
2189 : _M_dest(__dest), _M_src(__src), _M_next(__src_next)
2197 const size_t __num_unmerged =
std::distance(_M_next, _M_src.end());
2198 const size_t __orig_size = _M_src._M_get_size();
2199 _M_dest._M_inc_size(__orig_size - __num_unmerged);
2200 _M_src._M_set_size(__num_unmerged);
2205 const iterator& _M_next;
2207#if __cplusplus >= 201103L
2208 _Finalize_merge(
const _Finalize_merge&) =
delete;
2212 struct _Finalize_merge
2213 {
explicit _Finalize_merge(
list&,
list&,
const iterator&) { } };
2218#if __cpp_deduction_guides >= 201606
2219 template<
typename _InputIterator,
typename _ValT
2220 =
typename iterator_traits<_InputIterator>::value_type,
2221 typename _Allocator = allocator<_ValT>,
2222 typename = _RequireInputIter<_InputIterator>,
2223 typename = _RequireAllocator<_Allocator>>
2224 list(_InputIterator, _InputIterator, _Allocator = _Allocator())
2225 -> list<_ValT, _Allocator>;
2227#if __glibcxx_ranges_to_container
2228 template<ranges::input_range _Rg,
2229 typename _Allocator = allocator<ranges::range_value_t<_Rg>>>
2230 list(from_range_t, _Rg&&, _Allocator = _Allocator())
2231 -> list<ranges::range_value_t<_Rg>, _Allocator>;
2235_GLIBCXX_END_NAMESPACE_CXX11
2247 template<
typename _Tp,
typename _Alloc>
2252#if _GLIBCXX_USE_CXX11_ABI
2253 if (__x.
size() != __y.size())
2258 const_iterator __end1 = __x.
end();
2259 const_iterator __end2 = __y.end();
2261 const_iterator __i1 = __x.
begin();
2262 const_iterator __i2 = __y.begin();
2263 while (__i1 != __end1 && __i2 != __end2 && *__i1 == *__i2)
2268 return __i1 == __end1 && __i2 == __end2;
2271#if __cpp_lib_three_way_comparison
2283 template<
typename _Tp,
typename _Alloc>
2285 inline __detail::__synth3way_t<_Tp>
2286 operator<=>(
const list<_Tp, _Alloc>& __x,
const list<_Tp, _Alloc>& __y)
2289 __y.begin(), __y.end(),
2290 __detail::__synth3way);
2304 template<
typename _Tp,
typename _Alloc>
2307 operator<(
const list<_Tp, _Alloc>& __x,
const list<_Tp, _Alloc>& __y)
2308 {
return std::lexicographical_compare(__x.begin(), __x.end(),
2309 __y.begin(), __y.end()); }
2312 template<
typename _Tp,
typename _Alloc>
2315 operator!=(
const list<_Tp, _Alloc>& __x,
const list<_Tp, _Alloc>& __y)
2316 {
return !(__x == __y); }
2319 template<
typename _Tp,
typename _Alloc>
2322 operator>(
const list<_Tp, _Alloc>& __x,
const list<_Tp, _Alloc>& __y)
2323 {
return __y < __x; }
2326 template<
typename _Tp,
typename _Alloc>
2329 operator<=(
const list<_Tp, _Alloc>& __x,
const list<_Tp, _Alloc>& __y)
2330 {
return !(__y < __x); }
2333 template<
typename _Tp,
typename _Alloc>
2336 operator>=(
const list<_Tp, _Alloc>& __x,
const list<_Tp, _Alloc>& __y)
2337 {
return !(__x < __y); }
2341 template<
typename _Tp,
typename _Alloc>
2344 _GLIBCXX_NOEXCEPT_IF(
noexcept(__x.swap(__y)))
2347_GLIBCXX_END_NAMESPACE_CONTAINER
2349#if _GLIBCXX_USE_CXX11_ABI
2352 template<
typename _Tp>
2354 __distance(_GLIBCXX_STD_C::_List_iterator<_Tp> __first,
2355 _GLIBCXX_STD_C::_List_iterator<_Tp> __last,
2356 input_iterator_tag __tag)
2358 typedef _GLIBCXX_STD_C::_List_const_iterator<_Tp> _CIter;
2359 return std::__distance(_CIter(__first), _CIter(__last), __tag);
2362 template<
typename _Tp>
2364 __distance(_GLIBCXX_STD_C::_List_const_iterator<_Tp> __first,
2365 _GLIBCXX_STD_C::_List_const_iterator<_Tp> __last,
2368 typedef __detail::_List_node_header _Sentinel;
2369 _GLIBCXX_STD_C::_List_const_iterator<_Tp> __beyond = __last;
2371 const bool __whole = __first == __beyond;
2372 if (__builtin_constant_p (__whole) && __whole)
2373 return static_cast<const _Sentinel*
>(__last._M_node)->_M_size;
2376 while (__first != __last)
2385_GLIBCXX_END_NAMESPACE_VERSION
constexpr bool operator<=(const duration< _Rep1, _Period1 > &__lhs, const duration< _Rep2, _Period2 > &__rhs)
constexpr bool operator>=(const duration< _Rep1, _Period1 > &__lhs, const duration< _Rep2, _Period2 > &__rhs)
constexpr bool operator<(const duration< _Rep1, _Period1 > &__lhs, const duration< _Rep2, _Period2 > &__rhs)
constexpr bool operator>(const duration< _Rep1, _Period1 > &__lhs, const duration< _Rep2, _Period2 > &__rhs)
__bool_constant< true > true_type
The type used as a compile-time boolean with true value.
__bool_constant< false > false_type
The type used as a compile-time boolean with false value.
constexpr std::remove_reference< _Tp >::type && move(_Tp &&__t) noexcept
Convert a value to an rvalue.
constexpr _Tp * __addressof(_Tp &__r) noexcept
Same as C++11 std::addressof.
constexpr auto lexicographical_compare_three_way(_InputIter1 __first1, _InputIter1 __last1, _InputIter2 __first2, _InputIter2 __last2, _Comp __comp) -> decltype(__comp(*__first1, *__first2))
Performs dictionary comparison on ranges.
ISO C++ entities toplevel namespace is std.
constexpr iterator_traits< _InputIterator >::difference_type distance(_InputIterator __first, _InputIterator __last)
A generalization of pointer arithmetic.
constexpr auto empty(const _Container &__cont) noexcept(noexcept(__cont.empty())) -> decltype(__cont.empty())
Return whether a container is empty.
is_nothrow_default_constructible
The ranges::subrange class template.
Bidirectional iterators support a superset of forward iterator operations.
Common part of a node in the list.
An actual node in the list.
See bits/stl_deque.h's _Deque_base for an explanation.
A standard container with linear time access to elements, and fixed time insertion/deletion at any po...
void resize(size_type __new_size)
Resizes the list to the specified number of elements.
iterator insert(const_iterator __position, const value_type &__x)
Inserts given value into list before specified iterator.
void splice(const_iterator __position, list &&__x, const_iterator __i) noexcept
Insert element from another list.
list(list &&)=default
List move constructor.
void sort()
Sort the elements.
void push_back(const value_type &__x)
Add data to the end of the list.
iterator begin() noexcept
iterator emplace(const_iterator __position, _Args &&... __args)
Constructs object in list before specified iterator.
list & operator=(list &&__x) noexcept(_Node_alloc_traits::_S_nothrow_move())
List move assignment operator.
_Node * _M_create_node(_Args &&... __args)
iterator insert(const_iterator __position, value_type &&__x)
Inserts given rvalue into list before specified iterator.
allocator_type get_allocator() const noexcept
Get a copy of the memory allocation object.
list & operator=(const list &__x)
List assignment operator.
void assign(initializer_list< value_type > __l)
Assigns an initializer_list to a list.
const_iterator end() const noexcept
const_reverse_iterator rbegin() const noexcept
list(size_type __n, const allocator_type &__a=allocator_type())
Creates a list with default constructed elements.
reverse_iterator rend() noexcept
void pop_back() noexcept
Removes last element.
void push_front(const value_type &__x)
Add data to the front of the list.
__remove_return_type unique()
Remove consecutive duplicate elements.
size_type size() const noexcept
void merge(list &&__x)
Merge sorted lists.
const_reference front() const noexcept
void splice(const_iterator __position, list &__x, const_iterator __first, const_iterator __last) noexcept
Insert range from another list.
void assign(_InputIterator __first, _InputIterator __last)
Assigns a range to a list.
const_iterator cend() const noexcept
list(const allocator_type &__a) noexcept
Creates a list with no elements.
void reverse() noexcept
Reverse the elements in list.
__remove_return_type remove(const _Tp &__value)
Remove all elements equal to value.
list & operator=(initializer_list< value_type > __l)
List initializer list assignment operator.
reverse_iterator rbegin() noexcept
list()=default
Creates a list with no elements.
iterator erase(const_iterator __first, const_iterator __last) noexcept
Remove a range of elements.
reference back() noexcept
void assign(size_type __n, const value_type &__val)
Assigns a given value to a list.
void splice(const_iterator __position, list &&__x, const_iterator __first, const_iterator __last) noexcept
Insert range from another list.
void splice(const_iterator __position, list &__x, const_iterator __i) noexcept
Insert element from another list.
const_iterator cbegin() const noexcept
const_reverse_iterator crbegin() const noexcept
__remove_return_type remove_if(_Predicate)
Remove all elements satisfying a predicate.
list(initializer_list< value_type > __l, const allocator_type &__a=allocator_type())
Builds a list from an initializer_list.
size_type max_size() const noexcept
const_reference back() const noexcept
list(size_type __n, const value_type &__value, const allocator_type &__a=allocator_type())
Creates a list with copies of an exemplar element.
const_iterator begin() const noexcept
reference front() noexcept
void pop_front() noexcept
Removes first element.
list(_InputIterator __first, _InputIterator __last, const allocator_type &__a=allocator_type())
Builds a list from a range.
void splice(const_iterator __position, list &&__x) noexcept
Insert contents of another list.
list(const list &__x)
List copy constructor.
iterator erase(const_iterator __position) noexcept
Remove element at given position.
const_reverse_iterator rend() const noexcept
bool empty() const noexcept
iterator insert(const_iterator __p, initializer_list< value_type > __l)
Inserts the contents of an initializer_list into list before specified const_iterator.
const_reverse_iterator crend() const noexcept
void swap(list &__x) noexcept
Swaps data with another list.
Uniform interface to C++98 and C++11 allocators.
static constexpr pointer allocate(_Alloc &__a, size_type __n)
Allocate memory.
static constexpr void deallocate(_Alloc &__a, pointer __p, size_type __n)
Deallocate memory.
static constexpr size_type max_size(const _Alloc &__a) noexcept
The maximum supported allocation size.