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
163_GLIBCXX_BEGIN_NAMESPACE_CONTAINER
166 template<
typename _Tp>
169#if __cplusplus >= 201103L
170 __gnu_cxx::__aligned_membuf<_Tp> _M_storage;
171 _Tp* _M_valptr() {
return _M_storage._M_ptr(); }
172 _Tp
const* _M_valptr()
const {
return _M_storage._M_ptr(); }
185 template<
typename _Tp>
191 typedef ptrdiff_t difference_type;
193 typedef _Tp value_type;
194 typedef _Tp* pointer;
195 typedef _Tp& reference;
205 _M_const_cast()
const _GLIBCXX_NOEXCEPT
210 operator*()
const _GLIBCXX_NOEXCEPT
211 {
return *
static_cast<_Node*
>(_M_node)->_M_valptr(); }
214 operator->()
const _GLIBCXX_NOEXCEPT
215 {
return static_cast<_Node*
>(_M_node)->_M_valptr(); }
218 operator++() _GLIBCXX_NOEXCEPT
220 _M_node = _M_node->_M_next;
225 operator++(
int) _GLIBCXX_NOEXCEPT
228 _M_node = _M_node->_M_next;
233 operator--() _GLIBCXX_NOEXCEPT
235 _M_node = _M_node->_M_prev;
240 operator--(
int) _GLIBCXX_NOEXCEPT
243 _M_node = _M_node->_M_prev;
248 operator==(
const _Self& __x,
const _Self& __y) _GLIBCXX_NOEXCEPT
249 {
return __x._M_node == __y._M_node; }
251#if __cpp_impl_three_way_comparison < 201907L
253 operator!=(
const _Self& __x,
const _Self& __y) _GLIBCXX_NOEXCEPT
254 {
return __x._M_node != __y._M_node; }
266 template<
typename _Tp>
273 typedef ptrdiff_t difference_type;
275 typedef _Tp value_type;
276 typedef const _Tp* pointer;
277 typedef const _Tp& reference;
288 : _M_node(__x._M_node) { }
291 _M_const_cast()
const _GLIBCXX_NOEXCEPT
296 operator*()
const _GLIBCXX_NOEXCEPT
297 {
return *
static_cast<_Node*
>(_M_node)->_M_valptr(); }
300 operator->()
const _GLIBCXX_NOEXCEPT
301 {
return static_cast<_Node*
>(_M_node)->_M_valptr(); }
304 operator++() _GLIBCXX_NOEXCEPT
306 _M_node = _M_node->_M_next;
311 operator++(
int) _GLIBCXX_NOEXCEPT
314 _M_node = _M_node->_M_next;
319 operator--() _GLIBCXX_NOEXCEPT
321 _M_node = _M_node->_M_prev;
326 operator--(
int) _GLIBCXX_NOEXCEPT
329 _M_node = _M_node->_M_prev;
334 operator==(
const _Self& __x,
const _Self& __y) _GLIBCXX_NOEXCEPT
335 {
return __x._M_node == __y._M_node; }
337#if __cpp_impl_three_way_comparison < 201907L
339 operator!=(
const _Self& __x,
const _Self& __y) _GLIBCXX_NOEXCEPT
340 {
return __x._M_node != __y._M_node; }
347_GLIBCXX_BEGIN_NAMESPACE_CXX11
349 template<
typename _Tp,
typename _Alloc>
354 rebind<_Tp>::other _Tp_alloc_type;
356 typedef typename _Tp_alloc_traits::template
357 rebind<_List_node<_Tp> >::other _Node_alloc_type;
360#if !_GLIBCXX_INLINE_VERSION
366 while (__first != __last)
368 __first = __first->_M_next;
376 :
public _Node_alloc_type
380 _List_impl() _GLIBCXX_NOEXCEPT_IF(
385 _List_impl(
const _Node_alloc_type& __a) _GLIBCXX_NOEXCEPT
386 : _Node_alloc_type(__a)
389#if __cplusplus >= 201103L
390 _List_impl(_List_impl&&) =
default;
392 _List_impl(_Node_alloc_type&& __a, _List_impl&& __x)
396 _List_impl(_Node_alloc_type&& __a) noexcept
404#if _GLIBCXX_USE_CXX11_ABI
405 size_t _M_get_size()
const {
return _M_impl._M_node._M_size; }
407 void _M_set_size(
size_t __n) { _M_impl._M_node._M_size = __n; }
409 void _M_inc_size(
size_t __n) { _M_impl._M_node._M_size += __n; }
411 void _M_dec_size(
size_t __n) { _M_impl._M_node._M_size -= __n; }
413# if !_GLIBCXX_INLINE_VERSION
417 {
return _S_distance(__first, __last); }
420 size_t _M_node_count()
const {
return _M_get_size(); }
424 size_t _M_get_size()
const {
return 0; }
425 void _M_set_size(
size_t) { }
426 void _M_inc_size(
size_t) { }
427 void _M_dec_size(
size_t) { }
429# if !_GLIBCXX_INLINE_VERSION
430 size_t _M_distance(
const void*,
const void*)
const {
return 0; }
433 size_t _M_node_count()
const
435 return _S_distance(_M_impl._M_node._M_next,
441 typename _Node_alloc_traits::pointer
446 _M_put_node(
typename _Node_alloc_traits::pointer __p) _GLIBCXX_NOEXCEPT
450 typedef _Alloc allocator_type;
453 _M_get_Node_allocator() _GLIBCXX_NOEXCEPT
456 const _Node_alloc_type&
457 _M_get_Node_allocator()
const _GLIBCXX_NOEXCEPT
460#if __cplusplus >= 201103L
466 _List_base(
const _Node_alloc_type& __a) _GLIBCXX_NOEXCEPT
470#if __cplusplus >= 201103L
473# if !_GLIBCXX_INLINE_VERSION
477 if (__x._M_get_Node_allocator() == _M_get_Node_allocator())
495 { _M_impl._M_node._M_move_nodes(
std::move(__x._M_impl._M_node)); }
503 _M_clear() _GLIBCXX_NOEXCEPT;
506 _M_init() _GLIBCXX_NOEXCEPT
507 { this->_M_impl._M_node._M_init(); }
556 template<
typename _Tp,
typename _Alloc = std::allocator<_Tp> >
559#ifdef _GLIBCXX_CONCEPT_CHECKS
561 typedef typename _Alloc::value_type _Alloc_value_type;
562# if __cplusplus < 201103L
563 __glibcxx_class_requires(_Tp, _SGIAssignableConcept)
565 __glibcxx_class_requires2(_Tp, _Alloc_value_type, _SameTypeConcept)
568#if __cplusplus >= 201103L
570 "std::list must have a non-const, non-volatile value_type");
571# if __cplusplus > 201703L || defined __STRICT_ANSI__
573 "std::list must have the same value_type as its allocator");
578 typedef typename _Base::_Tp_alloc_type _Tp_alloc_type;
580 typedef typename _Base::_Node_alloc_type _Node_alloc_type;
584 typedef _Tp value_type;
585 typedef typename _Tp_alloc_traits::pointer pointer;
586 typedef typename _Tp_alloc_traits::const_pointer const_pointer;
587 typedef typename _Tp_alloc_traits::reference reference;
588 typedef typename _Tp_alloc_traits::const_reference const_reference;
593 typedef size_t size_type;
594 typedef ptrdiff_t difference_type;
595 typedef _Alloc allocator_type;
602 using _Base::_M_impl;
603 using _Base::_M_put_node;
604 using _Base::_M_get_node;
605 using _Base::_M_get_Node_allocator;
613#if __cplusplus < 201103L
617 _Node* __p = this->_M_get_node();
620 _Tp_alloc_type __alloc(_M_get_Node_allocator());
621 __alloc.construct(__p->_M_valptr(), __x);
626 __throw_exception_again;
631 template<
typename... _Args>
635 auto __p = this->_M_get_node();
636 auto& __alloc = _M_get_Node_allocator();
637 __allocated_ptr<_Node_alloc_type> __guard{__alloc, __p};
638 _Node_alloc_traits::construct(__alloc, __p->_M_valptr(),
639 std::forward<_Args>(__args)...);
645#if _GLIBCXX_USE_CXX11_ABI
647 _S_distance(const_iterator __first, const_iterator __last)
652 _M_node_count()
const
653 {
return this->_M_get_size(); }
657 _S_distance(const_iterator, const_iterator)
662 _M_node_count()
const
673#if __cplusplus >= 201103L
684 list(
const allocator_type& __a) _GLIBCXX_NOEXCEPT
685 :
_Base(_Node_alloc_type(__a)) { }
687#if __cplusplus >= 201103L
697 list(size_type __n,
const allocator_type& __a = allocator_type())
698 :
_Base(_Node_alloc_type(__a))
699 { _M_default_initialize(__n); }
709 list(size_type __n,
const value_type& __value,
710 const allocator_type& __a = allocator_type())
711 :
_Base(_Node_alloc_type(__a))
712 { _M_fill_initialize(__n, __value); }
723 list(size_type __n,
const value_type& __value = value_type(),
724 const allocator_type& __a = allocator_type())
725 : _Base(_Node_alloc_type(__a))
726 { _M_fill_initialize(__n, __value); }
738 _S_select_on_copy(__x._M_get_Node_allocator()))
739 { _M_initialize_dispatch(__x.
begin(), __x.
end(), __false_type()); }
741#if __cplusplus >= 201103L
760 const allocator_type& __a = allocator_type())
761 :
_Base(_Node_alloc_type(__a))
762 { _M_initialize_dispatch(__l.begin(), __l.end(), __false_type()); }
764 list(
const list& __x,
const allocator_type& __a)
765 : _Base(_Node_alloc_type(__a))
766 { _M_initialize_dispatch(__x.
begin(), __x.
end(), __false_type()); }
770 : _Base(_Node_alloc_type(__a),
std::move(__x))
774 : _Base(_Node_alloc_type(__a))
776 if (__x._M_get_Node_allocator() == this->_M_get_Node_allocator())
780 std::__make_move_if_noexcept_iterator(__x.
end()));
784 list(
list&& __x,
const allocator_type& __a)
785 noexcept(_Node_alloc_traits::_S_always_equal())
787 typename _Node_alloc_traits::is_always_equal{})
801#if __cplusplus >= 201103L
802 template<
typename _InputIterator,
803 typename = std::_RequireInputIter<_InputIterator>>
804 list(_InputIterator __first, _InputIterator __last,
805 const allocator_type& __a = allocator_type())
806 :
_Base(_Node_alloc_type(__a))
807 { _M_initialize_dispatch(__first, __last, __false_type()); }
809 template<
typename _InputIterator>
810 list(_InputIterator __first, _InputIterator __last,
811 const allocator_type& __a = allocator_type())
812 : _Base(_Node_alloc_type(__a))
815 typedef typename std::__is_integer<_InputIterator>::__type _Integral;
816 _M_initialize_dispatch(__first, __last, _Integral());
820#if __cplusplus >= 201103L
842#if __cplusplus >= 201103L
855 noexcept(_Node_alloc_traits::_S_nothrow_move())
857 constexpr bool __move_storage =
858 _Node_alloc_traits::_S_propagate_on_move_assign()
859 || _Node_alloc_traits::_S_always_equal();
860 _M_move_assign(
std::move(__x), __bool_constant<__move_storage>());
874 this->
assign(__l.begin(), __l.end());
890 assign(size_type __n,
const value_type& __val)
891 { _M_fill_assign(__n, __val); }
905#if __cplusplus >= 201103L
906 template<
typename _InputIterator,
907 typename = std::_RequireInputIter<_InputIterator>>
909 assign(_InputIterator __first, _InputIterator __last)
910 { _M_assign_dispatch(__first, __last, __false_type()); }
912 template<
typename _InputIterator>
914 assign(_InputIterator __first, _InputIterator __last)
917 typedef typename std::__is_integer<_InputIterator>::__type _Integral;
918 _M_assign_dispatch(__first, __last, _Integral());
922#if __cplusplus >= 201103L
932 { this->_M_assign_dispatch(__l.begin(), __l.end(), __false_type()); }
938 {
return allocator_type(_Base::_M_get_Node_allocator()); }
947 {
return iterator(this->_M_impl._M_node._M_next); }
965 {
return iterator(&this->_M_impl._M_node); }
973 end() const _GLIBCXX_NOEXCEPT
990 const_reverse_iterator
1008 const_reverse_iterator
1012#if __cplusplus >= 201103L
1036 const_reverse_iterator
1045 const_reverse_iterator
1055 _GLIBCXX_NODISCARD
bool
1057 {
return this->_M_impl._M_node._M_next == &this->_M_impl._M_node; }
1062 {
return _M_node_count(); }
1069#if __cplusplus >= 201103L
1080 resize(size_type __new_size);
1093 resize(size_type __new_size,
const value_type& __x);
1106 resize(size_type __new_size, value_type __x = value_type());
1116 {
return *
begin(); }
1124 {
return *
begin(); }
1163 { this->_M_insert(
begin(), __x); }
1165#if __cplusplus >= 201103L
1170 template<
typename... _Args>
1171#if __cplusplus > 201402L
1176 emplace_front(_Args&&... __args)
1178 this->_M_insert(
begin(), std::forward<_Args>(__args)...);
1179#if __cplusplus > 201402L
1199 { this->_M_erase(
begin()); }
1213 { this->_M_insert(
end(), __x); }
1215#if __cplusplus >= 201103L
1220 template<
typename... _Args>
1221#if __cplusplus > 201402L
1226 emplace_back(_Args&&... __args)
1228 this->_M_insert(
end(), std::forward<_Args>(__args)...);
1229#if __cplusplus > 201402L
1248 { this->_M_erase(
iterator(this->_M_impl._M_node._M_prev)); }
1250#if __cplusplus >= 201103L
1263 template<
typename... _Args>
1265 emplace(const_iterator __position, _Args&&... __args);
1279 insert(const_iterator __position,
const value_type& __x);
1296#if __cplusplus >= 201103L
1329 {
return this->
insert(__p, __l.begin(), __l.end()); }
1332#if __cplusplus >= 201103L
1348 insert(const_iterator __position, size_type __n,
const value_type& __x);
1363 insert(
iterator __position, size_type __n,
const value_type& __x)
1366 splice(__position, __tmp);
1370#if __cplusplus >= 201103L
1386 template<
typename _InputIterator,
1387 typename = std::_RequireInputIter<_InputIterator>>
1389 insert(const_iterator __position, _InputIterator __first,
1390 _InputIterator __last);
1405 template<
typename _InputIterator>
1407 insert(iterator __position, _InputIterator __first,
1408 _InputIterator __last)
1411 splice(__position, __tmp);
1431#if __cplusplus >= 201103L
1432 erase(const_iterator __position)
noexcept;
1434 erase(iterator __position);
1456#if __cplusplus >= 201103L
1462 while (__first != __last)
1463 __first =
erase(__first);
1464 return __last._M_const_cast();
1481 __detail::_List_node_base::swap(this->_M_impl._M_node,
1482 __x._M_impl._M_node);
1484 size_t __xsize = __x._M_get_size();
1485 __x._M_set_size(this->_M_get_size());
1486 this->_M_set_size(__xsize);
1488 _Node_alloc_traits::_S_on_swap(this->_M_get_Node_allocator(),
1489 __x._M_get_Node_allocator());
1518#if __cplusplus >= 201103L
1526 _M_check_equal_allocators(__x);
1528 this->_M_transfer(__position._M_const_cast(),
1531 this->_M_inc_size(__x._M_get_size());
1536#if __cplusplus >= 201103L
1538 splice(const_iterator __position,
list& __x)
noexcept
1542#if __cplusplus >= 201103L
1569 iterator __j = __i._M_const_cast();
1571 if (__position == __i || __position == __j)
1575 _M_check_equal_allocators(__x);
1577 this->_M_transfer(__position._M_const_cast(),
1578 __i._M_const_cast(), __j);
1580 this->_M_inc_size(1);
1584#if __cplusplus >= 201103L
1600#if __cplusplus >= 201103L
1635 if (__first != __last)
1638 _M_check_equal_allocators(__x);
1640 size_t __n = _S_distance(__first, __last);
1641 this->_M_inc_size(__n);
1642 __x._M_dec_size(__n);
1644 this->_M_transfer(__position._M_const_cast(),
1645 __first._M_const_cast(),
1646 __last._M_const_cast());
1650#if __cplusplus >= 201103L
1671#if __cplusplus > 201703L
1672# define __cpp_lib_list_remove_return_type 201806L
1673 typedef size_type __remove_return_type;
1674# define _GLIBCXX_LIST_REMOVE_RETURN_TYPE_TAG \
1675 __attribute__((__abi_tag__("__cxx20")))
1677 typedef void __remove_return_type;
1678# define _GLIBCXX_LIST_REMOVE_RETURN_TYPE_TAG
1693 _GLIBCXX_LIST_REMOVE_RETURN_TYPE_TAG
1694 __remove_return_type
1695 remove(
const _Tp& __value);
1708 template<
typename _Predicate>
1709 __remove_return_type
1722 _GLIBCXX_LIST_REMOVE_RETURN_TYPE_TAG
1723 __remove_return_type
1738 template<
typename _BinaryPredicate>
1739 __remove_return_type
1740 unique(_BinaryPredicate);
1742#undef _GLIBCXX_LIST_REMOVE_RETURN_TYPE_TAG
1753#if __cplusplus >= 201103L
1778#if __cplusplus >= 201103L
1779 template<
typename _StrictWeakOrdering>
1781 merge(
list&& __x, _StrictWeakOrdering __comp);
1783 template<
typename _StrictWeakOrdering>
1785 merge(
list& __x, _StrictWeakOrdering __comp)
1788 template<
typename _StrictWeakOrdering>
1790 merge(
list& __x, _StrictWeakOrdering __comp);
1800 { this->_M_impl._M_node._M_reverse(); }
1817 template<
typename _StrictWeakOrdering>
1819 sort(_StrictWeakOrdering);
1828 template<
typename _Integer>
1830 _M_initialize_dispatch(_Integer __n, _Integer __x, __true_type)
1831 { _M_fill_initialize(
static_cast<size_type
>(__n), __x); }
1834 template<
typename _InputIterator>
1836 _M_initialize_dispatch(_InputIterator __first, _InputIterator __last,
1839 for (; __first != __last; ++__first)
1840#
if __cplusplus >= 201103L
1841 emplace_back(*__first);
1850 _M_fill_initialize(size_type __n,
const value_type& __x)
1856#if __cplusplus >= 201103L
1859 _M_default_initialize(size_type __n)
1867 _M_default_append(size_type __n);
1876 template<
typename _Integer>
1878 _M_assign_dispatch(_Integer __n, _Integer __val, __true_type)
1879 { _M_fill_assign(__n, __val); }
1882 template<
typename _InputIterator>
1884 _M_assign_dispatch(_InputIterator __first, _InputIterator __last,
1890 _M_fill_assign(size_type __n,
const value_type& __val);
1895 _M_transfer(iterator __position, iterator __first, iterator __last)
1896 { __position._M_node->_M_transfer(__first._M_node, __last._M_node); }
1899#if __cplusplus < 201103L
1901 _M_insert(iterator __position,
const value_type& __x)
1904 __tmp->_M_hook(__position._M_node);
1905 this->_M_inc_size(1);
1908 template<
typename... _Args>
1910 _M_insert(iterator __position, _Args&&... __args)
1913 __tmp->_M_hook(__position._M_node);
1914 this->_M_inc_size(1);
1920 _M_erase(iterator __position) _GLIBCXX_NOEXCEPT
1922 this->_M_dec_size(1);
1923 __position._M_node->_M_unhook();
1924 _Node* __n =
static_cast<_Node*
>(__position._M_node);
1925#if __cplusplus >= 201103L
1926 _Node_alloc_traits::destroy(_M_get_Node_allocator(), __n->_M_valptr());
1928 _Tp_alloc_type(_M_get_Node_allocator()).destroy(__n->_M_valptr());
1936 _M_check_equal_allocators(
list& __x) _GLIBCXX_NOEXCEPT
1938 if (std::__alloc_neq<typename _Base::_Node_alloc_type>::
1939 _S_do_it(_M_get_Node_allocator(), __x._M_get_Node_allocator()))
1945 _M_resize_pos(size_type& __new_size)
const;
1947#if __cplusplus >= 201103L
1953 std::__alloc_on_move(this->_M_get_Node_allocator(),
1954 __x._M_get_Node_allocator());
1960 if (__x._M_get_Node_allocator() == this->_M_get_Node_allocator())
1965 _M_assign_dispatch(std::make_move_iterator(__x.begin()),
1966 std::make_move_iterator(__x.end()),
1971#if _GLIBCXX_USE_CXX11_ABI
1973 struct _Finalize_merge
1976 _Finalize_merge(
list& __dest,
list& __src,
const iterator& __src_next)
1977 : _M_dest(__dest), _M_src(__src), _M_next(__src_next)
1985 const size_t __num_unmerged =
std::distance(_M_next, _M_src.end());
1986 const size_t __orig_size = _M_src._M_get_size();
1987 _M_dest._M_inc_size(__orig_size - __num_unmerged);
1988 _M_src._M_set_size(__num_unmerged);
1993 const iterator& _M_next;
1995#if __cplusplus >= 201103L
1996 _Finalize_merge(
const _Finalize_merge&) =
delete;
2000 struct _Finalize_merge
2001 {
explicit _Finalize_merge(
list&,
list&,
const iterator&) { } };
2006#if __cpp_deduction_guides >= 201606
2007 template<
typename _InputIterator,
typename _ValT
2008 =
typename iterator_traits<_InputIterator>::value_type,
2009 typename _Allocator = allocator<_ValT>,
2010 typename = _RequireInputIter<_InputIterator>,
2011 typename = _RequireAllocator<_Allocator>>
2012 list(_InputIterator, _InputIterator, _Allocator = _Allocator())
2013 -> list<_ValT, _Allocator>;
2016_GLIBCXX_END_NAMESPACE_CXX11
2028 template<
typename _Tp,
typename _Alloc>
2032#if _GLIBCXX_USE_CXX11_ABI
2038 const_iterator __end1 = __x.
end();
2039 const_iterator __end2 = __y.
end();
2041 const_iterator __i1 = __x.
begin();
2042 const_iterator __i2 = __y.
begin();
2043 while (__i1 != __end1 && __i2 != __end2 && *__i1 == *__i2)
2048 return __i1 == __end1 && __i2 == __end2;
2051#if __cpp_lib_three_way_comparison
2063 template<
typename _Tp,
typename _Alloc>
2064 inline __detail::__synth3way_t<_Tp>
2065 operator<=>(
const list<_Tp, _Alloc>& __x,
const list<_Tp, _Alloc>& __y)
2067 return std::lexicographical_compare_three_way(__x.begin(), __x.end(),
2068 __y.begin(), __y.end(),
2069 __detail::__synth3way);
2083 template<
typename _Tp,
typename _Alloc>
2086 {
return std::lexicographical_compare(__x.
begin(), __x.
end(),
2090 template<
typename _Tp,
typename _Alloc>
2093 {
return !(__x == __y); }
2096 template<
typename _Tp,
typename _Alloc>
2099 {
return __y < __x; }
2102 template<
typename _Tp,
typename _Alloc>
2105 {
return !(__y < __x); }
2108 template<
typename _Tp,
typename _Alloc>
2111 {
return !(__x < __y); }
2115 template<
typename _Tp,
typename _Alloc>
2118 _GLIBCXX_NOEXCEPT_IF(
noexcept(__x.swap(__y)))
2121_GLIBCXX_END_NAMESPACE_CONTAINER
2123#if _GLIBCXX_USE_CXX11_ABI
2126 template<
typename _Tp>
2128 __distance(_GLIBCXX_STD_C::_List_iterator<_Tp> __first,
2129 _GLIBCXX_STD_C::_List_iterator<_Tp> __last,
2130 input_iterator_tag __tag)
2132 typedef _GLIBCXX_STD_C::_List_const_iterator<_Tp> _CIter;
2133 return std::__distance(_CIter(__first), _CIter(__last), __tag);
2136 template<
typename _Tp>
2138 __distance(_GLIBCXX_STD_C::_List_const_iterator<_Tp> __first,
2139 _GLIBCXX_STD_C::_List_const_iterator<_Tp> __last,
2142 typedef __detail::_List_node_header _Sentinel;
2143 _GLIBCXX_STD_C::_List_const_iterator<_Tp> __beyond = __last;
2145 const bool __whole = __first == __beyond;
2146 if (__builtin_constant_p (__whole) && __whole)
2147 return static_cast<const _Sentinel*
>(__last._M_node)->_M_size;
2150 while (__first != __last)
2159_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.