62#if __cplusplus >= 201103L
68namespace std _GLIBCXX_VISIBILITY(default)
70_GLIBCXX_BEGIN_NAMESPACE_VERSION
94 _M_reverse() _GLIBCXX_USE_NOEXCEPT;
100 _M_unhook() _GLIBCXX_USE_NOEXCEPT;
106#if _GLIBCXX_USE_CXX11_ABI
113#if __cplusplus >= 201103L
116# if _GLIBCXX_USE_CXX11_ABI
117 , _M_size(__x._M_size)
120 if (__x._M_base()->_M_next == __x._M_base())
121 this->_M_next = this->_M_prev =
this;
124 this->_M_next->_M_prev = this->_M_prev->_M_next = this->_M_base();
133 if (__xnode->_M_next == __xnode)
138 __node->_M_next = __xnode->_M_next;
139 __node->_M_prev = __xnode->_M_prev;
140 __node->_M_next->_M_prev = __node->_M_prev->_M_next = __node;
141# if _GLIBCXX_USE_CXX11_ABI
142 _M_size = __x._M_size;
150 _M_init() _GLIBCXX_NOEXCEPT
152 this->_M_next = this->_M_prev =
this;
153#if _GLIBCXX_USE_CXX11_ABI
165 _Scratch_list() { _M_next = _M_prev =
this; }
167 bool empty()
const {
return _M_next ==
this; }
169 void swap(_List_node_base& __l) { _List_node_base::swap(*
this, __l); }
171 template<
typename _Iter,
typename _Cmp>
177 operator()(__detail::_List_node_base* __lhs,
178 __detail::_List_node_base* __rhs)
179 {
return _M_cmp(*_Iter(__lhs), *_Iter(__rhs)); }
182 template<
typename _Iter>
183 struct _Ptr_cmp<_Iter, void>
186 operator()(__detail::_List_node_base* __lhs,
187 __detail::_List_node_base* __rhs)
const
188 {
return *_Iter(__lhs) < *_Iter(__rhs); }
192 template<
typename _Cmp>
194 merge(_List_node_base& __x, _Cmp __comp)
196 _List_node_base* __first1 = _M_next;
197 _List_node_base*
const __last1 =
this;
198 _List_node_base* __first2 = __x._M_next;
201 while (__first1 != __last1 && __first2 != __last2)
203 if (__comp(__first2, __first1))
205 _List_node_base* __next = __first2->_M_next;
206 __first1->_M_transfer(__first2, __next);
210 __first1 = __first1->_M_next;
212 if (__first2 != __last2)
213 this->_M_transfer(__first2, __last2);
217 void _M_take_one(_List_node_base* __i)
218 { this->_M_transfer(__i, __i->_M_next); }
221 void _M_put_all(_List_node_base* __i)
224 __i->_M_transfer(_M_next,
this);
230_GLIBCXX_BEGIN_NAMESPACE_CONTAINER
233 template<
typename _Tp>
236#if __cplusplus >= 201103L
237 __gnu_cxx::__aligned_membuf<_Tp> _M_storage;
238 _Tp* _M_valptr() {
return _M_storage._M_ptr(); }
239 _Tp
const* _M_valptr()
const {
return _M_storage._M_ptr(); }
252 template<
typename _Tp>
258 typedef ptrdiff_t difference_type;
260 typedef _Tp value_type;
261 typedef _Tp* pointer;
262 typedef _Tp& reference;
272 _M_const_cast()
const _GLIBCXX_NOEXCEPT
278 operator*()
const _GLIBCXX_NOEXCEPT
279 {
return *
static_cast<_Node*
>(_M_node)->_M_valptr(); }
283 operator->()
const _GLIBCXX_NOEXCEPT
284 {
return static_cast<_Node*
>(_M_node)->_M_valptr(); }
287 operator++() _GLIBCXX_NOEXCEPT
289 _M_node = _M_node->_M_next;
294 operator++(
int) _GLIBCXX_NOEXCEPT
297 _M_node = _M_node->_M_next;
302 operator--() _GLIBCXX_NOEXCEPT
304 _M_node = _M_node->_M_prev;
309 operator--(
int) _GLIBCXX_NOEXCEPT
312 _M_node = _M_node->_M_prev;
318 operator==(
const _Self& __x,
const _Self& __y) _GLIBCXX_NOEXCEPT
319 {
return __x._M_node == __y._M_node; }
321#if __cpp_impl_three_way_comparison < 201907L
324 operator!=(
const _Self& __x,
const _Self& __y) _GLIBCXX_NOEXCEPT
325 {
return __x._M_node != __y._M_node; }
337 template<
typename _Tp>
344 typedef ptrdiff_t difference_type;
346 typedef _Tp value_type;
347 typedef const _Tp* pointer;
348 typedef const _Tp& reference;
359 : _M_node(__x._M_node) { }
362 _M_const_cast()
const _GLIBCXX_NOEXCEPT
368 operator*()
const _GLIBCXX_NOEXCEPT
369 {
return *
static_cast<_Node*
>(_M_node)->_M_valptr(); }
373 operator->()
const _GLIBCXX_NOEXCEPT
374 {
return static_cast<_Node*
>(_M_node)->_M_valptr(); }
377 operator++() _GLIBCXX_NOEXCEPT
379 _M_node = _M_node->_M_next;
384 operator++(
int) _GLIBCXX_NOEXCEPT
387 _M_node = _M_node->_M_next;
392 operator--() _GLIBCXX_NOEXCEPT
394 _M_node = _M_node->_M_prev;
399 operator--(
int) _GLIBCXX_NOEXCEPT
402 _M_node = _M_node->_M_prev;
408 operator==(
const _Self& __x,
const _Self& __y) _GLIBCXX_NOEXCEPT
409 {
return __x._M_node == __y._M_node; }
411#if __cpp_impl_three_way_comparison < 201907L
414 operator!=(
const _Self& __x,
const _Self& __y) _GLIBCXX_NOEXCEPT
415 {
return __x._M_node != __y._M_node; }
422_GLIBCXX_BEGIN_NAMESPACE_CXX11
424 template<
typename _Tp,
typename _Alloc>
429 rebind<_Tp>::other _Tp_alloc_type;
431 typedef typename _Tp_alloc_traits::template
432 rebind<_List_node<_Tp> >::other _Node_alloc_type;
435#if !_GLIBCXX_INLINE_VERSION
441 while (__first != __last)
443 __first = __first->_M_next;
451 :
public _Node_alloc_type
455 _List_impl() _GLIBCXX_NOEXCEPT_IF(
460 _List_impl(
const _Node_alloc_type& __a) _GLIBCXX_NOEXCEPT
461 : _Node_alloc_type(__a)
464#if __cplusplus >= 201103L
465 _List_impl(_List_impl&&) =
default;
467 _List_impl(_Node_alloc_type&& __a, _List_impl&& __x)
471 _List_impl(_Node_alloc_type&& __a) noexcept
479#if _GLIBCXX_USE_CXX11_ABI
480 size_t _M_get_size()
const {
return _M_impl._M_node._M_size; }
482 void _M_set_size(
size_t __n) { _M_impl._M_node._M_size = __n; }
484 void _M_inc_size(
size_t __n) { _M_impl._M_node._M_size += __n; }
486 void _M_dec_size(
size_t __n) { _M_impl._M_node._M_size -= __n; }
488# if !_GLIBCXX_INLINE_VERSION
492 {
return _S_distance(__first, __last); }
495 size_t _M_node_count()
const {
return _M_get_size(); }
499 size_t _M_get_size()
const {
return 0; }
500 void _M_set_size(
size_t) { }
501 void _M_inc_size(
size_t) { }
502 void _M_dec_size(
size_t) { }
504# if !_GLIBCXX_INLINE_VERSION
505 size_t _M_distance(
const void*,
const void*)
const {
return 0; }
508 size_t _M_node_count()
const
510 return _S_distance(_M_impl._M_node._M_next,
516 typename _Node_alloc_traits::pointer
521 _M_put_node(
typename _Node_alloc_traits::pointer __p) _GLIBCXX_NOEXCEPT
525 typedef _Alloc allocator_type;
528 _M_get_Node_allocator() _GLIBCXX_NOEXCEPT
531 const _Node_alloc_type&
532 _M_get_Node_allocator()
const _GLIBCXX_NOEXCEPT
535#if __cplusplus >= 201103L
541 _List_base(
const _Node_alloc_type& __a) _GLIBCXX_NOEXCEPT
545#if __cplusplus >= 201103L
548# if !_GLIBCXX_INLINE_VERSION
552 if (__x._M_get_Node_allocator() == _M_get_Node_allocator())
570 { _M_impl._M_node._M_move_nodes(
std::move(__x._M_impl._M_node)); }
578 _M_clear() _GLIBCXX_NOEXCEPT;
581 _M_init() _GLIBCXX_NOEXCEPT
582 { this->_M_impl._M_node._M_init(); }
631 template<
typename _Tp,
typename _Alloc = std::allocator<_Tp> >
634#ifdef _GLIBCXX_CONCEPT_CHECKS
636 typedef typename _Alloc::value_type _Alloc_value_type;
637# if __cplusplus < 201103L
638 __glibcxx_class_requires(_Tp, _SGIAssignableConcept)
640 __glibcxx_class_requires2(_Tp, _Alloc_value_type, _SameTypeConcept)
643#if __cplusplus >= 201103L
645 "std::list must have a non-const, non-volatile value_type");
646# if __cplusplus > 201703L || defined __STRICT_ANSI__
648 "std::list must have the same value_type as its allocator");
653 typedef typename _Base::_Tp_alloc_type _Tp_alloc_type;
655 typedef typename _Base::_Node_alloc_type _Node_alloc_type;
659 typedef _Tp value_type;
660 typedef typename _Tp_alloc_traits::pointer pointer;
661 typedef typename _Tp_alloc_traits::const_pointer const_pointer;
662 typedef typename _Tp_alloc_traits::reference reference;
663 typedef typename _Tp_alloc_traits::const_reference const_reference;
668 typedef size_t size_type;
669 typedef ptrdiff_t difference_type;
670 typedef _Alloc allocator_type;
677 using _Base::_M_impl;
678 using _Base::_M_put_node;
679 using _Base::_M_get_node;
680 using _Base::_M_get_Node_allocator;
688#if __cplusplus < 201103L
692 _Node* __p = this->_M_get_node();
695 _Tp_alloc_type __alloc(_M_get_Node_allocator());
696 __alloc.construct(__p->_M_valptr(), __x);
701 __throw_exception_again;
706 template<
typename... _Args>
710 auto __p = this->_M_get_node();
711 auto& __alloc = _M_get_Node_allocator();
712 __allocated_ptr<_Node_alloc_type> __guard{__alloc, __p};
713 _Node_alloc_traits::construct(__alloc, __p->_M_valptr(),
714 std::forward<_Args>(__args)...);
720#if _GLIBCXX_USE_CXX11_ABI
722 _S_distance(const_iterator __first, const_iterator __last)
727 _M_node_count()
const
728 {
return this->_M_get_size(); }
732 _S_distance(const_iterator, const_iterator)
737 _M_node_count()
const
748#if __cplusplus >= 201103L
759 list(
const allocator_type& __a) _GLIBCXX_NOEXCEPT
760 :
_Base(_Node_alloc_type(__a)) { }
762#if __cplusplus >= 201103L
772 list(size_type __n,
const allocator_type& __a = allocator_type())
773 :
_Base(_Node_alloc_type(__a))
774 { _M_default_initialize(__n); }
784 list(size_type __n,
const value_type& __value,
785 const allocator_type& __a = allocator_type())
786 :
_Base(_Node_alloc_type(__a))
787 { _M_fill_initialize(__n, __value); }
798 list(size_type __n,
const value_type& __value = value_type(),
799 const allocator_type& __a = allocator_type())
800 : _Base(_Node_alloc_type(__a))
801 { _M_fill_initialize(__n, __value); }
813 _S_select_on_copy(__x._M_get_Node_allocator()))
814 { _M_initialize_dispatch(__x.
begin(), __x.
end(), __false_type()); }
816#if __cplusplus >= 201103L
835 const allocator_type& __a = allocator_type())
836 :
_Base(_Node_alloc_type(__a))
837 { _M_initialize_dispatch(__l.begin(), __l.end(), __false_type()); }
839 list(
const list& __x,
const __type_identity_t<allocator_type>& __a)
840 : _Base(_Node_alloc_type(__a))
841 { _M_initialize_dispatch(__x.
begin(), __x.
end(), __false_type()); }
845 : _Base(_Node_alloc_type(__a),
std::move(__x))
849 : _Base(_Node_alloc_type(__a))
851 if (__x._M_get_Node_allocator() == this->_M_get_Node_allocator())
855 std::__make_move_if_noexcept_iterator(__x.
end()));
859 list(
list&& __x,
const __type_identity_t<allocator_type>& __a)
860 noexcept(_Node_alloc_traits::_S_always_equal())
862 typename _Node_alloc_traits::is_always_equal{})
876#if __cplusplus >= 201103L
877 template<
typename _InputIterator,
878 typename = std::_RequireInputIter<_InputIterator>>
879 list(_InputIterator __first, _InputIterator __last,
880 const allocator_type& __a = allocator_type())
881 :
_Base(_Node_alloc_type(__a))
882 { _M_initialize_dispatch(__first, __last, __false_type()); }
884 template<
typename _InputIterator>
885 list(_InputIterator __first, _InputIterator __last,
886 const allocator_type& __a = allocator_type())
887 : _Base(_Node_alloc_type(__a))
890 typedef typename std::__is_integer<_InputIterator>::__type _Integral;
891 _M_initialize_dispatch(__first, __last, _Integral());
895#if __cplusplus >= 201103L
917#if __cplusplus >= 201103L
930 noexcept(_Node_alloc_traits::_S_nothrow_move())
932 constexpr bool __move_storage =
933 _Node_alloc_traits::_S_propagate_on_move_assign()
934 || _Node_alloc_traits::_S_always_equal();
935 _M_move_assign(
std::move(__x), __bool_constant<__move_storage>());
949 this->
assign(__l.begin(), __l.end());
965 assign(size_type __n,
const value_type& __val)
966 { _M_fill_assign(__n, __val); }
980#if __cplusplus >= 201103L
981 template<
typename _InputIterator,
982 typename = std::_RequireInputIter<_InputIterator>>
984 assign(_InputIterator __first, _InputIterator __last)
985 { _M_assign_dispatch(__first, __last, __false_type()); }
987 template<
typename _InputIterator>
989 assign(_InputIterator __first, _InputIterator __last)
992 typedef typename std::__is_integer<_InputIterator>::__type _Integral;
993 _M_assign_dispatch(__first, __last, _Integral());
997#if __cplusplus >= 201103L
1007 { this->_M_assign_dispatch(__l.begin(), __l.end(), __false_type()); }
1013 {
return allocator_type(_Base::_M_get_Node_allocator()); }
1023 {
return iterator(this->_M_impl._M_node._M_next); }
1043 {
return iterator(&this->_M_impl._M_node); }
1071 const_reverse_iterator
1091 const_reverse_iterator
1095#if __cplusplus >= 201103L
1122 const_reverse_iterator
1132 const_reverse_iterator
1142 _GLIBCXX_NODISCARD
bool
1144 {
return this->_M_impl._M_node._M_next == &this->_M_impl._M_node; }
1150 {
return _M_node_count(); }
1158#if __cplusplus >= 201103L
1169 resize(size_type __new_size);
1182 resize(size_type __new_size,
const value_type& __x);
1195 resize(size_type __new_size, value_type __x = value_type());
1206 {
return *
begin(); }
1215 {
return *
begin(); }
1256 { this->_M_insert(
begin(), __x); }
1258#if __cplusplus >= 201103L
1263 template<
typename... _Args>
1264#if __cplusplus > 201402L
1269 emplace_front(_Args&&... __args)
1271 this->_M_insert(
begin(), std::forward<_Args>(__args)...);
1272#if __cplusplus > 201402L
1292 { this->_M_erase(
begin()); }
1306 { this->_M_insert(
end(), __x); }
1308#if __cplusplus >= 201103L
1313 template<
typename... _Args>
1314#if __cplusplus > 201402L
1319 emplace_back(_Args&&... __args)
1321 this->_M_insert(
end(), std::forward<_Args>(__args)...);
1322#if __cplusplus > 201402L
1341 { this->_M_erase(
iterator(this->_M_impl._M_node._M_prev)); }
1343#if __cplusplus >= 201103L
1356 template<
typename... _Args>
1358 emplace(const_iterator __position, _Args&&... __args);
1372 insert(const_iterator __position,
const value_type& __x);
1389#if __cplusplus >= 201103L
1422 {
return this->
insert(__p, __l.begin(), __l.end()); }
1425#if __cplusplus >= 201103L
1441 insert(const_iterator __position, size_type __n,
const value_type& __x);
1456 insert(
iterator __position, size_type __n,
const value_type& __x)
1459 splice(__position, __tmp);
1463#if __cplusplus >= 201103L
1479 template<
typename _InputIterator,
1480 typename = std::_RequireInputIter<_InputIterator>>
1482 insert(const_iterator __position, _InputIterator __first,
1483 _InputIterator __last);
1498 template<
typename _InputIterator>
1500 insert(iterator __position, _InputIterator __first,
1501 _InputIterator __last)
1504 splice(__position, __tmp);
1524#if __cplusplus >= 201103L
1525 erase(const_iterator __position)
noexcept;
1527 erase(iterator __position);
1549#if __cplusplus >= 201103L
1555 while (__first != __last)
1556 __first =
erase(__first);
1557 return __last._M_const_cast();
1574 __detail::_List_node_base::swap(this->_M_impl._M_node,
1575 __x._M_impl._M_node);
1577 size_t __xsize = __x._M_get_size();
1578 __x._M_set_size(this->_M_get_size());
1579 this->_M_set_size(__xsize);
1581 _Node_alloc_traits::_S_on_swap(this->_M_get_Node_allocator(),
1582 __x._M_get_Node_allocator());
1611#if __cplusplus >= 201103L
1619 _M_check_equal_allocators(__x);
1621 this->_M_transfer(__position._M_const_cast(),
1624 this->_M_inc_size(__x._M_get_size());
1629#if __cplusplus >= 201103L
1631 splice(const_iterator __position,
list& __x)
noexcept
1635#if __cplusplus >= 201103L
1662 iterator __j = __i._M_const_cast();
1664 if (__position == __i || __position == __j)
1668 _M_check_equal_allocators(__x);
1670 this->_M_transfer(__position._M_const_cast(),
1671 __i._M_const_cast(), __j);
1673 this->_M_inc_size(1);
1677#if __cplusplus >= 201103L
1693#if __cplusplus >= 201103L
1728 if (__first != __last)
1731 _M_check_equal_allocators(__x);
1733 size_t __n = _S_distance(__first, __last);
1734 this->_M_inc_size(__n);
1735 __x._M_dec_size(__n);
1737 this->_M_transfer(__position._M_const_cast(),
1738 __first._M_const_cast(),
1739 __last._M_const_cast());
1743#if __cplusplus >= 201103L
1764#if __cplusplus > 201703L
1765# define __cpp_lib_list_remove_return_type 201806L
1766 typedef size_type __remove_return_type;
1767# define _GLIBCXX_LIST_REMOVE_RETURN_TYPE_TAG \
1768 __attribute__((__abi_tag__("__cxx20")))
1770 typedef void __remove_return_type;
1771# define _GLIBCXX_LIST_REMOVE_RETURN_TYPE_TAG
1786 _GLIBCXX_LIST_REMOVE_RETURN_TYPE_TAG
1787 __remove_return_type
1788 remove(
const _Tp& __value);
1801 template<
typename _Predicate>
1802 __remove_return_type
1815 _GLIBCXX_LIST_REMOVE_RETURN_TYPE_TAG
1816 __remove_return_type
1831 template<
typename _BinaryPredicate>
1832 __remove_return_type
1833 unique(_BinaryPredicate);
1835#undef _GLIBCXX_LIST_REMOVE_RETURN_TYPE_TAG
1846#if __cplusplus >= 201103L
1871#if __cplusplus >= 201103L
1872 template<
typename _StrictWeakOrdering>
1874 merge(
list&& __x, _StrictWeakOrdering __comp);
1876 template<
typename _StrictWeakOrdering>
1878 merge(
list& __x, _StrictWeakOrdering __comp)
1881 template<
typename _StrictWeakOrdering>
1883 merge(
list& __x, _StrictWeakOrdering __comp);
1893 { this->_M_impl._M_node._M_reverse(); }
1910 template<
typename _StrictWeakOrdering>
1912 sort(_StrictWeakOrdering);
1921 template<
typename _Integer>
1923 _M_initialize_dispatch(_Integer __n, _Integer __x, __true_type)
1924 { _M_fill_initialize(
static_cast<size_type
>(__n), __x); }
1927 template<
typename _InputIterator>
1929 _M_initialize_dispatch(_InputIterator __first, _InputIterator __last,
1932 for (; __first != __last; ++__first)
1933#
if __cplusplus >= 201103L
1934 emplace_back(*__first);
1943 _M_fill_initialize(size_type __n,
const value_type& __x)
1949#if __cplusplus >= 201103L
1952 _M_default_initialize(size_type __n)
1960 _M_default_append(size_type __n);
1969 template<
typename _Integer>
1971 _M_assign_dispatch(_Integer __n, _Integer __val, __true_type)
1972 { _M_fill_assign(__n, __val); }
1975 template<
typename _InputIterator>
1977 _M_assign_dispatch(_InputIterator __first, _InputIterator __last,
1983 _M_fill_assign(size_type __n,
const value_type& __val);
1988 _M_transfer(iterator __position, iterator __first, iterator __last)
1989 { __position._M_node->_M_transfer(__first._M_node, __last._M_node); }
1992#if __cplusplus < 201103L
1994 _M_insert(iterator __position,
const value_type& __x)
1997 __tmp->_M_hook(__position._M_node);
1998 this->_M_inc_size(1);
2001 template<
typename... _Args>
2003 _M_insert(iterator __position, _Args&&... __args)
2006 __tmp->_M_hook(__position._M_node);
2007 this->_M_inc_size(1);
2013 _M_erase(iterator __position) _GLIBCXX_NOEXCEPT
2015 this->_M_dec_size(1);
2016 __position._M_node->_M_unhook();
2017 _Node* __n =
static_cast<_Node*
>(__position._M_node);
2018#if __cplusplus >= 201103L
2019 _Node_alloc_traits::destroy(_M_get_Node_allocator(), __n->_M_valptr());
2021 _Tp_alloc_type(_M_get_Node_allocator()).destroy(__n->_M_valptr());
2029 _M_check_equal_allocators(
list& __x) _GLIBCXX_NOEXCEPT
2031 if (std::__alloc_neq<typename _Base::_Node_alloc_type>::
2032 _S_do_it(_M_get_Node_allocator(), __x._M_get_Node_allocator()))
2038 _M_resize_pos(size_type& __new_size)
const;
2040#if __cplusplus >= 201103L
2046 std::__alloc_on_move(this->_M_get_Node_allocator(),
2047 __x._M_get_Node_allocator());
2053 if (__x._M_get_Node_allocator() == this->_M_get_Node_allocator())
2058 _M_assign_dispatch(std::make_move_iterator(__x.begin()),
2059 std::make_move_iterator(__x.end()),
2064#if _GLIBCXX_USE_CXX11_ABI
2066 struct _Finalize_merge
2069 _Finalize_merge(
list& __dest,
list& __src,
const iterator& __src_next)
2070 : _M_dest(__dest), _M_src(__src), _M_next(__src_next)
2078 const size_t __num_unmerged =
std::distance(_M_next, _M_src.end());
2079 const size_t __orig_size = _M_src._M_get_size();
2080 _M_dest._M_inc_size(__orig_size - __num_unmerged);
2081 _M_src._M_set_size(__num_unmerged);
2086 const iterator& _M_next;
2088#if __cplusplus >= 201103L
2089 _Finalize_merge(
const _Finalize_merge&) =
delete;
2093 struct _Finalize_merge
2094 {
explicit _Finalize_merge(
list&,
list&,
const iterator&) { } };
2099#if __cpp_deduction_guides >= 201606
2100 template<
typename _InputIterator,
typename _ValT
2101 =
typename iterator_traits<_InputIterator>::value_type,
2102 typename _Allocator = allocator<_ValT>,
2103 typename = _RequireInputIter<_InputIterator>,
2104 typename = _RequireAllocator<_Allocator>>
2105 list(_InputIterator, _InputIterator, _Allocator = _Allocator())
2106 -> list<_ValT, _Allocator>;
2109_GLIBCXX_END_NAMESPACE_CXX11
2121 template<
typename _Tp,
typename _Alloc>
2126#if _GLIBCXX_USE_CXX11_ABI
2132 const_iterator __end1 = __x.
end();
2133 const_iterator __end2 = __y.
end();
2135 const_iterator __i1 = __x.
begin();
2136 const_iterator __i2 = __y.
begin();
2137 while (__i1 != __end1 && __i2 != __end2 && *__i1 == *__i2)
2142 return __i1 == __end1 && __i2 == __end2;
2145#if __cpp_lib_three_way_comparison
2157 template<
typename _Tp,
typename _Alloc>
2159 inline __detail::__synth3way_t<_Tp>
2160 operator<=>(
const list<_Tp, _Alloc>& __x,
const list<_Tp, _Alloc>& __y)
2162 return std::lexicographical_compare_three_way(__x.begin(), __x.end(),
2163 __y.begin(), __y.end(),
2164 __detail::__synth3way);
2178 template<
typename _Tp,
typename _Alloc>
2182 {
return std::lexicographical_compare(__x.
begin(), __x.
end(),
2186 template<
typename _Tp,
typename _Alloc>
2190 {
return !(__x == __y); }
2193 template<
typename _Tp,
typename _Alloc>
2197 {
return __y < __x; }
2200 template<
typename _Tp,
typename _Alloc>
2204 {
return !(__y < __x); }
2207 template<
typename _Tp,
typename _Alloc>
2211 {
return !(__x < __y); }
2215 template<
typename _Tp,
typename _Alloc>
2218 _GLIBCXX_NOEXCEPT_IF(
noexcept(__x.swap(__y)))
2221_GLIBCXX_END_NAMESPACE_CONTAINER
2223#if _GLIBCXX_USE_CXX11_ABI
2226 template<
typename _Tp>
2228 __distance(_GLIBCXX_STD_C::_List_iterator<_Tp> __first,
2229 _GLIBCXX_STD_C::_List_iterator<_Tp> __last,
2230 input_iterator_tag __tag)
2232 typedef _GLIBCXX_STD_C::_List_const_iterator<_Tp> _CIter;
2233 return std::__distance(_CIter(__first), _CIter(__last), __tag);
2236 template<
typename _Tp>
2238 __distance(_GLIBCXX_STD_C::_List_const_iterator<_Tp> __first,
2239 _GLIBCXX_STD_C::_List_const_iterator<_Tp> __last,
2242 typedef __detail::_List_node_header _Sentinel;
2243 _GLIBCXX_STD_C::_List_const_iterator<_Tp> __beyond = __last;
2245 const bool __whole = __first == __beyond;
2246 if (__builtin_constant_p (__whole) && __whole)
2247 return static_cast<const _Sentinel*
>(__last._M_node)->_M_size;
2250 while (__first != __last)
2259_GLIBCXX_END_NAMESPACE_VERSION
integral_constant< bool, true > true_type
The type used as a compile-time boolean with true value.
integral_constant< bool, 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.
void swap(any &__x, any &__y) noexcept
Exchange the states of two any objects.
constexpr _Tp * __addressof(_Tp &__r) noexcept
Same as C++11 std::addressof.
ISO C++ entities toplevel namespace is std.
constexpr iterator_traits< _InputIterator >::difference_type distance(_InputIterator __first, _InputIterator __last)
A generalization of pointer arithmetic.
is_nothrow_default_constructible
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.