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(),
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()); }
849 list(list&& __x,
const allocator_type& __a, true_type) noexcept
850 : _Base(_Node_alloc_type(__a),
std::move(__x))
853 list(list&& __x,
const allocator_type& __a, false_type)
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();
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)
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)
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);
1495#if __cplusplus >= 201103L
1497 insert(const_iterator __position,
const value_type& __x);
1508#if __cplusplus >= 201103L
1526 {
return this->
insert(__p, __l.begin(), __l.end()); }
1543#if __cplusplus >= 201103L
1545 insert(const_iterator __position, size_type __n,
const value_type& __x);
1548 insert(
iterator __position, size_type __n,
const value_type& __x)
1551 splice(__position, __tmp);
1570#if __cplusplus >= 201103L
1571 template<
typename _InputIterator,
1572 typename = std::_RequireInputIter<_InputIterator>>
1574 insert(const_iterator __position, _InputIterator __first,
1575 _InputIterator __last);
1577 template<
typename _InputIterator>
1579 insert(iterator __position, _InputIterator __first,
1580 _InputIterator __last)
1583 splice(__position, __tmp);
1587#if __glibcxx_ranges_to_container
1603 template<__detail::__container_compatible_range<_Tp> _Rg>
1605 insert_range(const_iterator __position, _Rg&& __rg)
1610 auto __it = __tmp.begin();
1611 splice(__position, __tmp);
1614 return __position._M_const_cast();
1634#if __cplusplus >= 201103L
1635 erase(const_iterator __position)
noexcept;
1637 erase(iterator __position);
1659#if __cplusplus >= 201103L
1665 while (__first != __last)
1666 __first =
erase(__first);
1667 return __last._M_const_cast();
1684 __detail::_List_node_base::swap(this->_M_impl._M_node,
1685 __x._M_impl._M_node);
1687 size_t __xsize = __x._M_get_size();
1688 __x._M_set_size(this->_M_get_size());
1689 this->_M_set_size(__xsize);
1691 _Node_alloc_traits::_S_on_swap(this->_M_get_Node_allocator(),
1692 __x._M_get_Node_allocator());
1721#if __cplusplus >= 201103L
1729 _M_check_equal_allocators(__x);
1731 this->_M_transfer(__position._M_const_cast(),
1734 this->_M_inc_size(__x._M_get_size());
1739#if __cplusplus >= 201103L
1741 splice(const_iterator __position,
list& __x)
noexcept
1756#if __cplusplus >= 201103L
1764 iterator __j = __i._M_const_cast();
1766 if (__position == __i || __position == __j)
1770 _M_check_equal_allocators(__x);
1772 this->_M_transfer(__position._M_const_cast(),
1773 __i._M_const_cast(), __j);
1775 this->_M_inc_size(1);
1779#if __cplusplus >= 201103L
1798#if __cplusplus >= 201103L
1808 if (__first != __last)
1811 _M_check_equal_allocators(__x);
1813 size_t __n = _S_distance(__first, __last);
1814 this->_M_inc_size(__n);
1815 __x._M_dec_size(__n);
1817 this->_M_transfer(__position._M_const_cast(),
1818 __first._M_const_cast(),
1819 __last._M_const_cast());
1823#if __cplusplus >= 201103L
1844#ifdef __glibcxx_list_remove_return_type
1845 typedef size_type __remove_return_type;
1846# define _GLIBCXX_LIST_REMOVE_RETURN_TYPE_TAG \
1847 __attribute__((__abi_tag__("__cxx20")))
1849 typedef void __remove_return_type;
1850# define _GLIBCXX_LIST_REMOVE_RETURN_TYPE_TAG
1865 _GLIBCXX_LIST_REMOVE_RETURN_TYPE_TAG
1866 __remove_return_type
1867 remove(
const _Tp& __value);
1880 template<
typename _Predicate>
1881 __remove_return_type
1894 _GLIBCXX_LIST_REMOVE_RETURN_TYPE_TAG
1895 __remove_return_type
1910 template<
typename _BinaryPredicate>
1911 __remove_return_type
1912 unique(_BinaryPredicate);
1914#undef _GLIBCXX_LIST_REMOVE_RETURN_TYPE_TAG
1925#if __cplusplus >= 201103L
1950#if __cplusplus >= 201103L
1951 template<
typename _StrictWeakOrdering>
1953 merge(list&& __x, _StrictWeakOrdering __comp);
1955 template<
typename _StrictWeakOrdering>
1957 merge(list& __x, _StrictWeakOrdering __comp)
1960 template<
typename _StrictWeakOrdering>
1962 merge(list& __x, _StrictWeakOrdering __comp);
1972 { this->_M_impl._M_node._M_reverse(); }
1989 template<
typename _StrictWeakOrdering>
1991 sort(_StrictWeakOrdering);
2000 template<
typename _Integer>
2002 _M_initialize_dispatch(_Integer __n, _Integer __x, __true_type)
2003 { _M_fill_initialize(
static_cast<size_type
>(__n), __x); }
2006 template<
typename _InputIterator>
2008 _M_initialize_dispatch(_InputIterator __first, _InputIterator __last,
2011 for (; __first != __last; ++__first)
2012#
if __cplusplus >= 201103L
2013 emplace_back(*__first);
2022 _M_fill_initialize(size_type __n,
const value_type& __x)
2028#if __cplusplus >= 201103L
2031 _M_default_initialize(size_type __n)
2039 _M_default_append(size_type __n);
2048 template<
typename _Integer>
2050 _M_assign_dispatch(_Integer __n, _Integer __val, __true_type)
2051 { _M_fill_assign(__n, __val); }
2054 template<
typename _InputIterator>
2056 _M_assign_dispatch(_InputIterator __first, _InputIterator __last,
2062 _M_fill_assign(size_type __n,
const value_type& __val);
2067 _M_transfer(iterator __position, iterator __first, iterator __last)
2068 { __position._M_node->_M_transfer(__first._M_node, __last._M_node); }
2071#if __cplusplus < 201103L
2073 _M_insert(iterator __position,
const value_type& __x)
2076 __tmp->_M_hook(__position._M_node);
2077 this->_M_inc_size(1);
2080 template<
typename... _Args>
2082 _M_insert(iterator __position, _Args&&... __args)
2085 __tmp->_M_hook(__position._M_node);
2086 this->_M_inc_size(1);
2092 _M_erase(iterator __position) _GLIBCXX_NOEXCEPT
2094 this->_M_dec_size(1);
2095 __position._M_node->_M_unhook();
2096 _Node* __n =
static_cast<_Node*
>(__position._M_node);
2097#if __cplusplus >= 201103L
2098 _Node_alloc_traits::destroy(_M_get_Node_allocator(), __n->_M_valptr());
2100 _Tp_alloc_type(_M_get_Node_allocator()).destroy(__n->_M_valptr());
2108 _M_check_equal_allocators(
const list& __x) _GLIBCXX_NOEXCEPT
2110 if (_M_get_Node_allocator() != __x._M_get_Node_allocator())
2116 _M_resize_pos(size_type& __new_size)
const;
2118#if __cplusplus >= 201103L && ! _GLIBCXX_INLINE_VERSION
2123 _M_move_assign(list&& __x, true_type)
noexcept
2127 std::__alloc_on_move(this->_M_get_Node_allocator(),
2128 __x._M_get_Node_allocator());
2132 _M_move_assign(list&& __x, false_type)
2134 if (__x._M_get_Node_allocator() == this->_M_get_Node_allocator())
2135 _M_move_assign(
std::move(__x), true_type{});
2139 _M_assign_dispatch(std::make_move_iterator(__x.begin()),
2140 std::make_move_iterator(__x.end()),
2145#if _GLIBCXX_USE_CXX11_ABI
2147 struct _Finalize_merge
2150 _Finalize_merge(list& __dest, list& __src,
const iterator& __src_next)
2151 : _M_dest(__dest), _M_src(__src), _M_next(__src_next)
2160 const size_t __orig_size = _M_src._M_get_size();
2161 _M_dest._M_inc_size(__orig_size - __num_unmerged);
2162 _M_src._M_set_size(__num_unmerged);
2167 const iterator& _M_next;
2169#if __cplusplus >= 201103L
2170 _Finalize_merge(
const _Finalize_merge&) =
delete;
2174 struct _Finalize_merge
2175 {
explicit _Finalize_merge(list&, list&,
const iterator&) { } };
2180#if __cpp_deduction_guides >= 201606
2181 template<
typename _InputIterator,
typename _ValT
2182 =
typename iterator_traits<_InputIterator>::value_type,
2183 typename _Allocator = allocator<_ValT>,
2184 typename = _RequireInputIter<_InputIterator>,
2185 typename = _RequireAllocator<_Allocator>>
2186 list(_InputIterator, _InputIterator, _Allocator = _Allocator())
2187 -> list<_ValT, _Allocator>;
2189#if __glibcxx_ranges_to_container
2190 template<ranges::input_range _Rg,
2191 typename _Allocator = allocator<ranges::range_value_t<_Rg>>>
2192 list(from_range_t, _Rg&&, _Allocator = _Allocator())
2193 -> list<ranges::range_value_t<_Rg>, _Allocator>;
2197_GLIBCXX_END_NAMESPACE_CXX11
2209 template<
typename _Tp,
typename _Alloc>
2214#if _GLIBCXX_USE_CXX11_ABI
2215 if (__x.
size() != __y.size())
2220 const_iterator __end1 = __x.
end();
2221 const_iterator __end2 = __y.end();
2223 const_iterator __i1 = __x.
begin();
2224 const_iterator __i2 = __y.begin();
2225 while (__i1 != __end1 && __i2 != __end2 && *__i1 == *__i2)
2230 return __i1 == __end1 && __i2 == __end2;
2233#if __cpp_lib_three_way_comparison
2245 template<
typename _Tp,
typename _Alloc>
2247 inline __detail::__synth3way_t<_Tp>
2248 operator<=>(
const list<_Tp, _Alloc>& __x,
const list<_Tp, _Alloc>& __y)
2251 __y.begin(), __y.end(),
2252 __detail::__synth3way);
2266 template<
typename _Tp,
typename _Alloc>
2269 operator<(
const list<_Tp, _Alloc>& __x,
const list<_Tp, _Alloc>& __y)
2270 {
return std::lexicographical_compare(__x.begin(), __x.end(),
2271 __y.begin(), __y.end()); }
2274 template<
typename _Tp,
typename _Alloc>
2277 operator!=(
const list<_Tp, _Alloc>& __x,
const list<_Tp, _Alloc>& __y)
2278 {
return !(__x == __y); }
2281 template<
typename _Tp,
typename _Alloc>
2284 operator>(
const list<_Tp, _Alloc>& __x,
const list<_Tp, _Alloc>& __y)
2285 {
return __y < __x; }
2288 template<
typename _Tp,
typename _Alloc>
2291 operator<=(
const list<_Tp, _Alloc>& __x,
const list<_Tp, _Alloc>& __y)
2292 {
return !(__y < __x); }
2295 template<
typename _Tp,
typename _Alloc>
2298 operator>=(
const list<_Tp, _Alloc>& __x,
const list<_Tp, _Alloc>& __y)
2299 {
return !(__x < __y); }
2303 template<
typename _Tp,
typename _Alloc>
2306 _GLIBCXX_NOEXCEPT_IF(
noexcept(__x.swap(__y)))
2309_GLIBCXX_END_NAMESPACE_CONTAINER
2311#if _GLIBCXX_USE_CXX11_ABI
2314 template<
typename _Tp>
2316 __distance(_GLIBCXX_STD_C::_List_iterator<_Tp> __first,
2317 _GLIBCXX_STD_C::_List_iterator<_Tp> __last,
2318 input_iterator_tag __tag)
2320 typedef _GLIBCXX_STD_C::_List_const_iterator<_Tp> _CIter;
2321 return std::__distance(_CIter(__first), _CIter(__last), __tag);
2324 template<
typename _Tp>
2326 __distance(_GLIBCXX_STD_C::_List_const_iterator<_Tp> __first,
2327 _GLIBCXX_STD_C::_List_const_iterator<_Tp> __last,
2330 typedef __detail::_List_node_header _Sentinel;
2331 _GLIBCXX_STD_C::_List_const_iterator<_Tp> __beyond = __last;
2333 const bool __whole = __first == __beyond;
2334 if (__builtin_constant_p (__whole) && __whole)
2335 return static_cast<const _Sentinel*
>(__last._M_node)->_M_size;
2338 while (__first != __last)
2347_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
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 value 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.