63#if __cplusplus >= 201103L
68#if __glibcxx_ranges_to_container
73namespace std _GLIBCXX_VISIBILITY(default)
75_GLIBCXX_BEGIN_NAMESPACE_VERSION
99 _M_reverse() _GLIBCXX_USE_NOEXCEPT;
105 _M_unhook() _GLIBCXX_USE_NOEXCEPT;
111#if _GLIBCXX_USE_CXX11_ABI
118#if __cplusplus >= 201103L
121# if _GLIBCXX_USE_CXX11_ABI
122 , _M_size(__x._M_size)
125 if (__x._M_base()->_M_next == __x._M_base())
126 this->_M_next = this->_M_prev =
this;
129 this->_M_next->_M_prev = this->_M_prev->_M_next = this->_M_base();
138 if (__xnode->_M_next == __xnode)
143 __node->_M_next = __xnode->_M_next;
144 __node->_M_prev = __xnode->_M_prev;
145 __node->_M_next->_M_prev = __node->_M_prev->_M_next = __node;
146# if _GLIBCXX_USE_CXX11_ABI
147 _M_size = __x._M_size;
155 _M_init() _GLIBCXX_NOEXCEPT
157 this->_M_next = this->_M_prev =
this;
158#if _GLIBCXX_USE_CXX11_ABI
170 _Scratch_list() { _M_next = _M_prev =
this; }
172 bool empty()
const {
return _M_next ==
this; }
174 void swap(_List_node_base& __l) { _List_node_base::swap(*
this, __l); }
176 template<
typename _Iter,
typename _Cmp>
182 operator()(__detail::_List_node_base* __lhs,
183 __detail::_List_node_base* __rhs)
184 {
return _M_cmp(*_Iter(__lhs), *_Iter(__rhs)); }
187 template<
typename _Iter>
188 struct _Ptr_cmp<_Iter, void>
191 operator()(__detail::_List_node_base* __lhs,
192 __detail::_List_node_base* __rhs)
const
193 {
return *_Iter(__lhs) < *_Iter(__rhs); }
197 template<
typename _Cmp>
199 merge(_List_node_base& __x, _Cmp __comp)
201 _List_node_base* __first1 = _M_next;
202 _List_node_base*
const __last1 =
this;
203 _List_node_base* __first2 = __x._M_next;
206 while (__first1 != __last1 && __first2 != __last2)
208 if (__comp(__first2, __first1))
210 _List_node_base* __next = __first2->_M_next;
211 __first1->_M_transfer(__first2, __next);
215 __first1 = __first1->_M_next;
217 if (__first2 != __last2)
218 this->_M_transfer(__first2, __last2);
222 void _M_take_one(_List_node_base* __i)
223 { this->_M_transfer(__i, __i->_M_next); }
226 void _M_put_all(_List_node_base* __i)
229 __i->_M_transfer(_M_next,
this);
235_GLIBCXX_BEGIN_NAMESPACE_CONTAINER
238 template<
typename _Tp>
241#if __cplusplus >= 201103L
242 __gnu_cxx::__aligned_membuf<_Tp> _M_storage;
243 _Tp* _M_valptr() {
return _M_storage._M_ptr(); }
244 _Tp
const* _M_valptr()
const {
return _M_storage._M_ptr(); }
257 template<
typename _Tp>
263 typedef ptrdiff_t difference_type;
265 typedef _Tp value_type;
266 typedef _Tp* pointer;
267 typedef _Tp& reference;
277 _M_const_cast()
const _GLIBCXX_NOEXCEPT
283 operator*()
const _GLIBCXX_NOEXCEPT
284 {
return *
static_cast<_Node*
>(_M_node)->_M_valptr(); }
288 operator->()
const _GLIBCXX_NOEXCEPT
289 {
return static_cast<_Node*
>(_M_node)->_M_valptr(); }
292 operator++() _GLIBCXX_NOEXCEPT
294 _M_node = _M_node->_M_next;
299 operator++(
int) _GLIBCXX_NOEXCEPT
302 _M_node = _M_node->_M_next;
307 operator--() _GLIBCXX_NOEXCEPT
309 _M_node = _M_node->_M_prev;
314 operator--(
int) _GLIBCXX_NOEXCEPT
317 _M_node = _M_node->_M_prev;
323 operator==(
const _Self& __x,
const _Self& __y) _GLIBCXX_NOEXCEPT
324 {
return __x._M_node == __y._M_node; }
326#if __cpp_impl_three_way_comparison < 201907L
329 operator!=(
const _Self& __x,
const _Self& __y) _GLIBCXX_NOEXCEPT
330 {
return __x._M_node != __y._M_node; }
342 template<
typename _Tp>
349 typedef ptrdiff_t difference_type;
351 typedef _Tp value_type;
352 typedef const _Tp* pointer;
353 typedef const _Tp& reference;
364 : _M_node(__x._M_node) { }
367 _M_const_cast()
const _GLIBCXX_NOEXCEPT
373 operator*()
const _GLIBCXX_NOEXCEPT
374 {
return *
static_cast<_Node*
>(_M_node)->_M_valptr(); }
378 operator->()
const _GLIBCXX_NOEXCEPT
379 {
return static_cast<_Node*
>(_M_node)->_M_valptr(); }
382 operator++() _GLIBCXX_NOEXCEPT
384 _M_node = _M_node->_M_next;
389 operator++(
int) _GLIBCXX_NOEXCEPT
392 _M_node = _M_node->_M_next;
397 operator--() _GLIBCXX_NOEXCEPT
399 _M_node = _M_node->_M_prev;
404 operator--(
int) _GLIBCXX_NOEXCEPT
407 _M_node = _M_node->_M_prev;
413 operator==(
const _Self& __x,
const _Self& __y) _GLIBCXX_NOEXCEPT
414 {
return __x._M_node == __y._M_node; }
416#if __cpp_impl_three_way_comparison < 201907L
419 operator!=(
const _Self& __x,
const _Self& __y) _GLIBCXX_NOEXCEPT
420 {
return __x._M_node != __y._M_node; }
427_GLIBCXX_BEGIN_NAMESPACE_CXX11
429 template<
typename _Tp,
typename _Alloc>
434 rebind<_Tp>::other _Tp_alloc_type;
436 typedef typename _Tp_alloc_traits::template
437 rebind<_List_node<_Tp> >::other _Node_alloc_type;
440#if !_GLIBCXX_INLINE_VERSION
446 while (__first != __last)
448 __first = __first->_M_next;
456 :
public _Node_alloc_type
460 _List_impl() _GLIBCXX_NOEXCEPT_IF(
465 _List_impl(
const _Node_alloc_type& __a) _GLIBCXX_NOEXCEPT
466 : _Node_alloc_type(__a)
469#if __cplusplus >= 201103L
470 _List_impl(_List_impl&&) =
default;
472 _List_impl(_Node_alloc_type&& __a, _List_impl&& __x)
476 _List_impl(_Node_alloc_type&& __a) noexcept
484#if _GLIBCXX_USE_CXX11_ABI
485 size_t _M_get_size()
const {
return _M_impl._M_node._M_size; }
487 void _M_set_size(
size_t __n) { _M_impl._M_node._M_size = __n; }
489 void _M_inc_size(
size_t __n) { _M_impl._M_node._M_size += __n; }
491 void _M_dec_size(
size_t __n) { _M_impl._M_node._M_size -= __n; }
493# if !_GLIBCXX_INLINE_VERSION
497 {
return _S_distance(__first, __last); }
500 size_t _M_node_count()
const {
return _M_get_size(); }
504 size_t _M_get_size()
const {
return 0; }
505 void _M_set_size(
size_t) { }
506 void _M_inc_size(
size_t) { }
507 void _M_dec_size(
size_t) { }
509# if !_GLIBCXX_INLINE_VERSION
510 size_t _M_distance(
const void*,
const void*)
const {
return 0; }
513 size_t _M_node_count()
const
515 return _S_distance(_M_impl._M_node._M_next,
521 typename _Node_alloc_traits::pointer
526 _M_put_node(
typename _Node_alloc_traits::pointer __p) _GLIBCXX_NOEXCEPT
530 typedef _Alloc allocator_type;
533 _M_get_Node_allocator() _GLIBCXX_NOEXCEPT
536 const _Node_alloc_type&
537 _M_get_Node_allocator()
const _GLIBCXX_NOEXCEPT
540#if __cplusplus >= 201103L
546 _List_base(
const _Node_alloc_type& __a) _GLIBCXX_NOEXCEPT
550#if __cplusplus >= 201103L
553# if !_GLIBCXX_INLINE_VERSION
557 if (__x._M_get_Node_allocator() == _M_get_Node_allocator())
575 { _M_impl._M_node._M_move_nodes(
std::move(__x._M_impl._M_node)); }
583 _M_clear() _GLIBCXX_NOEXCEPT;
586 _M_init() _GLIBCXX_NOEXCEPT
587 { this->_M_impl._M_node._M_init(); }
636 template<
typename _Tp,
typename _Alloc = std::allocator<_Tp> >
639#ifdef _GLIBCXX_CONCEPT_CHECKS
641 typedef typename _Alloc::value_type _Alloc_value_type;
642# if __cplusplus < 201103L
643 __glibcxx_class_requires(_Tp, _SGIAssignableConcept)
645 __glibcxx_class_requires2(_Tp, _Alloc_value_type, _SameTypeConcept)
648#if __cplusplus >= 201103L
650 "std::list must have a non-const, non-volatile value_type");
651# if __cplusplus > 201703L || defined __STRICT_ANSI__
653 "std::list must have the same value_type as its allocator");
658 typedef typename _Base::_Tp_alloc_type _Tp_alloc_type;
660 typedef typename _Base::_Node_alloc_type _Node_alloc_type;
664 typedef _Tp value_type;
665 typedef typename _Tp_alloc_traits::pointer pointer;
666 typedef typename _Tp_alloc_traits::const_pointer const_pointer;
667 typedef typename _Tp_alloc_traits::reference reference;
668 typedef typename _Tp_alloc_traits::const_reference const_reference;
673 typedef size_t size_type;
674 typedef ptrdiff_t difference_type;
675 typedef _Alloc allocator_type;
682 using _Base::_M_impl;
683 using _Base::_M_put_node;
684 using _Base::_M_get_node;
685 using _Base::_M_get_Node_allocator;
693#if __cplusplus < 201103L
697 _Node* __p = this->_M_get_node();
700 _Tp_alloc_type __alloc(_M_get_Node_allocator());
701 __alloc.construct(__p->_M_valptr(), __x);
706 __throw_exception_again;
711 template<
typename... _Args>
715 auto __p = this->_M_get_node();
716 auto& __alloc = _M_get_Node_allocator();
717 __allocated_ptr<_Node_alloc_type> __guard{__alloc, __p};
718 _Node_alloc_traits::construct(__alloc, __p->_M_valptr(),
719 std::forward<_Args>(__args)...);
725#if _GLIBCXX_USE_CXX11_ABI
727 _S_distance(const_iterator __first, const_iterator __last)
732 _M_node_count()
const
733 {
return this->_M_get_size(); }
737 _S_distance(const_iterator, const_iterator)
742 _M_node_count()
const
753#if __cplusplus >= 201103L
764 list(
const allocator_type& __a) _GLIBCXX_NOEXCEPT
765 :
_Base(_Node_alloc_type(__a)) { }
767#if __cplusplus >= 201103L
777 list(size_type __n,
const allocator_type& __a = allocator_type())
778 :
_Base(_Node_alloc_type(__a))
779 { _M_default_initialize(__n); }
789 list(size_type __n,
const value_type& __value,
790 const allocator_type& __a = allocator_type())
791 :
_Base(_Node_alloc_type(__a))
792 { _M_fill_initialize(__n, __value); }
803 list(size_type __n,
const value_type& __value = value_type(),
804 const allocator_type& __a = allocator_type())
805 : _Base(_Node_alloc_type(__a))
806 { _M_fill_initialize(__n, __value); }
818 _S_select_on_copy(__x._M_get_Node_allocator()))
819 { _M_initialize_dispatch(__x.
begin(), __x.
end(), __false_type()); }
821#if __cplusplus >= 201103L
840 const allocator_type& __a = allocator_type())
841 :
_Base(_Node_alloc_type(__a))
842 { _M_initialize_dispatch(__l.begin(), __l.end(), __false_type()); }
844 list(
const list& __x,
const __type_identity_t<allocator_type>& __a)
845 : _Base(_Node_alloc_type(__a))
846 { _M_initialize_dispatch(__x.
begin(), __x.
end(), __false_type()); }
850 : _Base(_Node_alloc_type(__a),
std::move(__x))
854 : _Base(_Node_alloc_type(__a))
856 if (__x._M_get_Node_allocator() == this->_M_get_Node_allocator())
860 std::__make_move_if_noexcept_iterator(__x.
end()));
864 list(
list&& __x,
const __type_identity_t<allocator_type>& __a)
865 noexcept(_Node_alloc_traits::_S_always_equal())
867 typename _Node_alloc_traits::is_always_equal{})
881#if __cplusplus >= 201103L
882 template<
typename _InputIterator,
883 typename = std::_RequireInputIter<_InputIterator>>
884 list(_InputIterator __first, _InputIterator __last,
885 const allocator_type& __a = allocator_type())
886 :
_Base(_Node_alloc_type(__a))
887 { _M_initialize_dispatch(__first, __last, __false_type()); }
889 template<
typename _InputIterator>
890 list(_InputIterator __first, _InputIterator __last,
891 const allocator_type& __a = allocator_type())
892 : _Base(_Node_alloc_type(__a))
895 typedef typename std::__is_integer<_InputIterator>::__type _Integral;
896 _M_initialize_dispatch(__first, __last, _Integral());
900#if __glibcxx_ranges_to_container
905 template<__detail::__container_compatible_range<_Tp> _Rg>
906 list(from_range_t, _Rg&& __rg,
const _Alloc& __a = _Alloc())
907 : _Base(_Node_alloc_type(__a))
909 auto __first = ranges::begin(__rg);
910 const auto __last = ranges::end(__rg);
911 for (; __first != __last; ++__first)
912 emplace_back(*__first);
916#if __cplusplus >= 201103L
938#if __cplusplus >= 201103L
939#pragma GCC diagnostic push
940#pragma GCC diagnostic ignored "-Wc++17-extensions"
953 noexcept(_Node_alloc_traits::_S_nothrow_move())
955 constexpr bool __move_storage =
956 _Node_alloc_traits::_S_propagate_on_move_assign()
957 || _Node_alloc_traits::_S_always_equal();
958 if constexpr (!__move_storage)
960 if (__x._M_get_Node_allocator() != this->_M_get_Node_allocator())
964 _M_assign_dispatch(std::make_move_iterator(__x.
begin()),
965 std::make_move_iterator(__x.
end()),
974 if constexpr (_Node_alloc_traits::_S_propagate_on_move_assign())
975 this->_M_get_Node_allocator()
976 =
std::move(__x._M_get_Node_allocator());
980#pragma GCC diagnostic pop
992 this->
assign(__l.begin(), __l.end());
997#if __glibcxx_ranges_to_container
1002 template<__detail::__container_compatible_range<_Tp> _Rg>
1004 assign_range(_Rg&& __rg)
1006 static_assert(assignable_from<_Tp&, ranges::range_reference_t<_Rg>>);
1010 auto __first2 = ranges::begin(__rg);
1011 const auto __last2 = ranges::end(__rg);
1012 for (; __first1 != __last1 && __first2 != __last2;
1013 ++__first1, (void)++__first2)
1014 *__first1 = *__first2;
1015 if (__first2 == __last2)
1016 erase(__first1, __last1);
1018 insert_range(__last1,
1034 assign(size_type __n,
const value_type& __val)
1035 { _M_fill_assign(__n, __val); }
1049#if __cplusplus >= 201103L
1050 template<
typename _InputIterator,
1051 typename = std::_RequireInputIter<_InputIterator>>
1053 assign(_InputIterator __first, _InputIterator __last)
1054 { _M_assign_dispatch(__first, __last, __false_type()); }
1056 template<
typename _InputIterator>
1058 assign(_InputIterator __first, _InputIterator __last)
1061 typedef typename std::__is_integer<_InputIterator>::__type _Integral;
1062 _M_assign_dispatch(__first, __last, _Integral());
1066#if __cplusplus >= 201103L
1076 { this->_M_assign_dispatch(__l.begin(), __l.end(), __false_type()); }
1082 {
return allocator_type(_Base::_M_get_Node_allocator()); }
1092 {
return iterator(this->_M_impl._M_node._M_next); }
1112 {
return iterator(&this->_M_impl._M_node); }
1140 const_reverse_iterator
1160 const_reverse_iterator
1164#if __cplusplus >= 201103L
1191 const_reverse_iterator
1201 const_reverse_iterator
1211 _GLIBCXX_NODISCARD
bool
1213 {
return this->_M_impl._M_node._M_next == &this->_M_impl._M_node; }
1219 {
return _M_node_count(); }
1227#if __cplusplus >= 201103L
1238 resize(size_type __new_size);
1251 resize(size_type __new_size,
const value_type& __x);
1264 resize(size_type __new_size, value_type __x = value_type());
1276 __glibcxx_requires_nonempty();
1288 __glibcxx_requires_nonempty();
1300 __glibcxx_requires_nonempty();
1301 iterator __tmp =
end();
1314 __glibcxx_requires_nonempty();
1333 { this->_M_insert(
begin(), __x); }
1335#if __cplusplus >= 201103L
1340 template<
typename... _Args>
1341#if __cplusplus > 201402L
1346 emplace_front(_Args&&... __args)
1348 this->_M_insert(
begin(), std::forward<_Args>(__args)...);
1349#if __cplusplus > 201402L
1355#if __glibcxx_ranges_to_container
1368 template<__detail::__container_compatible_range<_Tp> _Rg>
1370 prepend_range(_Rg&& __rg)
1389 template<__detail::__container_compatible_range<_Tp> _Rg>
1391 append_range(_Rg&& __rg)
1413 { this->_M_erase(
begin()); }
1427 { this->_M_insert(
end(), __x); }
1429#if __cplusplus >= 201103L
1434 template<
typename... _Args>
1435#if __cplusplus > 201402L
1440 emplace_back(_Args&&... __args)
1442 this->_M_insert(
end(), std::forward<_Args>(__args)...);
1443#if __cplusplus > 201402L
1462 { this->_M_erase(iterator(this->_M_impl._M_node._M_prev)); }
1464#if __cplusplus >= 201103L
1477 template<
typename... _Args>
1479 emplace(const_iterator __position, _Args&&... __args);
1493 insert(const_iterator __position,
const value_type& __x);
1510#if __cplusplus >= 201103L
1543 {
return this->
insert(__p, __l.begin(), __l.end()); }
1546#if __cplusplus >= 201103L
1562 insert(const_iterator __position, size_type __n,
const value_type& __x);
1577 insert(
iterator __position, size_type __n,
const value_type& __x)
1580 splice(__position, __tmp);
1584#if __cplusplus >= 201103L
1600 template<
typename _InputIterator,
1601 typename = std::_RequireInputIter<_InputIterator>>
1603 insert(const_iterator __position, _InputIterator __first,
1604 _InputIterator __last);
1619 template<
typename _InputIterator>
1621 insert(iterator __position, _InputIterator __first,
1622 _InputIterator __last)
1625 splice(__position, __tmp);
1629#if __glibcxx_ranges_to_container
1645 template<__detail::__container_compatible_range<_Tp> _Rg>
1647 insert_range(const_iterator __position, _Rg&& __rg)
1652 auto __it = __tmp.begin();
1653 splice(__position, __tmp);
1656 return __position._M_const_cast();
1676#if __cplusplus >= 201103L
1677 erase(const_iterator __position)
noexcept;
1679 erase(iterator __position);
1701#if __cplusplus >= 201103L
1704 erase(iterator __first, iterator __last)
1707 while (__first != __last)
1708 __first =
erase(__first);
1709 return __last._M_const_cast();
1726 __detail::_List_node_base::swap(this->_M_impl._M_node,
1727 __x._M_impl._M_node);
1729 size_t __xsize = __x._M_get_size();
1730 __x._M_set_size(this->_M_get_size());
1731 this->_M_set_size(__xsize);
1733 _Node_alloc_traits::_S_on_swap(this->_M_get_Node_allocator(),
1734 __x._M_get_Node_allocator());
1763#if __cplusplus >= 201103L
1771 _M_check_equal_allocators(__x);
1773 this->_M_transfer(__position._M_const_cast(),
1776 this->_M_inc_size(__x._M_get_size());
1781#if __cplusplus >= 201103L
1783 splice(const_iterator __position,
list& __x)
noexcept
1787#if __cplusplus >= 201103L
1811 splice(iterator __position,
list& __x, iterator __i)
1814 iterator __j = __i._M_const_cast();
1816 if (__position == __i || __position == __j)
1820 _M_check_equal_allocators(__x);
1822 this->_M_transfer(__position._M_const_cast(),
1823 __i._M_const_cast(), __j);
1825 this->_M_inc_size(1);
1829#if __cplusplus >= 201103L
1845#if __cplusplus >= 201103L
1876 splice(iterator __position,
list& __x, iterator __first,
1880 if (__first != __last)
1883 _M_check_equal_allocators(__x);
1885 size_t __n = _S_distance(__first, __last);
1886 this->_M_inc_size(__n);
1887 __x._M_dec_size(__n);
1889 this->_M_transfer(__position._M_const_cast(),
1890 __first._M_const_cast(),
1891 __last._M_const_cast());
1895#if __cplusplus >= 201103L
1916#ifdef __glibcxx_list_remove_return_type
1917 typedef size_type __remove_return_type;
1918# define _GLIBCXX_LIST_REMOVE_RETURN_TYPE_TAG \
1919 __attribute__((__abi_tag__("__cxx20")))
1921 typedef void __remove_return_type;
1922# define _GLIBCXX_LIST_REMOVE_RETURN_TYPE_TAG
1937 _GLIBCXX_LIST_REMOVE_RETURN_TYPE_TAG
1938 __remove_return_type
1939 remove(
const _Tp& __value);
1952 template<
typename _Predicate>
1953 __remove_return_type
1966 _GLIBCXX_LIST_REMOVE_RETURN_TYPE_TAG
1967 __remove_return_type
1982 template<
typename _BinaryPredicate>
1983 __remove_return_type
1984 unique(_BinaryPredicate);
1986#undef _GLIBCXX_LIST_REMOVE_RETURN_TYPE_TAG
1997#if __cplusplus >= 201103L
2022#if __cplusplus >= 201103L
2023 template<
typename _StrictWeakOrdering>
2025 merge(
list&& __x, _StrictWeakOrdering __comp);
2027 template<
typename _StrictWeakOrdering>
2029 merge(
list& __x, _StrictWeakOrdering __comp)
2032 template<
typename _StrictWeakOrdering>
2034 merge(
list& __x, _StrictWeakOrdering __comp);
2044 { this->_M_impl._M_node._M_reverse(); }
2061 template<
typename _StrictWeakOrdering>
2063 sort(_StrictWeakOrdering);
2072 template<
typename _Integer>
2074 _M_initialize_dispatch(_Integer __n, _Integer __x, __true_type)
2075 { _M_fill_initialize(
static_cast<size_type
>(__n), __x); }
2078 template<
typename _InputIterator>
2080 _M_initialize_dispatch(_InputIterator __first, _InputIterator __last,
2083 for (; __first != __last; ++__first)
2084#
if __cplusplus >= 201103L
2085 emplace_back(*__first);
2094 _M_fill_initialize(size_type __n,
const value_type& __x)
2100#if __cplusplus >= 201103L
2103 _M_default_initialize(size_type __n)
2111 _M_default_append(size_type __n);
2120 template<
typename _Integer>
2122 _M_assign_dispatch(_Integer __n, _Integer __val, __true_type)
2123 { _M_fill_assign(__n, __val); }
2126 template<
typename _InputIterator>
2128 _M_assign_dispatch(_InputIterator __first, _InputIterator __last,
2134 _M_fill_assign(size_type __n,
const value_type& __val);
2139 _M_transfer(iterator __position, iterator __first, iterator __last)
2140 { __position._M_node->_M_transfer(__first._M_node, __last._M_node); }
2143#if __cplusplus < 201103L
2145 _M_insert(iterator __position,
const value_type& __x)
2148 __tmp->_M_hook(__position._M_node);
2149 this->_M_inc_size(1);
2152 template<
typename... _Args>
2154 _M_insert(iterator __position, _Args&&... __args)
2157 __tmp->_M_hook(__position._M_node);
2158 this->_M_inc_size(1);
2164 _M_erase(iterator __position) _GLIBCXX_NOEXCEPT
2166 this->_M_dec_size(1);
2167 __position._M_node->_M_unhook();
2168 _Node* __n =
static_cast<_Node*
>(__position._M_node);
2169#if __cplusplus >= 201103L
2170 _Node_alloc_traits::destroy(_M_get_Node_allocator(), __n->_M_valptr());
2172 _Tp_alloc_type(_M_get_Node_allocator()).destroy(__n->_M_valptr());
2180 _M_check_equal_allocators(
const list& __x) _GLIBCXX_NOEXCEPT
2182 if (_M_get_Node_allocator() != __x._M_get_Node_allocator())
2188 _M_resize_pos(size_type& __new_size)
const;
2190#if __cplusplus >= 201103L && ! _GLIBCXX_INLINE_VERSION
2199 std::__alloc_on_move(this->_M_get_Node_allocator(),
2200 __x._M_get_Node_allocator());
2206 if (__x._M_get_Node_allocator() == this->_M_get_Node_allocator())
2211 _M_assign_dispatch(std::make_move_iterator(__x.begin()),
2212 std::make_move_iterator(__x.end()),
2217#if _GLIBCXX_USE_CXX11_ABI
2219 struct _Finalize_merge
2222 _Finalize_merge(
list& __dest,
list& __src,
const iterator& __src_next)
2223 : _M_dest(__dest), _M_src(__src), _M_next(__src_next)
2231 const size_t __num_unmerged =
std::distance(_M_next, _M_src.end());
2232 const size_t __orig_size = _M_src._M_get_size();
2233 _M_dest._M_inc_size(__orig_size - __num_unmerged);
2234 _M_src._M_set_size(__num_unmerged);
2239 const iterator& _M_next;
2241#if __cplusplus >= 201103L
2242 _Finalize_merge(
const _Finalize_merge&) =
delete;
2246 struct _Finalize_merge
2247 {
explicit _Finalize_merge(
list&,
list&,
const iterator&) { } };
2252#if __cpp_deduction_guides >= 201606
2253 template<
typename _InputIterator,
typename _ValT
2254 =
typename iterator_traits<_InputIterator>::value_type,
2255 typename _Allocator = allocator<_ValT>,
2256 typename = _RequireInputIter<_InputIterator>,
2257 typename = _RequireAllocator<_Allocator>>
2258 list(_InputIterator, _InputIterator, _Allocator = _Allocator())
2259 -> list<_ValT, _Allocator>;
2261#if __glibcxx_ranges_to_container
2262 template<ranges::input_range _Rg,
2263 typename _Allocator = allocator<ranges::range_value_t<_Rg>>>
2264 list(from_range_t, _Rg&&, _Allocator = _Allocator())
2265 -> list<ranges::range_value_t<_Rg>, _Allocator>;
2269_GLIBCXX_END_NAMESPACE_CXX11
2281 template<
typename _Tp,
typename _Alloc>
2286#if _GLIBCXX_USE_CXX11_ABI
2287 if (__x.
size() != __y.size())
2292 const_iterator __end1 = __x.
end();
2293 const_iterator __end2 = __y.end();
2295 const_iterator __i1 = __x.
begin();
2296 const_iterator __i2 = __y.begin();
2297 while (__i1 != __end1 && __i2 != __end2 && *__i1 == *__i2)
2302 return __i1 == __end1 && __i2 == __end2;
2305#if __cpp_lib_three_way_comparison
2317 template<
typename _Tp,
typename _Alloc>
2319 inline __detail::__synth3way_t<_Tp>
2320 operator<=>(
const list<_Tp, _Alloc>& __x,
const list<_Tp, _Alloc>& __y)
2323 __y.begin(), __y.end(),
2324 __detail::__synth3way);
2338 template<
typename _Tp,
typename _Alloc>
2341 operator<(
const list<_Tp, _Alloc>& __x,
const list<_Tp, _Alloc>& __y)
2342 {
return std::lexicographical_compare(__x.begin(), __x.end(),
2343 __y.begin(), __y.end()); }
2346 template<
typename _Tp,
typename _Alloc>
2349 operator!=(
const list<_Tp, _Alloc>& __x,
const list<_Tp, _Alloc>& __y)
2350 {
return !(__x == __y); }
2353 template<
typename _Tp,
typename _Alloc>
2356 operator>(
const list<_Tp, _Alloc>& __x,
const list<_Tp, _Alloc>& __y)
2357 {
return __y < __x; }
2360 template<
typename _Tp,
typename _Alloc>
2363 operator<=(
const list<_Tp, _Alloc>& __x,
const list<_Tp, _Alloc>& __y)
2364 {
return !(__y < __x); }
2367 template<
typename _Tp,
typename _Alloc>
2370 operator>=(
const list<_Tp, _Alloc>& __x,
const list<_Tp, _Alloc>& __y)
2371 {
return !(__x < __y); }
2375 template<
typename _Tp,
typename _Alloc>
2378 _GLIBCXX_NOEXCEPT_IF(
noexcept(__x.swap(__y)))
2381_GLIBCXX_END_NAMESPACE_CONTAINER
2383#if _GLIBCXX_USE_CXX11_ABI
2386 template<
typename _Tp>
2388 __distance(_GLIBCXX_STD_C::_List_iterator<_Tp> __first,
2389 _GLIBCXX_STD_C::_List_iterator<_Tp> __last,
2390 input_iterator_tag __tag)
2392 typedef _GLIBCXX_STD_C::_List_const_iterator<_Tp> _CIter;
2393 return std::__distance(_CIter(__first), _CIter(__last), __tag);
2396 template<
typename _Tp>
2398 __distance(_GLIBCXX_STD_C::_List_const_iterator<_Tp> __first,
2399 _GLIBCXX_STD_C::_List_const_iterator<_Tp> __last,
2402 typedef __detail::_List_node_header _Sentinel;
2403 _GLIBCXX_STD_C::_List_const_iterator<_Tp> __beyond = __last;
2405 const bool __whole = __first == __beyond;
2406 if (__builtin_constant_p (__whole) && __whole)
2407 return static_cast<const _Sentinel*
>(__last._M_node)->_M_size;
2410 while (__first != __last)
2419_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.