61 #if __cplusplus >= 201103L 67 namespace std _GLIBCXX_VISIBILITY(default)
69 _GLIBCXX_BEGIN_NAMESPACE_VERSION
93 _M_reverse() _GLIBCXX_USE_NOEXCEPT;
99 _M_unhook() _GLIBCXX_USE_NOEXCEPT;
105 #if _GLIBCXX_USE_CXX11_ABI 112 #if __cplusplus >= 201103L 115 # if _GLIBCXX_USE_CXX11_ABI 116 , _M_size(__x._M_size)
119 if (__x._M_base()->_M_next == __x._M_base())
120 this->_M_next = this->_M_prev =
this;
123 this->_M_next->_M_prev = this->_M_prev->_M_next = this->_M_base();
132 if (__xnode->_M_next == __xnode)
137 __node->_M_next = __xnode->_M_next;
138 __node->_M_prev = __xnode->_M_prev;
139 __node->_M_next->_M_prev = __node->_M_prev->_M_next = __node;
140 # if _GLIBCXX_USE_CXX11_ABI 141 _M_size = __x._M_size;
149 _M_init() _GLIBCXX_NOEXCEPT
151 this->_M_next = this->_M_prev =
this;
152 #if _GLIBCXX_USE_CXX11_ABI 162 _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
165 template<
typename _Tp>
168 #if __cplusplus >= 201103L 169 __gnu_cxx::__aligned_membuf<_Tp> _M_storage;
170 _Tp* _M_valptr() {
return _M_storage._M_ptr(); }
171 _Tp
const* _M_valptr()
const {
return _M_storage._M_ptr(); }
184 template<
typename _Tp>
190 typedef ptrdiff_t difference_type;
192 typedef _Tp value_type;
193 typedef _Tp* pointer;
194 typedef _Tp& reference;
200 _List_iterator(__detail::_List_node_base* __x) _GLIBCXX_NOEXCEPT
204 _M_const_cast() const _GLIBCXX_NOEXCEPT
209 operator*() const _GLIBCXX_NOEXCEPT
210 {
return *static_cast<_Node*>(_M_node)->_M_valptr(); }
213 operator->() const _GLIBCXX_NOEXCEPT
214 {
return static_cast<_Node*>(_M_node)->_M_valptr(); }
217 operator++() _GLIBCXX_NOEXCEPT
219 _M_node = _M_node->_M_next;
224 operator++(
int) _GLIBCXX_NOEXCEPT
227 _M_node = _M_node->_M_next;
232 operator--() _GLIBCXX_NOEXCEPT
234 _M_node = _M_node->_M_prev;
239 operator--(
int) _GLIBCXX_NOEXCEPT
242 _M_node = _M_node->_M_prev;
247 operator==(
const _Self& __x)
const _GLIBCXX_NOEXCEPT
248 {
return _M_node == __x._M_node; }
251 operator!=(
const _Self& __x)
const _GLIBCXX_NOEXCEPT
252 {
return _M_node != __x._M_node; }
255 __detail::_List_node_base* _M_node;
263 template<
typename _Tp>
264 struct _List_const_iterator
266 typedef _List_const_iterator<_Tp> _Self;
267 typedef const _List_node<_Tp> _Node;
268 typedef _List_iterator<_Tp> iterator;
270 typedef ptrdiff_t difference_type;
272 typedef _Tp value_type;
273 typedef const _Tp* pointer;
274 typedef const _Tp& reference;
276 _List_const_iterator() _GLIBCXX_NOEXCEPT
280 _List_const_iterator(
const __detail::_List_node_base* __x)
284 _List_const_iterator(
const iterator& __x) _GLIBCXX_NOEXCEPT
285 : _M_node(__x._M_node) { }
288 _M_const_cast() const _GLIBCXX_NOEXCEPT
289 {
return iterator(const_cast<__detail::_List_node_base*>(_M_node)); }
293 operator*() const _GLIBCXX_NOEXCEPT
294 {
return *static_cast<_Node*>(_M_node)->_M_valptr(); }
297 operator->() const _GLIBCXX_NOEXCEPT
298 {
return static_cast<_Node*>(_M_node)->_M_valptr(); }
301 operator++() _GLIBCXX_NOEXCEPT
303 _M_node = _M_node->_M_next;
308 operator++(
int) _GLIBCXX_NOEXCEPT
311 _M_node = _M_node->_M_next;
316 operator--() _GLIBCXX_NOEXCEPT
318 _M_node = _M_node->_M_prev;
323 operator--(
int) _GLIBCXX_NOEXCEPT
326 _M_node = _M_node->_M_prev;
331 operator==(
const _Self& __x)
const _GLIBCXX_NOEXCEPT
332 {
return _M_node == __x._M_node; }
335 operator!=(
const _Self& __x)
const _GLIBCXX_NOEXCEPT
336 {
return _M_node != __x._M_node; }
339 const __detail::_List_node_base* _M_node;
342 template<
typename _Val>
344 operator==(
const _List_iterator<_Val>& __x,
345 const _List_const_iterator<_Val>& __y) _GLIBCXX_NOEXCEPT
346 {
return __x._M_node == __y._M_node; }
348 template<
typename _Val>
350 operator!=(
const _List_iterator<_Val>& __x,
351 const _List_const_iterator<_Val>& __y) _GLIBCXX_NOEXCEPT
352 {
return __x._M_node != __y._M_node; }
354 _GLIBCXX_BEGIN_NAMESPACE_CXX11
356 template<
typename _Tp,
typename _Alloc>
361 rebind<_Tp>::other _Tp_alloc_type;
363 typedef typename _Tp_alloc_traits::template
364 rebind<_List_node<_Tp> >::other _Node_alloc_type;
367 #if !_GLIBCXX_INLINE_VERSION 373 while (__first != __last)
375 __first = __first->_M_next;
383 :
public _Node_alloc_type
387 _List_impl() _GLIBCXX_NOEXCEPT_IF(
392 _List_impl(
const _Node_alloc_type& __a) _GLIBCXX_NOEXCEPT
393 : _Node_alloc_type(__a)
396 #if __cplusplus >= 201103L 397 _List_impl(_List_impl&&) =
default;
399 _List_impl(_Node_alloc_type&& __a, _List_impl&& __x)
400 : _Node_alloc_type(std::move(__a)), _M_node(std::move(__x._M_node))
403 _List_impl(_Node_alloc_type&& __a) noexcept
404 : _Node_alloc_type(std::move(__a))
411 #if _GLIBCXX_USE_CXX11_ABI 412 size_t _M_get_size()
const {
return _M_impl._M_node._M_size; }
414 void _M_set_size(
size_t __n) { _M_impl._M_node._M_size = __n; }
416 void _M_inc_size(
size_t __n) { _M_impl._M_node._M_size += __n; }
418 void _M_dec_size(
size_t __n) { _M_impl._M_node._M_size -= __n; }
420 # if !_GLIBCXX_INLINE_VERSION 424 {
return _S_distance(__first, __last); }
427 size_t _M_node_count()
const {
return _M_get_size(); }
431 size_t _M_get_size()
const {
return 0; }
432 void _M_set_size(
size_t) { }
433 void _M_inc_size(
size_t) { }
434 void _M_dec_size(
size_t) { }
436 # if !_GLIBCXX_INLINE_VERSION 437 size_t _M_distance(
const void*,
const void*)
const {
return 0; }
440 size_t _M_node_count()
const 442 return _S_distance(_M_impl._M_node._M_next,
448 typename _Node_alloc_traits::pointer
453 _M_put_node(
typename _Node_alloc_traits::pointer __p) _GLIBCXX_NOEXCEPT
457 typedef _Alloc allocator_type;
460 _M_get_Node_allocator() _GLIBCXX_NOEXCEPT
463 const _Node_alloc_type&
464 _M_get_Node_allocator()
const _GLIBCXX_NOEXCEPT
467 #if __cplusplus >= 201103L 473 _List_base(
const _Node_alloc_type& __a) _GLIBCXX_NOEXCEPT
477 #if __cplusplus >= 201103L 480 # if !_GLIBCXX_INLINE_VERSION 482 : _M_impl(std::move(__a))
484 if (__x._M_get_Node_allocator() == _M_get_Node_allocator())
485 _M_move_nodes(std::move(__x));
492 : _M_impl(std::move(__a), std::move(__x._M_impl))
497 : _M_impl(std::move(__a))
502 { _M_impl._M_node._M_move_nodes(std::move(__x._M_impl._M_node)); }
510 _M_clear() _GLIBCXX_NOEXCEPT;
513 _M_init() _GLIBCXX_NOEXCEPT
514 { this->_M_impl._M_node._M_init(); }
563 template<
typename _Tp,
typename _Alloc = std::allocator<_Tp> >
566 #ifdef _GLIBCXX_CONCEPT_CHECKS 568 typedef typename _Alloc::value_type _Alloc_value_type;
569 # if __cplusplus < 201103L 570 __glibcxx_class_requires(_Tp, _SGIAssignableConcept)
572 __glibcxx_class_requires2(_Tp, _Alloc_value_type, _SameTypeConcept)
575 #if __cplusplus >= 201103L 576 static_assert(
is_same<
typename remove_cv<_Tp>::type, _Tp>::value,
577 "std::list must have a non-const, non-volatile value_type");
578 # ifdef __STRICT_ANSI__ 580 "std::list must have the same value_type as its allocator");
585 typedef typename _Base::_Tp_alloc_type _Tp_alloc_type;
587 typedef typename _Base::_Node_alloc_type _Node_alloc_type;
591 typedef _Tp value_type;
592 typedef typename _Tp_alloc_traits::pointer pointer;
593 typedef typename _Tp_alloc_traits::const_pointer const_pointer;
594 typedef typename _Tp_alloc_traits::reference reference;
595 typedef typename _Tp_alloc_traits::const_reference const_reference;
600 typedef size_t size_type;
601 typedef ptrdiff_t difference_type;
602 typedef _Alloc allocator_type;
609 using _Base::_M_impl;
610 using _Base::_M_put_node;
611 using _Base::_M_get_node;
612 using _Base::_M_get_Node_allocator;
620 #if __cplusplus < 201103L 624 _Node* __p = this->_M_get_node();
627 _Tp_alloc_type __alloc(_M_get_Node_allocator());
628 __alloc.construct(__p->_M_valptr(), __x);
633 __throw_exception_again;
638 template<
typename... _Args>
642 auto __p = this->_M_get_node();
643 auto& __alloc = _M_get_Node_allocator();
645 _Node_alloc_traits::construct(__alloc, __p->_M_valptr(),
646 std::forward<_Args>(__args)...);
652 #if _GLIBCXX_USE_CXX11_ABI 654 _S_distance(const_iterator __first, const_iterator __last)
659 _M_node_count()
const 660 {
return this->_M_get_size(); }
664 _S_distance(const_iterator, const_iterator)
669 _M_node_count()
const 680 #if __cplusplus >= 201103L 691 list(
const allocator_type& __a) _GLIBCXX_NOEXCEPT
692 :
_Base(_Node_alloc_type(__a)) { }
694 #if __cplusplus >= 201103L 704 list(size_type __n,
const allocator_type& __a = allocator_type())
705 :
_Base(_Node_alloc_type(__a))
706 { _M_default_initialize(__n); }
716 list(size_type __n,
const value_type& __value,
717 const allocator_type& __a = allocator_type())
718 :
_Base(_Node_alloc_type(__a))
719 { _M_fill_initialize(__n, __value); }
730 list(size_type __n,
const value_type& __value = value_type(),
731 const allocator_type& __a = allocator_type())
732 : _Base(_Node_alloc_type(__a))
733 { _M_fill_initialize(__n, __value); }
745 _S_select_on_copy(__x._M_get_Node_allocator()))
746 { _M_initialize_dispatch(__x.
begin(), __x.
end(), __false_type()); }
748 #if __cplusplus >= 201103L 767 const allocator_type& __a = allocator_type())
768 :
_Base(_Node_alloc_type(__a))
769 { _M_initialize_dispatch(__l.begin(), __l.end(), __false_type()); }
771 list(
const list& __x,
const allocator_type& __a)
772 : _Base(_Node_alloc_type(__a))
773 { _M_initialize_dispatch(__x.
begin(), __x.
end(), __false_type()); }
777 : _Base(_Node_alloc_type(__a), std::move(__x))
781 : _Base(_Node_alloc_type(__a))
783 if (__x._M_get_Node_allocator() == this->_M_get_Node_allocator())
784 this->_M_move_nodes(std::move(__x));
787 std::__make_move_if_noexcept_iterator(__x.
end()));
791 list(
list&& __x,
const allocator_type& __a)
792 noexcept(_Node_alloc_traits::_S_always_equal())
794 typename _Node_alloc_traits::is_always_equal{})
808 #if __cplusplus >= 201103L 809 template<
typename _InputIterator,
810 typename = std::_RequireInputIter<_InputIterator>>
811 list(_InputIterator __first, _InputIterator __last,
812 const allocator_type& __a = allocator_type())
813 :
_Base(_Node_alloc_type(__a))
814 { _M_initialize_dispatch(__first, __last, __false_type()); }
816 template<
typename _InputIterator>
817 list(_InputIterator __first, _InputIterator __last,
818 const allocator_type& __a = allocator_type())
819 : _Base(_Node_alloc_type(__a))
822 typedef typename std::__is_integer<_InputIterator>::__type _Integral;
823 _M_initialize_dispatch(__first, __last, _Integral());
827 #if __cplusplus >= 201103L 849 #if __cplusplus >= 201103L 862 noexcept(_Node_alloc_traits::_S_nothrow_move())
864 constexpr
bool __move_storage =
865 _Node_alloc_traits::_S_propagate_on_move_assign()
866 || _Node_alloc_traits::_S_always_equal();
881 this->
assign(__l.begin(), __l.end());
897 assign(size_type __n,
const value_type& __val)
898 { _M_fill_assign(__n, __val); }
912 #if __cplusplus >= 201103L 913 template<
typename _InputIterator,
914 typename = std::_RequireInputIter<_InputIterator>>
916 assign(_InputIterator __first, _InputIterator __last)
917 { _M_assign_dispatch(__first, __last, __false_type()); }
919 template<
typename _InputIterator>
921 assign(_InputIterator __first, _InputIterator __last)
924 typedef typename std::__is_integer<_InputIterator>::__type _Integral;
925 _M_assign_dispatch(__first, __last, _Integral());
929 #if __cplusplus >= 201103L 939 { this->_M_assign_dispatch(__l.begin(), __l.end(), __false_type()); }
945 {
return allocator_type(_Base::_M_get_Node_allocator()); }
954 {
return iterator(this->_M_impl._M_node._M_next); }
972 {
return iterator(&this->_M_impl._M_node); }
980 end() const _GLIBCXX_NOEXCEPT
997 const_reverse_iterator
1015 const_reverse_iterator
1019 #if __cplusplus >= 201103L 1043 const_reverse_iterator
1052 const_reverse_iterator
1064 {
return this->_M_impl._M_node._M_next == &this->_M_impl._M_node; }
1069 {
return _M_node_count(); }
1076 #if __cplusplus >= 201103L 1087 resize(size_type __new_size);
1100 resize(size_type __new_size,
const value_type& __x);
1113 resize(size_type __new_size, value_type __x = value_type());
1123 {
return *
begin(); }
1131 {
return *
begin(); }
1170 { this->_M_insert(
begin(), __x); }
1172 #if __cplusplus >= 201103L 1175 { this->_M_insert(
begin(), std::move(__x)); }
1177 template<
typename... _Args>
1178 #if __cplusplus > 201402L 1183 emplace_front(_Args&&... __args)
1185 this->_M_insert(
begin(), std::forward<_Args>(__args)...);
1186 #if __cplusplus > 201402L 1206 { this->_M_erase(
begin()); }
1220 { this->_M_insert(
end(), __x); }
1222 #if __cplusplus >= 201103L 1225 { this->_M_insert(
end(), std::move(__x)); }
1227 template<
typename... _Args>
1228 #if __cplusplus > 201402L 1233 emplace_back(_Args&&... __args)
1235 this->_M_insert(
end(), std::forward<_Args>(__args)...);
1236 #if __cplusplus > 201402L 1255 { this->_M_erase(
iterator(this->_M_impl._M_node._M_prev)); }
1257 #if __cplusplus >= 201103L 1270 template<
typename... _Args>
1272 emplace(const_iterator __position, _Args&&... __args);
1286 insert(const_iterator __position,
const value_type& __x);
1303 #if __cplusplus >= 201103L 1317 {
return emplace(__position, std::move(__x)); }
1336 {
return this->
insert(__p, __l.begin(), __l.end()); }
1339 #if __cplusplus >= 201103L 1355 insert(const_iterator __position, size_type __n,
const value_type& __x);
1370 insert(
iterator __position, size_type __n,
const value_type& __x)
1373 splice(__position, __tmp);
1377 #if __cplusplus >= 201103L 1393 template<
typename _InputIterator,
1394 typename = std::_RequireInputIter<_InputIterator>>
1396 insert(const_iterator __position, _InputIterator __first,
1397 _InputIterator __last);
1412 template<
typename _InputIterator>
1414 insert(iterator __position, _InputIterator __first,
1415 _InputIterator __last)
1418 splice(__position, __tmp);
1438 #if __cplusplus >= 201103L 1439 erase(const_iterator __position) noexcept;
1441 erase(iterator __position);
1463 #if __cplusplus >= 201103L 1469 while (__first != __last)
1470 __first =
erase(__first);
1471 return __last._M_const_cast();
1488 __detail::_List_node_base::swap(this->_M_impl._M_node,
1489 __x._M_impl._M_node);
1491 size_t __xsize = __x._M_get_size();
1492 __x._M_set_size(this->_M_get_size());
1493 this->_M_set_size(__xsize);
1495 _Node_alloc_traits::_S_on_swap(this->_M_get_Node_allocator(),
1496 __x._M_get_Node_allocator());
1525 #if __cplusplus >= 201103L 1533 _M_check_equal_allocators(__x);
1535 this->_M_transfer(__position._M_const_cast(),
1538 this->_M_inc_size(__x._M_get_size());
1543 #if __cplusplus >= 201103L 1545 splice(const_iterator __position,
list& __x) noexcept
1546 {
splice(__position, std::move(__x)); }
1549 #if __cplusplus >= 201103L 1576 iterator __j = __i._M_const_cast();
1578 if (__position == __i || __position == __j)
1582 _M_check_equal_allocators(__x);
1584 this->_M_transfer(__position._M_const_cast(),
1585 __i._M_const_cast(), __j);
1587 this->_M_inc_size(1);
1591 #if __cplusplus >= 201103L 1604 {
splice(__position, std::move(__x), __i); }
1607 #if __cplusplus >= 201103L 1642 if (__first != __last)
1645 _M_check_equal_allocators(__x);
1647 size_t __n = _S_distance(__first, __last);
1648 this->_M_inc_size(__n);
1649 __x._M_dec_size(__n);
1651 this->_M_transfer(__position._M_const_cast(),
1652 __first._M_const_cast(),
1653 __last._M_const_cast());
1657 #if __cplusplus >= 201103L 1674 {
splice(__position, std::move(__x), __first, __last); }
1689 remove(
const _Tp& __value);
1702 template<
typename _Predicate>
1731 template<
typename _BinaryPredicate>
1733 unique(_BinaryPredicate);
1744 #if __cplusplus >= 201103L 1750 {
merge(std::move(__x)); }
1769 #if __cplusplus >= 201103L 1770 template<
typename _StrictWeakOrdering>
1772 merge(
list&& __x, _StrictWeakOrdering __comp);
1774 template<
typename _StrictWeakOrdering>
1776 merge(
list& __x, _StrictWeakOrdering __comp)
1777 {
merge(std::move(__x), __comp); }
1779 template<
typename _StrictWeakOrdering>
1781 merge(
list& __x, _StrictWeakOrdering __comp);
1791 { this->_M_impl._M_node._M_reverse(); }
1808 template<
typename _StrictWeakOrdering>
1810 sort(_StrictWeakOrdering);
1819 template<
typename _Integer>
1821 _M_initialize_dispatch(_Integer __n, _Integer __x, __true_type)
1822 { _M_fill_initialize(static_cast<size_type>(__n), __x); }
1825 template<
typename _InputIterator>
1827 _M_initialize_dispatch(_InputIterator __first, _InputIterator __last,
1830 for (; __first != __last; ++__first)
1831 #
if __cplusplus >= 201103L
1832 emplace_back(*__first);
1841 _M_fill_initialize(size_type __n,
const value_type& __x)
1847 #if __cplusplus >= 201103L 1850 _M_default_initialize(size_type __n)
1858 _M_default_append(size_type __n);
1867 template<
typename _Integer>
1869 _M_assign_dispatch(_Integer __n, _Integer __val, __true_type)
1870 { _M_fill_assign(__n, __val); }
1873 template<
typename _InputIterator>
1875 _M_assign_dispatch(_InputIterator __first, _InputIterator __last,
1881 _M_fill_assign(size_type __n,
const value_type& __val);
1886 _M_transfer(iterator __position, iterator __first, iterator __last)
1887 { __position._M_node->_M_transfer(__first._M_node, __last._M_node); }
1890 #if __cplusplus < 201103L 1892 _M_insert(iterator __position,
const value_type& __x)
1895 __tmp->_M_hook(__position._M_node);
1896 this->_M_inc_size(1);
1899 template<
typename... _Args>
1901 _M_insert(iterator __position, _Args&&... __args)
1904 __tmp->_M_hook(__position._M_node);
1905 this->_M_inc_size(1);
1911 _M_erase(iterator __position) _GLIBCXX_NOEXCEPT
1913 this->_M_dec_size(1);
1914 __position._M_node->_M_unhook();
1915 _Node* __n = static_cast<_Node*>(__position._M_node);
1916 #if __cplusplus >= 201103L 1917 _Node_alloc_traits::destroy(_M_get_Node_allocator(), __n->_M_valptr());
1919 _Tp_alloc_type(_M_get_Node_allocator()).destroy(__n->_M_valptr());
1927 _M_check_equal_allocators(
list& __x) _GLIBCXX_NOEXCEPT
1929 if (std::__alloc_neq<typename _Base::_Node_alloc_type>::
1930 _S_do_it(_M_get_Node_allocator(), __x._M_get_Node_allocator()))
1936 _M_resize_pos(size_type& __new_size)
const;
1938 #if __cplusplus >= 201103L 1943 this->_M_move_nodes(std::move(__x));
1944 std::__alloc_on_move(this->_M_get_Node_allocator(),
1945 __x._M_get_Node_allocator());
1951 if (__x._M_get_Node_allocator() == this->_M_get_Node_allocator())
1952 _M_move_assign(std::move(__x),
true_type{});
1956 _M_assign_dispatch(std::__make_move_if_noexcept_iterator(__x.begin()),
1957 std::__make_move_if_noexcept_iterator(__x.end()),
1963 #if __cpp_deduction_guides >= 201606 1964 template<
typename _InputIterator,
typename _ValT
1965 =
typename iterator_traits<_InputIterator>::value_type,
1966 typename _Allocator = allocator<_ValT>,
1967 typename = _RequireInputIter<_InputIterator>,
1968 typename = _RequireAllocator<_Allocator>>
1969 list(_InputIterator, _InputIterator, _Allocator = _Allocator())
1970 -> list<_ValT, _Allocator>;
1973 _GLIBCXX_END_NAMESPACE_CXX11
1985 template<
typename _Tp,
typename _Alloc>
1989 #if _GLIBCXX_USE_CXX11_ABI 1995 const_iterator __end1 = __x.
end();
1996 const_iterator __end2 = __y.
end();
1998 const_iterator __i1 = __x.
begin();
1999 const_iterator __i2 = __y.
begin();
2000 while (__i1 != __end1 && __i2 != __end2 && *__i1 == *__i2)
2005 return __i1 == __end1 && __i2 == __end2;
2019 template<
typename _Tp,
typename _Alloc>
2026 template<
typename _Tp,
typename _Alloc>
2029 {
return !(__x == __y); }
2032 template<
typename _Tp,
typename _Alloc>
2035 {
return __y < __x; }
2038 template<
typename _Tp,
typename _Alloc>
2041 {
return !(__y < __x); }
2044 template<
typename _Tp,
typename _Alloc>
2047 {
return !(__x < __y); }
2050 template<
typename _Tp,
typename _Alloc>
2053 _GLIBCXX_NOEXCEPT_IF(noexcept(__x.swap(__y)))
2056 _GLIBCXX_END_NAMESPACE_CONTAINER
2058 #if _GLIBCXX_USE_CXX11_ABI 2061 template<
typename _Tp>
2063 __distance(_GLIBCXX_STD_C::_List_iterator<_Tp> __first,
2064 _GLIBCXX_STD_C::_List_iterator<_Tp> __last,
2065 input_iterator_tag __tag)
2067 typedef _GLIBCXX_STD_C::_List_const_iterator<_Tp> _CIter;
2068 return std::__distance(_CIter(__first), _CIter(__last), __tag);
2071 template<
typename _Tp>
2073 __distance(_GLIBCXX_STD_C::_List_const_iterator<_Tp> __first,
2074 _GLIBCXX_STD_C::_List_const_iterator<_Tp> __last,
2077 typedef __detail::_List_node_header _Sentinel;
2078 _GLIBCXX_STD_C::_List_const_iterator<_Tp> __beyond = __last;
2080 const bool __whole = __first == __beyond;
2081 if (__builtin_constant_p (__whole) && __whole)
2082 return static_cast<const _Sentinel*>(__last._M_node)->_M_size;
2085 while (__first != __last)
2094 _GLIBCXX_END_NAMESPACE_VERSION
list & operator=(list &&__x) noexcept(_Node_alloc_traits::_S_nothrow_move())
List move assignment operator.
Bidirectional iterators support a superset of forward iterator operations.
void resize(size_type __new_size)
Resizes the list to the specified number of elements.
integral_constant< bool, true > true_type
The type used as a compile-time boolean with true value.
_GLIBCXX17_CONSTEXPR iterator_traits< _InputIterator >::difference_type distance(_InputIterator __first, _InputIterator __last)
A generalization of pointer arithmetic.
void pop_back() noexcept
Removes last element.
reverse_iterator rend() noexcept
Common part of a node in the list.
void reverse() noexcept
Reverse the elements in list.
iterator insert(const_iterator __p, initializer_list< value_type > __l)
Inserts the contents of an initializer_list into list before specified const_iterator.
void splice(const_iterator __position, list &__x, const_iterator __i) noexcept
Insert element from another list.
void splice(const_iterator __position, list &&__x, const_iterator __i) noexcept
Insert element from another list.
iterator erase(const_iterator __position) noexcept
Remove element at given position.
iterator begin() noexcept
void push_front(const value_type &__x)
Add data to the front of the list.
static pointer allocate(_Alloc &__a, size_type __n)
Allocate memory.
bool empty() const noexcept
void splice(const_iterator __position, list &&__x, const_iterator __first, const_iterator __last) noexcept
Insert range from another list.
void remove(const _Tp &__value)
Remove all elements equal to value.
constexpr _Tp * __addressof(_Tp &__r) noexcept
Same as C++11 std::addressof.
list & operator=(const list &__x)
List assignment operator.
list(const list &__x)
List copy constructor.
_Node * _M_create_node(_Args &&... __args)
iterator insert(const_iterator __position, const value_type &__x)
Inserts given value into list before specified iterator.
reference back() noexcept
void splice(const_iterator __position, list &&__x) noexcept
Insert contents of another list.
list(size_type __n, const allocator_type &__a=allocator_type())
Creates a list with default constructed elements.
reference front() noexcept
void unique()
Remove consecutive duplicate elements.
iterator erase(const_iterator __first, const_iterator __last) noexcept
Remove a range of elements.
void remove_if(_Predicate)
Remove all elements satisfying a predicate.
const_iterator cbegin() const noexcept
iterator insert(const_iterator __position, value_type &&__x)
Inserts given rvalue into list before specified iterator.
void merge(list &&__x)
Merge sorted lists.
list(const allocator_type &__a) noexcept
Creates a list with no elements.
const_iterator end() const noexcept
See bits/stl_deque.h's _Deque_base for an explanation.
ISO C++ entities toplevel namespace is std.
reverse_iterator rbegin() noexcept
void sort()
Sort the elements.
const_reference front() const noexcept
const_reverse_iterator crend() 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.
void splice(const_iterator __position, list &__x, const_iterator __first, const_iterator __last) noexcept
Insert range from another list.
void assign(size_type __n, const value_type &__val)
Assigns a given value to a list.
list & operator=(initializer_list< value_type > __l)
List initializer list assignment operator.
Non-standard RAII type for managing pointers obtained from allocators.
static void deallocate(_Alloc &__a, pointer __p, size_type __n)
Deallocate memory.
iterator emplace(const_iterator __position, _Args &&... __args)
Constructs object in list before specified iterator.
const_iterator begin() const noexcept
integral_constant< bool, false > false_type
The type used as a compile-time boolean with false value.
const_reverse_iterator rbegin() const noexcept
list(initializer_list< value_type > __l, const allocator_type &__a=allocator_type())
Builds a list from an initializer_list.
void assign(initializer_list< value_type > __l)
Assigns an initializer_list to a list.
A standard container with linear time access to elements, and fixed time insertion/deletion at any po...
Uniform interface to C++98 and C++11 allocators.
An actual node in the list.
const_reference back() const noexcept
size_type size() const noexcept
list()=default
Creates a list with no elements.
allocator_type get_allocator() const noexcept
Get a copy of the memory allocation object.
const_iterator cend() const noexcept
bool lexicographical_compare(_II1 __first1, _II1 __last1, _II2 __first2, _II2 __last2, _Compare __comp)
Performs dictionary comparison on ranges.
void assign(_InputIterator __first, _InputIterator __last)
Assigns a range to a list.
void pop_front() noexcept
Removes first element.
void push_back(const value_type &__x)
Add data to the end of the list.
list(_InputIterator __first, _InputIterator __last, const allocator_type &__a=allocator_type())
Builds a list from a range.
static size_type max_size(const _Alloc &__a) noexcept
The maximum supported allocation size.
is_nothrow_default_constructible
size_type max_size() const noexcept
void swap(list &__x) noexcept
Swaps data with another list.
const_reverse_iterator rend() const noexcept
const_reverse_iterator crbegin() const noexcept