63#if __cplusplus >= 201103L
69namespace std _GLIBCXX_VISIBILITY(default)
71_GLIBCXX_BEGIN_NAMESPACE_VERSION
95 _M_reverse() _GLIBCXX_USE_NOEXCEPT;
101 _M_unhook() _GLIBCXX_USE_NOEXCEPT;
107#if _GLIBCXX_USE_CXX11_ABI
114#if __cplusplus >= 201103L
117# if _GLIBCXX_USE_CXX11_ABI
118 , _M_size(__x._M_size)
121 if (__x._M_base()->_M_next == __x._M_base())
122 this->_M_next = this->_M_prev =
this;
125 this->_M_next->_M_prev = this->_M_prev->_M_next = this->_M_base();
134 if (__xnode->_M_next == __xnode)
139 __node->_M_next = __xnode->_M_next;
140 __node->_M_prev = __xnode->_M_prev;
141 __node->_M_next->_M_prev = __node->_M_prev->_M_next = __node;
142# if _GLIBCXX_USE_CXX11_ABI
143 _M_size = __x._M_size;
151 _M_init() _GLIBCXX_NOEXCEPT
153 this->_M_next = this->_M_prev =
this;
154#if _GLIBCXX_USE_CXX11_ABI
166 _Scratch_list() { _M_next = _M_prev =
this; }
168 bool empty()
const {
return _M_next ==
this; }
170 void swap(_List_node_base& __l) { _List_node_base::swap(*
this, __l); }
172 template<
typename _Iter,
typename _Cmp>
178 operator()(__detail::_List_node_base* __lhs,
179 __detail::_List_node_base* __rhs)
180 {
return _M_cmp(*_Iter(__lhs), *_Iter(__rhs)); }
183 template<
typename _Iter>
184 struct _Ptr_cmp<_Iter, void>
187 operator()(__detail::_List_node_base* __lhs,
188 __detail::_List_node_base* __rhs)
const
189 {
return *_Iter(__lhs) < *_Iter(__rhs); }
193 template<
typename _Cmp>
195 merge(_List_node_base& __x, _Cmp __comp)
197 _List_node_base* __first1 = _M_next;
198 _List_node_base*
const __last1 =
this;
199 _List_node_base* __first2 = __x._M_next;
202 while (__first1 != __last1 && __first2 != __last2)
204 if (__comp(__first2, __first1))
206 _List_node_base* __next = __first2->_M_next;
207 __first1->_M_transfer(__first2, __next);
211 __first1 = __first1->_M_next;
213 if (__first2 != __last2)
214 this->_M_transfer(__first2, __last2);
218 void _M_take_one(_List_node_base* __i)
219 { this->_M_transfer(__i, __i->_M_next); }
222 void _M_put_all(_List_node_base* __i)
225 __i->_M_transfer(_M_next,
this);
231_GLIBCXX_BEGIN_NAMESPACE_CONTAINER
234 template<
typename _Tp>
237#if __cplusplus >= 201103L
238 __gnu_cxx::__aligned_membuf<_Tp> _M_storage;
239 _Tp* _M_valptr() {
return _M_storage._M_ptr(); }
240 _Tp
const* _M_valptr()
const {
return _M_storage._M_ptr(); }
253 template<
typename _Tp>
259 typedef ptrdiff_t difference_type;
261 typedef _Tp value_type;
262 typedef _Tp* pointer;
263 typedef _Tp& reference;
273 _M_const_cast()
const _GLIBCXX_NOEXCEPT
279 operator*()
const _GLIBCXX_NOEXCEPT
280 {
return *
static_cast<_Node*
>(_M_node)->_M_valptr(); }
284 operator->()
const _GLIBCXX_NOEXCEPT
285 {
return static_cast<_Node*
>(_M_node)->_M_valptr(); }
288 operator++() _GLIBCXX_NOEXCEPT
290 _M_node = _M_node->_M_next;
295 operator++(
int) _GLIBCXX_NOEXCEPT
298 _M_node = _M_node->_M_next;
303 operator--() _GLIBCXX_NOEXCEPT
305 _M_node = _M_node->_M_prev;
310 operator--(
int) _GLIBCXX_NOEXCEPT
313 _M_node = _M_node->_M_prev;
319 operator==(
const _Self& __x,
const _Self& __y) _GLIBCXX_NOEXCEPT
320 {
return __x._M_node == __y._M_node; }
322#if __cpp_impl_three_way_comparison < 201907L
325 operator!=(
const _Self& __x,
const _Self& __y) _GLIBCXX_NOEXCEPT
326 {
return __x._M_node != __y._M_node; }
338 template<
typename _Tp>
345 typedef ptrdiff_t difference_type;
347 typedef _Tp value_type;
348 typedef const _Tp* pointer;
349 typedef const _Tp& reference;
360 : _M_node(__x._M_node) { }
363 _M_const_cast()
const _GLIBCXX_NOEXCEPT
369 operator*()
const _GLIBCXX_NOEXCEPT
370 {
return *
static_cast<_Node*
>(_M_node)->_M_valptr(); }
374 operator->()
const _GLIBCXX_NOEXCEPT
375 {
return static_cast<_Node*
>(_M_node)->_M_valptr(); }
378 operator++() _GLIBCXX_NOEXCEPT
380 _M_node = _M_node->_M_next;
385 operator++(
int) _GLIBCXX_NOEXCEPT
388 _M_node = _M_node->_M_next;
393 operator--() _GLIBCXX_NOEXCEPT
395 _M_node = _M_node->_M_prev;
400 operator--(
int) _GLIBCXX_NOEXCEPT
403 _M_node = _M_node->_M_prev;
409 operator==(
const _Self& __x,
const _Self& __y) _GLIBCXX_NOEXCEPT
410 {
return __x._M_node == __y._M_node; }
412#if __cpp_impl_three_way_comparison < 201907L
415 operator!=(
const _Self& __x,
const _Self& __y) _GLIBCXX_NOEXCEPT
416 {
return __x._M_node != __y._M_node; }
423_GLIBCXX_BEGIN_NAMESPACE_CXX11
425 template<
typename _Tp,
typename _Alloc>
430 rebind<_Tp>::other _Tp_alloc_type;
432 typedef typename _Tp_alloc_traits::template
433 rebind<_List_node<_Tp> >::other _Node_alloc_type;
436#if !_GLIBCXX_INLINE_VERSION
442 while (__first != __last)
444 __first = __first->_M_next;
452 :
public _Node_alloc_type
456 _List_impl() _GLIBCXX_NOEXCEPT_IF(
461 _List_impl(
const _Node_alloc_type& __a) _GLIBCXX_NOEXCEPT
462 : _Node_alloc_type(__a)
465#if __cplusplus >= 201103L
466 _List_impl(_List_impl&&) =
default;
468 _List_impl(_Node_alloc_type&& __a, _List_impl&& __x)
472 _List_impl(_Node_alloc_type&& __a) noexcept
480#if _GLIBCXX_USE_CXX11_ABI
481 size_t _M_get_size()
const {
return _M_impl._M_node._M_size; }
483 void _M_set_size(
size_t __n) { _M_impl._M_node._M_size = __n; }
485 void _M_inc_size(
size_t __n) { _M_impl._M_node._M_size += __n; }
487 void _M_dec_size(
size_t __n) { _M_impl._M_node._M_size -= __n; }
489# if !_GLIBCXX_INLINE_VERSION
493 {
return _S_distance(__first, __last); }
496 size_t _M_node_count()
const {
return _M_get_size(); }
500 size_t _M_get_size()
const {
return 0; }
501 void _M_set_size(
size_t) { }
502 void _M_inc_size(
size_t) { }
503 void _M_dec_size(
size_t) { }
505# if !_GLIBCXX_INLINE_VERSION
506 size_t _M_distance(
const void*,
const void*)
const {
return 0; }
509 size_t _M_node_count()
const
511 return _S_distance(_M_impl._M_node._M_next,
517 typename _Node_alloc_traits::pointer
522 _M_put_node(
typename _Node_alloc_traits::pointer __p) _GLIBCXX_NOEXCEPT
526 typedef _Alloc allocator_type;
529 _M_get_Node_allocator() _GLIBCXX_NOEXCEPT
532 const _Node_alloc_type&
533 _M_get_Node_allocator()
const _GLIBCXX_NOEXCEPT
536#if __cplusplus >= 201103L
542 _List_base(
const _Node_alloc_type& __a) _GLIBCXX_NOEXCEPT
546#if __cplusplus >= 201103L
549# if !_GLIBCXX_INLINE_VERSION
553 if (__x._M_get_Node_allocator() == _M_get_Node_allocator())
571 { _M_impl._M_node._M_move_nodes(
std::move(__x._M_impl._M_node)); }
579 _M_clear() _GLIBCXX_NOEXCEPT;
582 _M_init() _GLIBCXX_NOEXCEPT
583 { this->_M_impl._M_node._M_init(); }
632 template<
typename _Tp,
typename _Alloc = std::allocator<_Tp> >
635#ifdef _GLIBCXX_CONCEPT_CHECKS
637 typedef typename _Alloc::value_type _Alloc_value_type;
638# if __cplusplus < 201103L
639 __glibcxx_class_requires(_Tp, _SGIAssignableConcept)
641 __glibcxx_class_requires2(_Tp, _Alloc_value_type, _SameTypeConcept)
644#if __cplusplus >= 201103L
646 "std::list must have a non-const, non-volatile value_type");
647# if __cplusplus > 201703L || defined __STRICT_ANSI__
649 "std::list must have the same value_type as its allocator");
654 typedef typename _Base::_Tp_alloc_type _Tp_alloc_type;
656 typedef typename _Base::_Node_alloc_type _Node_alloc_type;
660 typedef _Tp value_type;
661 typedef typename _Tp_alloc_traits::pointer pointer;
662 typedef typename _Tp_alloc_traits::const_pointer const_pointer;
663 typedef typename _Tp_alloc_traits::reference reference;
664 typedef typename _Tp_alloc_traits::const_reference const_reference;
669 typedef size_t size_type;
670 typedef ptrdiff_t difference_type;
671 typedef _Alloc allocator_type;
678 using _Base::_M_impl;
679 using _Base::_M_put_node;
680 using _Base::_M_get_node;
681 using _Base::_M_get_Node_allocator;
689#if __cplusplus < 201103L
693 _Node* __p = this->_M_get_node();
696 _Tp_alloc_type __alloc(_M_get_Node_allocator());
697 __alloc.construct(__p->_M_valptr(), __x);
702 __throw_exception_again;
707 template<
typename... _Args>
711 auto __p = this->_M_get_node();
712 auto& __alloc = _M_get_Node_allocator();
713 __allocated_ptr<_Node_alloc_type> __guard{__alloc, __p};
714 _Node_alloc_traits::construct(__alloc, __p->_M_valptr(),
721#if _GLIBCXX_USE_CXX11_ABI
723 _S_distance(const_iterator __first, const_iterator __last)
728 _M_node_count()
const
729 {
return this->_M_get_size(); }
733 _S_distance(const_iterator, const_iterator)
738 _M_node_count()
const
749#if __cplusplus >= 201103L
760 list(
const allocator_type& __a) _GLIBCXX_NOEXCEPT
761 :
_Base(_Node_alloc_type(__a)) { }
763#if __cplusplus >= 201103L
773 list(size_type __n,
const allocator_type& __a = allocator_type())
774 :
_Base(_Node_alloc_type(__a))
775 { _M_default_initialize(__n); }
785 list(size_type __n,
const value_type& __value,
786 const allocator_type& __a = allocator_type())
787 :
_Base(_Node_alloc_type(__a))
788 { _M_fill_initialize(__n, __value); }
799 list(size_type __n,
const value_type& __value = value_type(),
800 const allocator_type& __a = allocator_type())
801 : _Base(_Node_alloc_type(__a))
802 { _M_fill_initialize(__n, __value); }
814 _S_select_on_copy(__x._M_get_Node_allocator()))
815 { _M_initialize_dispatch(__x.
begin(), __x.
end(), __false_type()); }
817#if __cplusplus >= 201103L
836 const allocator_type& __a = allocator_type())
837 :
_Base(_Node_alloc_type(__a))
838 { _M_initialize_dispatch(__l.begin(), __l.end(), __false_type()); }
840 list(
const list& __x,
const __type_identity_t<allocator_type>& __a)
841 : _Base(_Node_alloc_type(__a))
842 { _M_initialize_dispatch(__x.
begin(), __x.
end(), __false_type()); }
845 list(list&& __x,
const allocator_type& __a, true_type) noexcept
846 : _Base(_Node_alloc_type(__a),
std::move(__x))
849 list(list&& __x,
const allocator_type& __a, false_type)
850 : _Base(_Node_alloc_type(__a))
852 if (__x._M_get_Node_allocator() == this->_M_get_Node_allocator())
856 std::__make_move_if_noexcept_iterator(__x.
end()));
860 list(list&& __x,
const __type_identity_t<allocator_type>& __a)
861 noexcept(_Node_alloc_traits::_S_always_equal())
863 typename _Node_alloc_traits::is_always_equal{})
877#if __cplusplus >= 201103L
878 template<
typename _InputIterator,
879 typename = std::_RequireInputIter<_InputIterator>>
880 list(_InputIterator __first, _InputIterator __last,
881 const allocator_type& __a = allocator_type())
882 :
_Base(_Node_alloc_type(__a))
883 { _M_initialize_dispatch(__first, __last, __false_type()); }
885 template<
typename _InputIterator>
886 list(_InputIterator __first, _InputIterator __last,
887 const allocator_type& __a = allocator_type())
888 : _Base(_Node_alloc_type(__a))
891 typedef typename std::__is_integer<_InputIterator>::__type _Integral;
892 _M_initialize_dispatch(__first, __last, _Integral());
896#if __cplusplus >= 201103L
918#if __cplusplus >= 201103L
931 noexcept(_Node_alloc_traits::_S_nothrow_move())
933 constexpr bool __move_storage =
934 _Node_alloc_traits::_S_propagate_on_move_assign()
935 || _Node_alloc_traits::_S_always_equal();
936 _M_move_assign(
std::move(__x), __bool_constant<__move_storage>());
950 this->
assign(__l.begin(), __l.end());
966 assign(size_type __n,
const value_type& __val)
967 { _M_fill_assign(__n, __val); }
981#if __cplusplus >= 201103L
982 template<
typename _InputIterator,
983 typename = std::_RequireInputIter<_InputIterator>>
985 assign(_InputIterator __first, _InputIterator __last)
986 { _M_assign_dispatch(__first, __last, __false_type()); }
988 template<
typename _InputIterator>
990 assign(_InputIterator __first, _InputIterator __last)
993 typedef typename std::__is_integer<_InputIterator>::__type _Integral;
994 _M_assign_dispatch(__first, __last, _Integral());
998#if __cplusplus >= 201103L
1008 { this->_M_assign_dispatch(__l.begin(), __l.end(), __false_type()); }
1014 {
return allocator_type(_Base::_M_get_Node_allocator()); }
1024 {
return iterator(this->_M_impl._M_node._M_next); }
1044 {
return iterator(&this->_M_impl._M_node); }
1072 const_reverse_iterator
1092 const_reverse_iterator
1096#if __cplusplus >= 201103L
1123 const_reverse_iterator
1133 const_reverse_iterator
1143 _GLIBCXX_NODISCARD
bool
1145 {
return this->_M_impl._M_node._M_next == &this->_M_impl._M_node; }
1151 {
return _M_node_count(); }
1159#if __cplusplus >= 201103L
1170 resize(size_type __new_size);
1183 resize(size_type __new_size,
const value_type& __x);
1196 resize(size_type __new_size, value_type __x = value_type());
1208 __glibcxx_requires_nonempty();
1220 __glibcxx_requires_nonempty();
1232 __glibcxx_requires_nonempty();
1246 __glibcxx_requires_nonempty();
1265 { this->_M_insert(
begin(), __x); }
1267#if __cplusplus >= 201103L
1272 template<
typename... _Args>
1273#if __cplusplus > 201402L
1278 emplace_front(_Args&&... __args)
1281#if __cplusplus > 201402L
1301 { this->_M_erase(
begin()); }
1315 { this->_M_insert(
end(), __x); }
1317#if __cplusplus >= 201103L
1322 template<
typename... _Args>
1323#if __cplusplus > 201402L
1328 emplace_back(_Args&&... __args)
1331#if __cplusplus > 201402L
1350 { this->_M_erase(
iterator(this->_M_impl._M_node._M_prev)); }
1352#if __cplusplus >= 201103L
1365 template<
typename... _Args>
1367 emplace(const_iterator __position, _Args&&... __args);
1381 insert(const_iterator __position,
const value_type& __x);
1398#if __cplusplus >= 201103L
1431 {
return this->
insert(__p, __l.begin(), __l.end()); }
1434#if __cplusplus >= 201103L
1450 insert(const_iterator __position, size_type __n,
const value_type& __x);
1465 insert(
iterator __position, size_type __n,
const value_type& __x)
1468 splice(__position, __tmp);
1472#if __cplusplus >= 201103L
1488 template<
typename _InputIterator,
1489 typename = std::_RequireInputIter<_InputIterator>>
1491 insert(const_iterator __position, _InputIterator __first,
1492 _InputIterator __last);
1507 template<
typename _InputIterator>
1509 insert(iterator __position, _InputIterator __first,
1510 _InputIterator __last)
1513 splice(__position, __tmp);
1533#if __cplusplus >= 201103L
1534 erase(const_iterator __position)
noexcept;
1536 erase(iterator __position);
1558#if __cplusplus >= 201103L
1564 while (__first != __last)
1565 __first =
erase(__first);
1566 return __last._M_const_cast();
1583 __detail::_List_node_base::swap(this->_M_impl._M_node,
1584 __x._M_impl._M_node);
1586 size_t __xsize = __x._M_get_size();
1587 __x._M_set_size(this->_M_get_size());
1588 this->_M_set_size(__xsize);
1590 _Node_alloc_traits::_S_on_swap(this->_M_get_Node_allocator(),
1591 __x._M_get_Node_allocator());
1620#if __cplusplus >= 201103L
1628 _M_check_equal_allocators(__x);
1630 this->_M_transfer(__position._M_const_cast(),
1633 this->_M_inc_size(__x._M_get_size());
1638#if __cplusplus >= 201103L
1640 splice(const_iterator __position,
list& __x)
noexcept
1644#if __cplusplus >= 201103L
1671 iterator __j = __i._M_const_cast();
1673 if (__position == __i || __position == __j)
1677 _M_check_equal_allocators(__x);
1679 this->_M_transfer(__position._M_const_cast(),
1680 __i._M_const_cast(), __j);
1682 this->_M_inc_size(1);
1686#if __cplusplus >= 201103L
1702#if __cplusplus >= 201103L
1737 if (__first != __last)
1740 _M_check_equal_allocators(__x);
1742 size_t __n = _S_distance(__first, __last);
1743 this->_M_inc_size(__n);
1744 __x._M_dec_size(__n);
1746 this->_M_transfer(__position._M_const_cast(),
1747 __first._M_const_cast(),
1748 __last._M_const_cast());
1752#if __cplusplus >= 201103L
1773#ifdef __glibcxx_list_remove_return_type
1774 typedef size_type __remove_return_type;
1775# define _GLIBCXX_LIST_REMOVE_RETURN_TYPE_TAG \
1776 __attribute__((__abi_tag__("__cxx20")))
1778 typedef void __remove_return_type;
1779# define _GLIBCXX_LIST_REMOVE_RETURN_TYPE_TAG
1794 _GLIBCXX_LIST_REMOVE_RETURN_TYPE_TAG
1795 __remove_return_type
1796 remove(
const _Tp& __value);
1809 template<
typename _Predicate>
1810 __remove_return_type
1823 _GLIBCXX_LIST_REMOVE_RETURN_TYPE_TAG
1824 __remove_return_type
1839 template<
typename _BinaryPredicate>
1840 __remove_return_type
1841 unique(_BinaryPredicate);
1843#undef _GLIBCXX_LIST_REMOVE_RETURN_TYPE_TAG
1854#if __cplusplus >= 201103L
1879#if __cplusplus >= 201103L
1880 template<
typename _StrictWeakOrdering>
1882 merge(list&& __x, _StrictWeakOrdering __comp);
1884 template<
typename _StrictWeakOrdering>
1886 merge(list& __x, _StrictWeakOrdering __comp)
1889 template<
typename _StrictWeakOrdering>
1891 merge(list& __x, _StrictWeakOrdering __comp);
1901 { this->_M_impl._M_node._M_reverse(); }
1918 template<
typename _StrictWeakOrdering>
1920 sort(_StrictWeakOrdering);
1929 template<
typename _Integer>
1931 _M_initialize_dispatch(_Integer __n, _Integer __x, __true_type)
1932 { _M_fill_initialize(
static_cast<size_type
>(__n), __x); }
1935 template<
typename _InputIterator>
1937 _M_initialize_dispatch(_InputIterator __first, _InputIterator __last,
1940 for (; __first != __last; ++__first)
1941#
if __cplusplus >= 201103L
1942 emplace_back(*__first);
1951 _M_fill_initialize(size_type __n,
const value_type& __x)
1957#if __cplusplus >= 201103L
1960 _M_default_initialize(size_type __n)
1968 _M_default_append(size_type __n);
1977 template<
typename _Integer>
1979 _M_assign_dispatch(_Integer __n, _Integer __val, __true_type)
1980 { _M_fill_assign(__n, __val); }
1983 template<
typename _InputIterator>
1985 _M_assign_dispatch(_InputIterator __first, _InputIterator __last,
1991 _M_fill_assign(size_type __n,
const value_type& __val);
1996 _M_transfer(iterator __position, iterator __first, iterator __last)
1997 { __position._M_node->_M_transfer(__first._M_node, __last._M_node); }
2000#if __cplusplus < 201103L
2002 _M_insert(iterator __position,
const value_type& __x)
2005 __tmp->_M_hook(__position._M_node);
2006 this->_M_inc_size(1);
2009 template<
typename... _Args>
2011 _M_insert(iterator __position, _Args&&... __args)
2014 __tmp->_M_hook(__position._M_node);
2015 this->_M_inc_size(1);
2021 _M_erase(iterator __position) _GLIBCXX_NOEXCEPT
2023 this->_M_dec_size(1);
2024 __position._M_node->_M_unhook();
2025 _Node* __n =
static_cast<_Node*
>(__position._M_node);
2026#if __cplusplus >= 201103L
2027 _Node_alloc_traits::destroy(_M_get_Node_allocator(), __n->_M_valptr());
2029 _Tp_alloc_type(_M_get_Node_allocator()).destroy(__n->_M_valptr());
2037 _M_check_equal_allocators(
const list& __x) _GLIBCXX_NOEXCEPT
2039 if (_M_get_Node_allocator() != __x._M_get_Node_allocator())
2045 _M_resize_pos(size_type& __new_size)
const;
2047#if __cplusplus >= 201103L
2049 _M_move_assign(list&& __x, true_type)
noexcept
2053 std::__alloc_on_move(this->_M_get_Node_allocator(),
2054 __x._M_get_Node_allocator());
2058 _M_move_assign(list&& __x, false_type)
2060 if (__x._M_get_Node_allocator() == this->_M_get_Node_allocator())
2061 _M_move_assign(
std::move(__x), true_type{});
2065 _M_assign_dispatch(std::make_move_iterator(__x.begin()),
2066 std::make_move_iterator(__x.end()),
2071#if _GLIBCXX_USE_CXX11_ABI
2073 struct _Finalize_merge
2076 _Finalize_merge(list& __dest, list& __src,
const iterator& __src_next)
2077 : _M_dest(__dest), _M_src(__src), _M_next(__src_next)
2086 const size_t __orig_size = _M_src._M_get_size();
2087 _M_dest._M_inc_size(__orig_size - __num_unmerged);
2088 _M_src._M_set_size(__num_unmerged);
2093 const iterator& _M_next;
2095#if __cplusplus >= 201103L
2096 _Finalize_merge(
const _Finalize_merge&) =
delete;
2100 struct _Finalize_merge
2101 {
explicit _Finalize_merge(list&, list&,
const iterator&) { } };
2106#if __cpp_deduction_guides >= 201606
2107 template<
typename _InputIterator,
typename _ValT
2108 =
typename iterator_traits<_InputIterator>::value_type,
2109 typename _Allocator = allocator<_ValT>,
2110 typename = _RequireInputIter<_InputIterator>,
2111 typename = _RequireAllocator<_Allocator>>
2112 list(_InputIterator, _InputIterator, _Allocator = _Allocator())
2113 -> list<_ValT, _Allocator>;
2116_GLIBCXX_END_NAMESPACE_CXX11
2128 template<
typename _Tp,
typename _Alloc>
2133#if _GLIBCXX_USE_CXX11_ABI
2134 if (__x.
size() != __y.size())
2139 const_iterator __end1 = __x.
end();
2140 const_iterator __end2 = __y.end();
2142 const_iterator __i1 = __x.
begin();
2143 const_iterator __i2 = __y.begin();
2144 while (__i1 != __end1 && __i2 != __end2 && *__i1 == *__i2)
2149 return __i1 == __end1 && __i2 == __end2;
2152#if __cpp_lib_three_way_comparison
2164 template<
typename _Tp,
typename _Alloc>
2166 inline __detail::__synth3way_t<_Tp>
2167 operator<=>(
const list<_Tp, _Alloc>& __x,
const list<_Tp, _Alloc>& __y)
2170 __y.begin(), __y.end(),
2171 __detail::__synth3way);
2185 template<
typename _Tp,
typename _Alloc>
2188 operator<(
const list<_Tp, _Alloc>& __x,
const list<_Tp, _Alloc>& __y)
2189 {
return std::lexicographical_compare(__x.begin(), __x.end(),
2190 __y.begin(), __y.end()); }
2193 template<
typename _Tp,
typename _Alloc>
2196 operator!=(
const list<_Tp, _Alloc>& __x,
const list<_Tp, _Alloc>& __y)
2197 {
return !(__x == __y); }
2200 template<
typename _Tp,
typename _Alloc>
2203 operator>(
const list<_Tp, _Alloc>& __x,
const list<_Tp, _Alloc>& __y)
2204 {
return __y < __x; }
2207 template<
typename _Tp,
typename _Alloc>
2210 operator<=(
const list<_Tp, _Alloc>& __x,
const list<_Tp, _Alloc>& __y)
2211 {
return !(__y < __x); }
2214 template<
typename _Tp,
typename _Alloc>
2217 operator>=(
const list<_Tp, _Alloc>& __x,
const list<_Tp, _Alloc>& __y)
2218 {
return !(__x < __y); }
2222 template<
typename _Tp,
typename _Alloc>
2225 _GLIBCXX_NOEXCEPT_IF(
noexcept(__x.swap(__y)))
2228_GLIBCXX_END_NAMESPACE_CONTAINER
2230#if _GLIBCXX_USE_CXX11_ABI
2233 template<
typename _Tp>
2235 __distance(_GLIBCXX_STD_C::_List_iterator<_Tp> __first,
2236 _GLIBCXX_STD_C::_List_iterator<_Tp> __last,
2237 input_iterator_tag __tag)
2239 typedef _GLIBCXX_STD_C::_List_const_iterator<_Tp> _CIter;
2240 return std::__distance(_CIter(__first), _CIter(__last), __tag);
2243 template<
typename _Tp>
2245 __distance(_GLIBCXX_STD_C::_List_const_iterator<_Tp> __first,
2246 _GLIBCXX_STD_C::_List_const_iterator<_Tp> __last,
2249 typedef __detail::_List_node_header _Sentinel;
2250 _GLIBCXX_STD_C::_List_const_iterator<_Tp> __beyond = __last;
2252 const bool __whole = __first == __beyond;
2253 if (__builtin_constant_p (__whole) && __whole)
2254 return static_cast<const _Sentinel*
>(__last._M_node)->_M_size;
2257 while (__first != __last)
2266_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)
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 _Tp && forward(typename std::remove_reference< _Tp >::type &__t) noexcept
Forward an lvalue.
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.
is_nothrow_default_constructible
static constexpr void deallocate(_Alloc &__a, pointer __p, size_type __n)
static constexpr pointer allocate(_Alloc &__a, size_type __n)
static constexpr size_type max_size(const _Alloc &__a) noexcept
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.