63#if __cplusplus >= 201103L
69#if __glibcxx_containers_ranges
74#if __cplusplus < 201103L
75# undef _GLIBCXX_USE_ALLOC_PTR_FOR_LIST
76# define _GLIBCXX_USE_ALLOC_PTR_FOR_LIST 0
77#elif ! defined _GLIBCXX_USE_ALLOC_PTR_FOR_LIST
78# define _GLIBCXX_USE_ALLOC_PTR_FOR_LIST 1
81namespace std _GLIBCXX_VISIBILITY(default)
83_GLIBCXX_BEGIN_NAMESPACE_VERSION
109 _M_reverse() _GLIBCXX_USE_NOEXCEPT;
115 _M_unhook() _GLIBCXX_USE_NOEXCEPT;
123#if _GLIBCXX_USE_CXX11_ABI
132 _List_node_header() _GLIBCXX_NOEXCEPT
135#if __cplusplus >= 201103L
136 _List_node_header(_List_node_header&& __x) noexcept
139 if (__x._M_base()->_M_next == __x._M_base())
140 this->_M_next = this->_M_prev =
this;
143 this->_M_next->_M_prev = this->_M_prev->_M_next = this->_M_base();
149 _M_move_nodes(_List_node_header&& __x)
152 if (__xnode->_M_next == __xnode)
157 __node->_M_next = __xnode->_M_next;
158 __node->_M_prev = __xnode->_M_prev;
159 __node->_M_next->_M_prev = __node->_M_prev->_M_next = __node;
160 _List_size::operator=(__x);
167 _M_init() _GLIBCXX_NOEXCEPT
169 this->_M_next = this->_M_prev =
this;
170 _List_size::operator=(_List_size());
173 using _List_node_base::_M_base;
174#if ! _GLIBCXX_INLINE_VERSION
181#if _GLIBCXX_USE_ALLOC_PTR_FOR_LIST
182_GLIBCXX_BEGIN_NAMESPACE_CONTAINER
183_GLIBCXX_BEGIN_NAMESPACE_CXX11
184 template<
typename _Tp,
typename _Allocator>
class list;
185_GLIBCXX_END_NAMESPACE_CXX11
186_GLIBCXX_END_NAMESPACE_CONTAINER
191 template<
typename _Vo
idPtr>
199 swap(_Node_base& __x, _Node_base& __y)
noexcept;
202 _M_transfer(_Base_ptr
const __first, _Base_ptr
const __last)
noexcept;
205 _M_hook(_Base_ptr
const __position)
noexcept
207 auto __self = this->_M_base();
208 this->_M_next = __position;
209 this->_M_prev = __position->_M_prev;
210 __position->_M_prev->_M_next = __self;
211 __position->_M_prev = __self;
217 auto const __next_node = this->_M_next;
218 auto const __prev_node = this->_M_prev;
219 __prev_node->_M_next = __next_node;
220 __next_node->_M_prev = __prev_node;
230 _M_base() const noexcept
232 return pointer_traits<_Base_ptr>::
233 pointer_to(
const_cast<_Node_base&
>(*
this));
237 using ::std::__detail::_List_size;
242 template<
typename _Vo
idPtr>
244 :
public _Node_base<_VoidPtr>, _List_size
246 _Node_header() noexcept
249 _Node_header(_Node_header&& __x) noexcept
250 : _Node_base<_VoidPtr>(__x), _List_size(__x)
252 if (__x._M_base()->_M_next == __x._M_base())
253 this->_M_next = this->_M_prev = this->_M_base();
256 this->_M_next->_M_prev = this->_M_prev->_M_next = this->_M_base();
262 _M_move_nodes(_Node_header&& __x)
noexcept
264 auto const __xnode = __x._M_base();
265 if (__xnode->_M_next == __xnode)
269 auto const __node = this->_M_base();
270 __node->_M_next = __xnode->_M_next;
271 __node->_M_prev = __xnode->_M_prev;
272 __node->_M_next->_M_prev = __node->_M_prev->_M_next = __node;
273 _List_size::operator=(__x);
281 this->_M_next = this->_M_prev = this->_M_base();
282 _List_size::operator=(_List_size());
285 void _M_reverse() noexcept;
289 template<typename _ValPtr>
290 struct _Node : public __list::_Node_base<
__ptr_rebind<_ValPtr,
void>>
292 using value_type =
typename pointer_traits<_ValPtr>::element_type;
297 _Node(_Node&&) =
delete;
299 union _Uninit_storage
301 _Uninit_storage() noexcept { }
302 ~_Uninit_storage() { }
306 _Uninit_storage _M_u;
316 {
return pointer_traits<_Node_ptr>::pointer_to(*
this); }
319 template<
bool _Const,
typename _Ptr>
class _Iterator;
321 template<
bool _Const,
typename _Ptr>
324 using _Node = __list::_Node<_Ptr>;
326 =
typename __list::_Node_base<__ptr_rebind<_Ptr, void>>::_Base_ptr;
328 template<
typename _Tp>
329 using __maybe_const = __conditional_t<_Const, const _Tp, _Tp>;
332 using value_type =
typename pointer_traits<_Ptr>::element_type;
333 using difference_type = ptrdiff_t;
334 using iterator_category = bidirectional_iterator_tag;
335 using pointer = __maybe_const<value_type>*;
336 using reference = __maybe_const<value_type>&;
338 constexpr _Iterator() noexcept : _M_node() { }
340 _Iterator(
const _Iterator&) =
default;
341 _Iterator& operator=(
const _Iterator&) =
default;
343#ifdef __glibcxx_concepts
345 _Iterator(
const _Iterator<false, _Ptr>& __i)
requires _Const
347 template<
bool _OtherConst,
348 typename = __enable_if_t<_Const && !_OtherConst>>
350 _Iterator(
const _Iterator<_OtherConst, _Ptr>& __i)
352 : _M_node(__i._M_node) { }
355 _Iterator(_Base_ptr __x) noexcept
362 {
return static_cast<_Node&
>(*_M_node)._M_u._M_data; }
366 operator->() const noexcept
369 _GLIBCXX14_CONSTEXPR _Iterator&
370 operator++() noexcept
372 _M_node = _M_node->_M_next;
376 _GLIBCXX14_CONSTEXPR _Iterator
377 operator++(
int)
noexcept
380 _M_node = _M_node->_M_next;
384 _GLIBCXX14_CONSTEXPR _Iterator&
385 operator--() noexcept
387 _M_node = _M_node->_M_prev;
391 _GLIBCXX14_CONSTEXPR _Iterator
392 operator--(
int)
noexcept
395 _M_node = _M_node->_M_prev;
400 friend constexpr bool
401 operator==(
const _Iterator& __x,
const _Iterator& __y)
noexcept
402 {
return __x._M_node == __y._M_node; }
404#if __cpp_impl_three_way_comparison < 201907L
406 friend constexpr bool
407 operator!=(
const _Iterator& __x,
const _Iterator& __y)
noexcept
408 {
return __x._M_node != __y._M_node; }
412 template<
typename _Tp,
typename _Allocator>
413 friend class _GLIBCXX_STD_C::list;
415 friend _Iterator<!_Const, _Ptr>;
417 constexpr _Iterator<false, _Ptr>
418 _M_const_cast() const noexcept
419 {
return _Iterator<false, _Ptr>(_M_node); }
426_GLIBCXX_BEGIN_NAMESPACE_CONTAINER
427 template<
typename _Tp>
struct _List_node;
428 template<
typename _Tp>
struct _List_iterator;
429 template<
typename _Tp>
struct _List_const_iterator;
430_GLIBCXX_END_NAMESPACE_CONTAINER
435 template<
typename _Tp,
typename _Ptr>
438#if _GLIBCXX_USE_ALLOC_PTR_FOR_LIST <= 9000
442 template<
typename _Tp>
443 struct _Node_traits<_Tp, _Tp*>
445 typedef __detail::_List_node_base _Node_base;
446 typedef __detail::_List_node_header _Node_header;
447 typedef _GLIBCXX_STD_C::_List_node<_Tp> _Node;
448 typedef _GLIBCXX_STD_C::_List_iterator<_Tp> _Iterator;
449 typedef _GLIBCXX_STD_C::_List_const_iterator<_Tp> _Const_iterator;
453#if ! _GLIBCXX_USE_ALLOC_PTR_FOR_LIST
455 template<
typename _Tp,
typename _Ptr>
457 : _Node_traits<_Tp, _Tp*>
461 template<
typename _Tp,
typename _Ptr>
465 using _VoidPtr = __ptr_rebind<_Ptr, void>;
466 using _ValPtr = __ptr_rebind<_Ptr, _Tp>;
469 using _Node_base = __list::_Node_base<_VoidPtr>;
470 using _Node_header = __list::_Node_header<_VoidPtr>;
471 using _Node = __list::_Node<_ValPtr>;
472 using _Iterator = __list::_Iterator<false, _ValPtr>;
473 using _Const_iterator = __list::_Iterator<true, _ValPtr>;
478 template<
typename _NodeBaseT>
482 typedef _NodeBaseT _Base;
483 typedef typename _Base::_Base_ptr _Base_ptr;
485 _Scratch_list() { this->_M_next = this->_M_prev = this->_M_base(); }
487 bool empty()
const {
return this->_M_next == this->_M_base(); }
489 void swap(_Base& __l) { _Base::swap(*
this, __l); }
491 template<
typename _Iter,
typename _Cmp>
497 operator()(_Base_ptr __lhs, _Base_ptr __rhs)
498 {
return _M_cmp(*_Iter(__lhs), *_Iter(__rhs)); }
501 template<
typename _Iter>
502 struct _Ptr_cmp<_Iter, void>
505 operator()(_Base_ptr __lhs, _Base_ptr __rhs)
const
506 {
return *_Iter(__lhs) < *_Iter(__rhs); }
510 template<
typename _Cmp>
512 merge(_Base& __x, _Cmp __comp)
514 _Base_ptr __first1 = this->_M_next;
515 _Base_ptr
const __last1 = this->_M_base();
516 _Base_ptr __first2 = __x._M_next;
517 _Base_ptr
const __last2 = __x._M_base();
519 while (__first1 != __last1 && __first2 != __last2)
521 if (__comp(__first2, __first1))
523 _Base_ptr __next = __first2->_M_next;
524 __first1->_M_transfer(__first2, __next);
528 __first1 = __first1->_M_next;
530 if (__first2 != __last2)
531 this->_M_transfer(__first2, __last2);
535 void _M_take_one(_Base_ptr __i)
536 { this->_M_transfer(__i, __i->_M_next); }
539 void _M_put_all(_Base_ptr __i)
542 __i->_M_transfer(this->_M_next, this->_M_base());
547_GLIBCXX_BEGIN_NAMESPACE_CONTAINER
550 template<
typename _Tp>
555#if __cplusplus >= 201103L
556 __gnu_cxx::__aligned_membuf<_Tp> _M_storage;
557 _Tp* _M_valptr() {
return _M_storage._M_ptr(); }
558 _Tp
const* _M_valptr()
const {
return _M_storage._M_ptr(); }
565 _Node_ptr _M_node_ptr() {
return this; }
573 template<
typename _Tp>
574 struct _List_iterator
578 typedef ptrdiff_t difference_type;
580 typedef _Tp value_type;
581 typedef _Tp* pointer;
582 typedef _Tp& reference;
584 _List_iterator() _GLIBCXX_NOEXCEPT
592 _M_const_cast()
const _GLIBCXX_NOEXCEPT
598 operator*()
const _GLIBCXX_NOEXCEPT
599 {
return *
static_cast<_Node*
>(_M_node)->_M_valptr(); }
603 operator->()
const _GLIBCXX_NOEXCEPT
604 {
return static_cast<_Node*
>(_M_node)->_M_valptr(); }
607 operator++() _GLIBCXX_NOEXCEPT
609 _M_node = _M_node->_M_next;
614 operator++(
int) _GLIBCXX_NOEXCEPT
616 _List_iterator __tmp = *
this;
617 _M_node = _M_node->_M_next;
622 operator--() _GLIBCXX_NOEXCEPT
624 _M_node = _M_node->_M_prev;
629 operator--(
int) _GLIBCXX_NOEXCEPT
631 _List_iterator __tmp = *
this;
632 _M_node = _M_node->_M_prev;
638 operator==(
const _List_iterator& __x,
639 const _List_iterator& __y) _GLIBCXX_NOEXCEPT
640 {
return __x._M_node == __y._M_node; }
642#if __cpp_impl_three_way_comparison < 201907L
645 operator!=(
const _List_iterator& __x,
646 const _List_iterator& __y) _GLIBCXX_NOEXCEPT
647 {
return __x._M_node != __y._M_node; }
659 template<
typename _Tp>
660 struct _List_const_iterator
665 typedef ptrdiff_t difference_type;
667 typedef _Tp value_type;
668 typedef const _Tp* pointer;
669 typedef const _Tp& reference;
671 _List_const_iterator() _GLIBCXX_NOEXCEPT
679 _List_const_iterator(
const iterator& __x) _GLIBCXX_NOEXCEPT
680 : _M_node(__x._M_node) { }
683 _M_const_cast()
const _GLIBCXX_NOEXCEPT
689 operator*()
const _GLIBCXX_NOEXCEPT
690 {
return *
static_cast<_Node*
>(_M_node)->_M_valptr(); }
694 operator->()
const _GLIBCXX_NOEXCEPT
695 {
return static_cast<_Node*
>(_M_node)->_M_valptr(); }
697 _List_const_iterator&
698 operator++() _GLIBCXX_NOEXCEPT
700 _M_node = _M_node->_M_next;
705 operator++(
int) _GLIBCXX_NOEXCEPT
707 _List_const_iterator __tmp = *
this;
708 _M_node = _M_node->_M_next;
712 _List_const_iterator&
713 operator--() _GLIBCXX_NOEXCEPT
715 _M_node = _M_node->_M_prev;
720 operator--(
int) _GLIBCXX_NOEXCEPT
722 _List_const_iterator __tmp = *
this;
723 _M_node = _M_node->_M_prev;
729 operator==(
const _List_const_iterator& __x,
730 const _List_const_iterator& __y) _GLIBCXX_NOEXCEPT
731 {
return __x._M_node == __y._M_node; }
733#if __cpp_impl_three_way_comparison < 201907L
736 operator!=(
const _List_const_iterator& __x,
737 const _List_const_iterator& __y) _GLIBCXX_NOEXCEPT
738 {
return __x._M_node != __y._M_node; }
745_GLIBCXX_BEGIN_NAMESPACE_CXX11
747 template<
typename _Tp,
typename _Alloc>
752 rebind<_Tp>::other _Tp_alloc_type;
755 typedef __list::_Node_traits<_Tp, typename _Tp_alloc_traits::pointer>
757 typedef typename _Tp_alloc_traits::template
758 rebind<typename _Node_traits::_Node>::other _Node_alloc_type;
761#if __cplusplus < 201103L || ! _GLIBCXX_USE_ALLOC_PTR_FOR_LIST
764 using _Node_ptr =
typename _Node_alloc_traits::pointer;
768 :
public _Node_alloc_type
770 typename _Node_traits::_Node_header _M_node;
772 _List_impl() _GLIBCXX_NOEXCEPT_IF(
777 _List_impl(
const _Node_alloc_type& __a) _GLIBCXX_NOEXCEPT
778 : _Node_alloc_type(__a)
781#if __cplusplus >= 201103L
782 _List_impl(_List_impl&&) =
default;
784 _List_impl(_Node_alloc_type&& __a, _List_impl&& __x)
788 _List_impl(_Node_alloc_type&& __a) noexcept
796#if _GLIBCXX_USE_CXX11_ABI
797 size_t _M_get_size()
const {
return _M_impl._M_node._M_size; }
799 void _M_set_size(
size_t __n) { _M_impl._M_node._M_size = __n; }
801 void _M_inc_size(
size_t __n) { _M_impl._M_node._M_size += __n; }
803 void _M_dec_size(
size_t __n) { _M_impl._M_node._M_size -= __n; }
806 size_t _M_get_size()
const {
return 0; }
807 void _M_set_size(
size_t) { }
808 void _M_inc_size(
size_t) { }
809 void _M_dec_size(
size_t) { }
812 typename _Node_alloc_traits::pointer
817 _M_put_node(_Node_ptr __p) _GLIBCXX_NOEXCEPT
819#if __cplusplus < 201103L || _GLIBCXX_USE_ALLOC_PTR_FOR_LIST
822#pragma GCC diagnostic push
823#pragma GCC diagnostic ignored "-Wc++17-extensions"
824 using __alloc_pointer =
typename _Node_alloc_traits::pointer;
831 auto __ap = pointer_traits<__alloc_pointer>::pointer_to(*__p);
834#pragma GCC diagnostic pop
839 _M_destroy_node(_Node_ptr __p)
842#if __cplusplus < 201103L
843 _Tp_alloc_type(_M_impl).destroy(__p->_M_valptr());
845 _Node_alloc_traits::destroy(_M_impl, __p->_M_valptr());
847 using _Node =
typename _Node_traits::_Node;
848 using _Base_ptr =
typename _Node_traits::_Node_base::_Base_ptr;
849#pragma GCC diagnostic push
850#pragma GCC diagnostic ignored "-Wc++17-extensions"
853#pragma GCC diagnostic pop
855 this->_M_put_node(__p);
859 typedef _Alloc allocator_type;
862 _M_get_Node_allocator() _GLIBCXX_NOEXCEPT
865 const _Node_alloc_type&
866 _M_get_Node_allocator()
const _GLIBCXX_NOEXCEPT
869#if __cplusplus >= 201103L
870 _List_base() =
default;
875 _List_base(
const _Node_alloc_type& __a) _GLIBCXX_NOEXCEPT
879#if __cplusplus >= 201103L
880 _List_base(_List_base&&) =
default;
883 _List_base(_Node_alloc_type&& __a, _List_base&& __x)
888 _List_base(_Node_alloc_type&& __a)
893 _M_move_nodes(_List_base&& __x)
894 { _M_impl._M_node._M_move_nodes(
std::move(__x._M_impl._M_node)); }
898 ~_List_base() _GLIBCXX_NOEXCEPT
902 _M_clear() _GLIBCXX_NOEXCEPT;
905 _M_init() _GLIBCXX_NOEXCEPT
906 { this->_M_impl._M_node._M_init(); }
908#if !_GLIBCXX_INLINE_VERSION
921#pragma GCC diagnostic push
922#pragma GCC diagnostic ignored "-Wc++17-extensions"
924# if __cplusplus >= 201103L
925 _List_base(_List_base&& __x, _Node_alloc_type&& __a)
928#if _GLIBCXX_USE_ALLOC_PTR_FOR_LIST
931 if (__x._M_get_Node_allocator() == _M_get_Node_allocator())
941#if _GLIBCXX_USE_ALLOC_PTR_FOR_LIST
948 while (__first != __last)
950 __first = __first->_M_next;
957#if _GLIBCXX_USE_CXX11_ABI
961 {
return _S_distance(__first, __last); }
964 size_t _M_node_count()
const {
return _M_get_size(); }
966 size_t _M_distance(
const void*,
const void*)
const {
return 0; }
969 size_t _M_node_count()
const
971 return _S_distance(_M_impl._M_node._M_next, _M_impl._M_node._M_base());
974#pragma GCC diagnostic pop
1024 template<
typename _Tp,
typename _Alloc = std::allocator<_Tp> >
1025 class list :
protected _List_base<_Tp, _Alloc>
1027#ifdef _GLIBCXX_CONCEPT_CHECKS
1029 typedef typename _Alloc::value_type _Alloc_value_type;
1030# if __cplusplus < 201103L
1031 __glibcxx_class_requires(_Tp, _SGIAssignableConcept)
1033 __glibcxx_class_requires2(_Tp, _Alloc_value_type, _SameTypeConcept)
1036#if __cplusplus >= 201103L
1038 "std::list must have a non-const, non-volatile value_type");
1039# if __cplusplus > 201703L || defined __STRICT_ANSI__
1041 "std::list must have the same value_type as its allocator");
1045 typedef _List_base<_Tp, _Alloc> _Base;
1046 typedef typename _Base::_Tp_alloc_type _Tp_alloc_type;
1047 typedef typename _Base::_Tp_alloc_traits _Tp_alloc_traits;
1048 typedef typename _Base::_Node_alloc_type _Node_alloc_type;
1049 typedef typename _Base::_Node_alloc_traits _Node_alloc_traits;
1050 typedef typename _Base::_Node_traits _Node_traits;
1053 typedef _Tp value_type;
1054 typedef typename _Tp_alloc_traits::pointer pointer;
1055 typedef typename _Tp_alloc_traits::const_pointer const_pointer;
1056 typedef typename _Tp_alloc_traits::reference reference;
1057 typedef typename _Tp_alloc_traits::const_reference const_reference;
1058 typedef typename _Node_traits::_Iterator iterator;
1059 typedef typename _Node_traits::_Const_iterator const_iterator;
1062 typedef size_t size_type;
1063 typedef ptrdiff_t difference_type;
1064 typedef _Alloc allocator_type;
1069 typedef typename _Node_alloc_traits::pointer _Node_ptr;
1071 using _Base::_M_impl;
1072 using _Base::_M_put_node;
1073 using _Base::_M_get_node;
1074 using _Base::_M_get_Node_allocator;
1082#if __cplusplus < 201103L
1086 _Node_ptr __p = this->_M_get_node();
1089 _Tp_alloc_type __alloc(_M_get_Node_allocator());
1090 __alloc.construct(__p->_M_valptr(), __x);
1095 __throw_exception_again;
1100 template<
typename... _Args>
1104 auto& __alloc = _M_get_Node_allocator();
1105 auto __guard = std::__allocate_guarded_obj(__alloc);
1106 _Node_alloc_traits::construct(__alloc, __guard->_M_valptr(),
1108 return __guard.release();
1119#if __cplusplus >= 201103L
1130 list(
const allocator_type& __a) _GLIBCXX_NOEXCEPT
1131 : _Base(_Node_alloc_type(__a)) { }
1133#if __cplusplus >= 201103L
1143 list(size_type __n,
const allocator_type& __a = allocator_type())
1144 : _Base(_Node_alloc_type(__a))
1145 { _M_default_initialize(__n); }
1155 list(size_type __n,
const value_type& __value,
1156 const allocator_type& __a = allocator_type())
1157 : _Base(_Node_alloc_type(__a))
1158 { _M_fill_initialize(__n, __value); }
1170 const allocator_type& __a = allocator_type())
1171 : _Base(_Node_alloc_type(__a))
1172 { _M_fill_initialize(__n, __value); }
1183 : _Base(_Node_alloc_traits::
1184 _S_select_on_copy(__x._M_get_Node_allocator()))
1185 { _M_initialize_dispatch(__x.
begin(), __x.
end(), __false_type()); }
1187#if __cplusplus >= 201103L
1206 const allocator_type& __a = allocator_type())
1207 : _Base(_Node_alloc_type(__a))
1208 { _M_initialize_dispatch(__l.begin(), __l.end(), __false_type()); }
1210 list(
const list& __x,
const __type_identity_t<allocator_type>& __a)
1211 : _Base(_Node_alloc_type(__a))
1212 { _M_initialize_dispatch(__x.
begin(), __x.
end(), __false_type()); }
1215 list(list&& __x,
const allocator_type& __a, true_type) noexcept
1216 : _Base(_Node_alloc_type(__a),
std::move(__x))
1219 list(list&& __x,
const allocator_type& __a, false_type)
1220 : _Base(_Node_alloc_type(__a))
1222 if (__x._M_get_Node_allocator() == this->_M_get_Node_allocator())
1225 insert(
begin(), std::__make_move_if_noexcept_iterator(__x.
begin()),
1226 std::__make_move_if_noexcept_iterator(__x.
end()));
1230 list(list&& __x,
const __type_identity_t<allocator_type>& __a)
1231 noexcept(_Node_alloc_traits::_S_always_equal())
1232 : list(std::
move(__x), __a,
1233 typename _Node_alloc_traits::is_always_equal{})
1247#if __cplusplus >= 201103L
1248 template<
typename _InputIterator,
1249 typename = std::_RequireInputIter<_InputIterator>>
1250 list(_InputIterator __first, _InputIterator __last,
1251 const allocator_type& __a = allocator_type())
1252 : _Base(_Node_alloc_type(__a))
1253 { _M_initialize_dispatch(__first, __last, __false_type()); }
1255 template<
typename _InputIterator>
1256 list(_InputIterator __first, _InputIterator __last,
1257 const allocator_type& __a = allocator_type())
1258 : _Base(_Node_alloc_type(__a))
1261 typedef typename std::__is_integer<_InputIterator>::__type _Integral;
1262 _M_initialize_dispatch(__first, __last, _Integral());
1266#if __glibcxx_containers_ranges
1271 template<__detail::__container_compatible_range<_Tp> _Rg>
1272 list(from_range_t, _Rg&& __rg,
const _Alloc& __a = _Alloc())
1273 : _Base(_Node_alloc_type(__a))
1275 auto __first = ranges::begin(__rg);
1276 const auto __last = ranges::end(__rg);
1277 for (; __first != __last; ++__first)
1278 emplace_back(*__first);
1282#if __cplusplus >= 201103L
1304#if __cplusplus >= 201103L
1305#pragma GCC diagnostic push
1306#pragma GCC diagnostic ignored "-Wc++17-extensions"
1319 noexcept(_Node_alloc_traits::_S_nothrow_move())
1321 constexpr bool __move_storage =
1322 _Node_alloc_traits::_S_propagate_on_move_assign()
1323 || _Node_alloc_traits::_S_always_equal();
1324 if constexpr (!__move_storage)
1326 if (__x._M_get_Node_allocator() != this->_M_get_Node_allocator())
1330 _M_assign_dispatch(std::make_move_iterator(__x.
begin()),
1331 std::make_move_iterator(__x.
end()),
1340 if constexpr (_Node_alloc_traits::_S_propagate_on_move_assign())
1341 this->_M_get_Node_allocator()
1342 =
std::move(__x._M_get_Node_allocator());
1346#pragma GCC diagnostic pop
1358 this->
assign(__l.begin(), __l.end());
1363#if __glibcxx_containers_ranges
1368 template<__detail::__container_compatible_range<_Tp> _Rg>
1370 assign_range(_Rg&& __rg)
1372 static_assert(assignable_from<_Tp&, ranges::range_reference_t<_Rg>>);
1376 auto __first2 = ranges::begin(__rg);
1377 const auto __last2 = ranges::end(__rg);
1378 for (; __first1 != __last1 && __first2 != __last2;
1379 ++__first1, (void)++__first2)
1380 *__first1 = *__first2;
1381 if (__first2 == __last2)
1382 erase(__first1, __last1);
1384 insert_range(__last1,
1400 assign(size_type __n,
const value_type& __val)
1401 { _M_fill_assign(__n, __val); }
1415#if __cplusplus >= 201103L
1416 template<
typename _InputIterator,
1417 typename = std::_RequireInputIter<_InputIterator>>
1419 assign(_InputIterator __first, _InputIterator __last)
1420 { _M_assign_dispatch(__first, __last, __false_type()); }
1422 template<
typename _InputIterator>
1424 assign(_InputIterator __first, _InputIterator __last)
1427 typedef typename std::__is_integer<_InputIterator>::__type _Integral;
1428 _M_assign_dispatch(__first, __last, _Integral());
1432#if __cplusplus >= 201103L
1442 { this->_M_assign_dispatch(__l.begin(), __l.end(), __false_type()); }
1448 {
return allocator_type(_Base::_M_get_Node_allocator()); }
1458 {
return iterator(this->_M_impl._M_node._M_next); }
1468 {
return const_iterator(this->_M_impl._M_node._M_next); }
1478 {
return iterator(this->_M_impl._M_node._M_base()); }
1488 {
return const_iterator(this->_M_impl._M_node._M_base()); }
1498 {
return reverse_iterator(
end()); }
1506 const_reverse_iterator
1508 {
return const_reverse_iterator(
end()); }
1518 {
return reverse_iterator(
begin()); }
1526 const_reverse_iterator
1528 {
return const_reverse_iterator(
begin()); }
1530#if __cplusplus >= 201103L
1539 {
return const_iterator(this->_M_impl._M_node._M_next); }
1549 {
return const_iterator(this->_M_impl._M_node._M_base()); }
1557 const_reverse_iterator
1559 {
return const_reverse_iterator(
end()); }
1567 const_reverse_iterator
1569 {
return const_reverse_iterator(
begin()); }
1577 _GLIBCXX_NODISCARD
bool
1580 return this->_M_impl._M_node._M_next == this->_M_impl._M_node._M_base();
1588#if _GLIBCXX_USE_CXX11_ABI
1589 return this->_M_get_size();
1601#if __cplusplus >= 201103L
1625 resize(size_type __new_size,
const value_type& __x);
1638 resize(size_type __new_size, value_type __x = value_type());
1650 __glibcxx_requires_nonempty();
1662 __glibcxx_requires_nonempty();
1674 __glibcxx_requires_nonempty();
1675 iterator __tmp =
end();
1688 __glibcxx_requires_nonempty();
1689 const_iterator __tmp =
end();
1707 { this->_M_insert(
begin(), __x); }
1709#if __cplusplus >= 201103L
1714 template<
typename... _Args>
1715#if __cplusplus > 201402L
1720 emplace_front(_Args&&... __args)
1723#if __cplusplus > 201402L
1729#if __glibcxx_containers_ranges
1742 template<__detail::__container_compatible_range<_Tp> _Rg>
1744 prepend_range(_Rg&& __rg)
1748 splice(
begin(), __tmp);
1763 template<__detail::__container_compatible_range<_Tp> _Rg>
1765 append_range(_Rg&& __rg)
1769 splice(
end(), __tmp);
1788 __glibcxx_requires_nonempty();
1789 this->_M_erase(
begin());
1804 { this->_M_insert(
end(), __x); }
1806#if __cplusplus >= 201103L
1811 template<
typename... _Args>
1812#if __cplusplus > 201402L
1817 emplace_back(_Args&&... __args)
1820#if __cplusplus > 201402L
1840 __glibcxx_requires_nonempty();
1841 this->_M_erase(iterator(this->_M_impl._M_node._M_prev));
1844#if __cplusplus >= 201103L
1857 template<
typename... _Args>
1859 emplace(const_iterator __position, _Args&&... __args);
1875#if __cplusplus >= 201103L
1877 insert(const_iterator __position,
const value_type& __x);
1880 insert(const_iterator __position, value_type&& __x)
1888#if __cplusplus >= 201103L
1906 {
return this->
insert(__p, __l.begin(), __l.end()); }
1923#if __cplusplus >= 201103L
1925 insert(const_iterator __position, size_type __n,
const value_type& __x);
1928 insert(iterator __position, size_type __n,
const value_type& __x)
1931 splice(__position, __tmp);
1950#if __cplusplus >= 201103L
1951 template<
typename _InputIterator,
1952 typename = std::_RequireInputIter<_InputIterator>>
1954 insert(const_iterator __position, _InputIterator __first,
1955 _InputIterator __last);
1957 template<
typename _InputIterator>
1959 insert(iterator __position, _InputIterator __first,
1960 _InputIterator __last)
1963 splice(__position, __tmp);
1967#if __glibcxx_containers_ranges
1983 template<__detail::__container_compatible_range<_Tp> _Rg>
1985 insert_range(const_iterator __position, _Rg&& __rg)
1990 auto __it = __tmp.begin();
1991 splice(__position, __tmp);
1994 return __position._M_const_cast();
2014#if __cplusplus >= 201103L
2015 erase(const_iterator __position)
noexcept;
2017 erase(iterator __position);
2039#if __cplusplus >= 201103L
2040 erase(const_iterator __first, const_iterator __last)
noexcept
2042 erase(iterator __first, iterator __last)
2045 while (__first != __last)
2046 __first =
erase(__first);
2047 return __last._M_const_cast();
2064 _Node_traits::_Node_base::swap(this->_M_impl._M_node,
2065 __x._M_impl._M_node);
2067 size_t __xsize = __x._M_get_size();
2068 __x._M_set_size(this->_M_get_size());
2069 this->_M_set_size(__xsize);
2071 _Node_alloc_traits::_S_on_swap(this->_M_get_Node_allocator(),
2072 __x._M_get_Node_allocator());
2101#if __cplusplus >= 201103L
2109 _M_check_equal_allocators(__x);
2111 this->_M_transfer(__position._M_const_cast(),
2114 this->_M_inc_size(__x._M_get_size());
2119#if __cplusplus >= 201103L
2121 splice(const_iterator __position,
list& __x)
noexcept
2136#if __cplusplus >= 201103L
2138 splice(const_iterator __position,
list&& __x, const_iterator __i)
noexcept
2141 splice(iterator __position,
list& __x, iterator __i)
2144 iterator __j = __i._M_const_cast();
2146 if (__position == __i || __position == __j)
2150 _M_check_equal_allocators(__x);
2152 this->_M_transfer(__position._M_const_cast(),
2153 __i._M_const_cast(), __j);
2155 this->_M_inc_size(1);
2159#if __cplusplus >= 201103L
2161 splice(const_iterator __position,
list& __x, const_iterator __i)
noexcept
2178#if __cplusplus >= 201103L
2180 splice(const_iterator __position,
list&& __x, const_iterator __first,
2181 const_iterator __last)
noexcept
2184 splice(iterator __position,
list& __x, iterator __first,
2188 if (__first != __last)
2191 _M_check_equal_allocators(__x);
2193#if _GLIBCXX_USE_CXX11_ABI
2195 this->_M_inc_size(__n);
2196 __x._M_dec_size(__n);
2199 this->_M_transfer(__position._M_const_cast(),
2200 __first._M_const_cast(),
2201 __last._M_const_cast());
2205#if __cplusplus >= 201103L
2220 splice(const_iterator __position,
list& __x, const_iterator __first,
2221 const_iterator __last)
noexcept
2226#ifdef __glibcxx_list_remove_return_type
2228# define _GLIBCXX_LIST_REMOVE_RETURN_TYPE_TAG \
2229 __attribute__((__abi_tag__("__cxx20")))
2231 typedef void __remove_return_type;
2232# define _GLIBCXX_LIST_REMOVE_RETURN_TYPE_TAG
2247 _GLIBCXX_LIST_REMOVE_RETURN_TYPE_TAG
2248 __remove_return_type
2262 template<
typename _Predicate>
2263 __remove_return_type
2276 _GLIBCXX_LIST_REMOVE_RETURN_TYPE_TAG
2277 __remove_return_type
2292 template<
typename _BinaryPredicate>
2293 __remove_return_type
2296#undef _GLIBCXX_LIST_REMOVE_RETURN_TYPE_TAG
2307#if __cplusplus >= 201103L
2332#if __cplusplus >= 201103L
2333 template<
typename _StrictWeakOrdering>
2337 template<
typename _StrictWeakOrdering>
2339 merge(
list& __x, _StrictWeakOrdering __comp)
2342 template<
typename _StrictWeakOrdering>
2344 merge(
list& __x, _StrictWeakOrdering __comp);
2354 { this->_M_impl._M_node._M_reverse(); }
2371 template<
typename _StrictWeakOrdering>
2382 template<
typename _Integer>
2384 _M_initialize_dispatch(_Integer __n, _Integer __x, __true_type)
2385 { _M_fill_initialize(
static_cast<size_type
>(__n), __x); }
2388 template<
typename _InputIterator>
2390 _M_initialize_dispatch(_InputIterator __first, _InputIterator __last,
2393 bool __notempty = __first != __last;
2394 for (; __first != __last; ++__first)
2395#
if __cplusplus >= 201103L
2396 emplace_back(*__first);
2398 push_back(*__first);
2403 __builtin_unreachable();
2410 _M_fill_initialize(size_type __n,
const value_type& __x)
2416#if __cplusplus >= 201103L
2419 _M_default_initialize(size_type __n)
2427 _M_default_append(size_type __n);
2436 template<
typename _Integer>
2438 _M_assign_dispatch(_Integer __n, _Integer __val, __true_type)
2439 { _M_fill_assign(__n, __val); }
2442 template<
typename _InputIterator>
2444 _M_assign_dispatch(_InputIterator __first, _InputIterator __last,
2450 _M_fill_assign(size_type __n,
const value_type& __val);
2455 _M_transfer(iterator __position, iterator __first, iterator __last)
2456 { __position._M_node->_M_transfer(__first._M_node, __last._M_node); }
2459#if __cplusplus < 201103L
2461 _M_insert(iterator __position,
const value_type& __x)
2463 _Node_ptr __tmp = _M_create_node(__x);
2464 __tmp->_M_hook(__position._M_node);
2465 this->_M_inc_size(1);
2468 template<
typename... _Args>
2470 _M_insert(iterator __position, _Args&&... __args)
2473 __tmp->_M_hook(__position._M_node);
2474 this->_M_inc_size(1);
2480 _M_erase(iterator __position) _GLIBCXX_NOEXCEPT
2482 typedef typename _Node_traits::_Node _Node;
2483 this->_M_dec_size(1);
2484 __position._M_node->_M_unhook();
2485 _Node& __n =
static_cast<_Node&
>(*__position._M_node);
2486 this->_M_destroy_node(__n._M_node_ptr());
2491 _M_check_equal_allocators(
const list& __x) _GLIBCXX_NOEXCEPT
2493 if (_M_get_Node_allocator() != __x._M_get_Node_allocator())
2499 _M_resize_pos(size_type& __new_size)
const;
2501#if __cplusplus >= 201103L && ! _GLIBCXX_INLINE_VERSION
2506 _M_move_assign(list&& __x, true_type)
noexcept
2510 std::__alloc_on_move(this->_M_get_Node_allocator(),
2511 __x._M_get_Node_allocator());
2515 _M_move_assign(list&& __x, false_type)
2517 if (__x._M_get_Node_allocator() == this->_M_get_Node_allocator())
2518 _M_move_assign(
std::move(__x), true_type{});
2522 _M_assign_dispatch(std::make_move_iterator(__x.begin()),
2523 std::make_move_iterator(__x.end()),
2528#if _GLIBCXX_USE_CXX11_ABI
2530 struct _Finalize_merge
2533 _Finalize_merge(list& __dest, list& __src,
const iterator& __src_next)
2534 : _M_dest(__dest), _M_src(__src), _M_next(__src_next)
2542 const size_t __num_unmerged =
std::distance(_M_next, _M_src.end());
2543 const size_t __orig_size = _M_src._M_get_size();
2544 _M_dest._M_inc_size(__orig_size - __num_unmerged);
2545 _M_src._M_set_size(__num_unmerged);
2550 const iterator& _M_next;
2552#if __cplusplus >= 201103L
2553 _Finalize_merge(
const _Finalize_merge&) =
delete;
2557 struct _Finalize_merge
2558 {
explicit _Finalize_merge(list&, list&,
const iterator&) { } };
2561#if !_GLIBCXX_INLINE_VERSION
2568#if _GLIBCXX_USE_CXX11_ABI
2570 _S_distance(const_iterator __first, const_iterator __last)
2574 _M_node_count()
const
2575 {
return this->_M_get_size(); }
2578 _S_distance(const_iterator, const_iterator)
2582 _M_node_count()
const
2588#if __cpp_deduction_guides >= 201606
2589 template<
typename _InputIterator,
typename _ValT
2590 =
typename iterator_traits<_InputIterator>::value_type,
2591 typename _Allocator = allocator<_ValT>,
2592 typename = _RequireInputIter<_InputIterator>,
2593 typename = _RequireAllocator<_Allocator>>
2594 list(_InputIterator, _InputIterator, _Allocator = _Allocator())
2595 -> list<_ValT, _Allocator>;
2597#if __glibcxx_containers_ranges
2598 template<ranges::input_range _Rg,
2599 typename _Allocator = allocator<ranges::range_value_t<_Rg>>>
2600 list(from_range_t, _Rg&&, _Allocator = _Allocator())
2601 -> list<ranges::range_value_t<_Rg>, _Allocator>;
2605_GLIBCXX_END_NAMESPACE_CXX11
2617 template<
typename _Tp,
typename _Alloc>
2622#if _GLIBCXX_USE_CXX11_ABI
2627 typedef typename list<_Tp, _Alloc>::const_iterator const_iterator;
2628 const_iterator __end1 = __x.
end();
2629 const_iterator __end2 = __y.
end();
2631 const_iterator __i1 = __x.
begin();
2632 const_iterator __i2 = __y.
begin();
2633 while (__i1 != __end1 && __i2 != __end2 && *__i1 == *__i2)
2638 return __i1 == __end1 && __i2 == __end2;
2641#if __cpp_lib_three_way_comparison
2653 template<
typename _Tp,
typename _Alloc>
2655 inline __detail::__synth3way_t<_Tp>
2656 operator<=>(
const list<_Tp, _Alloc>& __x,
const list<_Tp, _Alloc>& __y)
2659 __y.begin(), __y.end(),
2660 __detail::__synth3way);
2674 template<
typename _Tp,
typename _Alloc>
2677 operator<(
const list<_Tp, _Alloc>& __x,
const list<_Tp, _Alloc>& __y)
2678 {
return std::lexicographical_compare(__x.begin(), __x.end(),
2679 __y.begin(), __y.end()); }
2682 template<
typename _Tp,
typename _Alloc>
2685 operator!=(
const list<_Tp, _Alloc>& __x,
const list<_Tp, _Alloc>& __y)
2686 {
return !(__x == __y); }
2689 template<
typename _Tp,
typename _Alloc>
2692 operator>(
const list<_Tp, _Alloc>& __x,
const list<_Tp, _Alloc>& __y)
2693 {
return __y < __x; }
2696 template<
typename _Tp,
typename _Alloc>
2699 operator<=(
const list<_Tp, _Alloc>& __x,
const list<_Tp, _Alloc>& __y)
2700 {
return !(__y < __x); }
2703 template<
typename _Tp,
typename _Alloc>
2706 operator>=(
const list<_Tp, _Alloc>& __x,
const list<_Tp, _Alloc>& __y)
2707 {
return !(__x < __y); }
2711 template<
typename _Tp,
typename _Alloc>
2714 _GLIBCXX_NOEXCEPT_IF(
noexcept(__x.swap(__y)))
2717_GLIBCXX_END_NAMESPACE_CONTAINER
2719#if _GLIBCXX_USE_CXX11_ABI
2722 template<
typename _Tp>
2724 __distance(_GLIBCXX_STD_C::_List_iterator<_Tp> __first,
2725 _GLIBCXX_STD_C::_List_iterator<_Tp> __last,
2726 input_iterator_tag __tag)
2728 typedef _GLIBCXX_STD_C::_List_const_iterator<_Tp> _CIter;
2729 return std::__distance(_CIter(__first), _CIter(__last), __tag);
2732 template<
typename _Tp>
2734 __distance(_GLIBCXX_STD_C::_List_const_iterator<_Tp> __first,
2735 _GLIBCXX_STD_C::_List_const_iterator<_Tp> __last,
2738 typedef __detail::_List_node_header _Sentinel;
2739 _GLIBCXX_STD_C::_List_const_iterator<_Tp> __beyond = __last;
2741 const bool __whole = __first == __beyond;
2742 if (__builtin_constant_p (__whole) && __whole)
2743 return static_cast<const _Sentinel*
>(__last._M_node)->_M_size;
2746 while (__first != __last)
2754#if _GLIBCXX_USE_ALLOC_PTR_FOR_LIST
2755 template<
bool _Const,
typename _Ptr>
2757 __distance(__list::_Iterator<_Const, _Ptr> __first,
2758 __list::_Iterator<_Const, _Ptr> __last,
2759 input_iterator_tag __tag)
2761 using _Tp =
typename __list::_Iterator<_Const, _Ptr>::value_type;
2762 using _Sentinel =
typename __list::_Node_traits<_Tp, _Ptr>::_Node_header;
2763 auto __beyond = __last;
2765 const bool __whole = __first == __beyond;
2766 if (__builtin_constant_p (__whole) && __whole)
2767 return static_cast<const _Sentinel&
>(*__last._M_node)._M_size;
2770 while (__first != __last)
2780#if _GLIBCXX_USE_ALLOC_PTR_FOR_LIST
2783 template<
typename _Vo
idPtr>
2785 _Node_base<_VoidPtr>::swap(_Node_base& __x, _Node_base& __y)
noexcept
2787 auto __px = __x._M_base();
2788 auto __py = __x._M_base();
2790 if (__x._M_next != __px)
2792 if (__y._M_next != __py)
2796 swap(__x._M_next,__y._M_next);
2797 swap(__x._M_prev,__y._M_prev);
2798 __x._M_next->_M_prev = __x._M_prev->_M_next = __px;
2799 __y._M_next->_M_prev = __y._M_prev->_M_next = __py;
2804 __y._M_next = __x._M_next;
2805 __y._M_prev = __x._M_prev;
2806 __y._M_next->_M_prev = __y._M_prev->_M_next = __py;
2807 __x._M_next = __x._M_prev = __px;
2810 else if (__y._M_next != __py)
2813 __x._M_next = __y._M_next;
2814 __x._M_prev = __y._M_prev;
2815 __x._M_next->_M_prev = __x._M_prev->_M_next = __px;
2816 __y._M_next = __y._M_prev = __py;
2820 template<
typename _Vo
idPtr>
2822 _Node_base<_VoidPtr>::_M_transfer(_Base_ptr
const __first,
2823 _Base_ptr
const __last)
noexcept
2825 __glibcxx_assert(__first != __last);
2827 auto __self = _M_base();
2828 if (__self != __last)
2831 __last->_M_prev->_M_next = __self;
2832 __first->_M_prev->_M_next = __last;
2833 this->_M_prev->_M_next = __first;
2836 auto const __tmp = this->_M_prev;
2837 this->_M_prev = __last->_M_prev;
2838 __last->_M_prev = __first->_M_prev;
2839 __first->_M_prev = __tmp;
2843 template<
typename _Vo
idPtr>
2845 _Node_header<_VoidPtr>::_M_reverse() noexcept
2847 const auto __self = this->_M_base();
2848 auto __tmp = __self;
2852 swap(__tmp->_M_next, __tmp->_M_prev);
2855 __tmp = __tmp->_M_prev;
2857 while (__tmp != __self);
2862_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 complex< _Tp > operator*(const complex< _Tp > &__x, const complex< _Tp > &__y)
Return new complex value x times y.
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.
_Tp * end(valarray< _Tp > &__va) noexcept
Return an iterator pointing to one past the last element of the valarray.
_Tp * begin(valarray< _Tp > &__va) noexcept
Return an iterator pointing to the first element of the valarray.
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.
typename pointer_traits< _Ptr >::template rebind< _Tp > __ptr_rebind
Convenience alias for rebinding pointers.
constexpr auto empty(const _Container &__cont) noexcept(noexcept(__cont.empty())) -> decltype(__cont.empty())
Return whether a container is empty.
Implementation details not part of the namespace std interface.
is_nothrow_default_constructible
is_trivially_destructible
The ranges::subrange class template.
Bidirectional iterators support a superset of forward iterator operations.
Common part of a node in the list.
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.
void resize(size_type __new_size, const value_type &__x)
Resizes the list to the specified number of elements.
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.
iterator insert(const_iterator __position, size_type __n, const value_type &__x)
Inserts a number of copies of given data into the list.
__remove_return_type unique(_BinaryPredicate)
Remove consecutive elements satisfying a predicate.
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.
void merge(list &&__x, _StrictWeakOrdering __comp)
Merge sorted lists according to comparison function.
__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
_Node_ptr _M_create_node(_Args &&... __args)
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 sort(_StrictWeakOrdering)
Sort the elements according to comparison function.
iterator insert(const_iterator __position, _InputIterator __first, _InputIterator __last)
Inserts a range into the list.
void assign(size_type __n, const value_type &__val)
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
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.
An actual node in the list.
Uniform interface to C++98 and C++11 allocators.
static constexpr pointer allocate(_Node_alloc_type &__a, size_type __n)
static constexpr void deallocate(_Node_alloc_type &__a, pointer __p, size_type __n)
static constexpr size_type max_size(const _Node_alloc_type &__a) noexcept