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 _Self& __y) _GLIBCXX_NOEXCEPT
248 {
return __x._M_node == __y._M_node; }
251 operator!=(
const _Self& __x,
const _Self& __y) _GLIBCXX_NOEXCEPT
252 {
return __x._M_node != __y._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 _Self& __y) _GLIBCXX_NOEXCEPT
332 {
return __x._M_node == __y._M_node; }
335 operator!=(
const _Self& __x,
const _Self& __y) _GLIBCXX_NOEXCEPT
336 {
return __x._M_node != __y._M_node; }
339 const __detail::_List_node_base* _M_node;
342 _GLIBCXX_BEGIN_NAMESPACE_CXX11
344 template<
typename _Tp,
typename _Alloc>
349 rebind<_Tp>::other _Tp_alloc_type;
351 typedef typename _Tp_alloc_traits::template
352 rebind<_List_node<_Tp> >::other _Node_alloc_type;
355 #if !_GLIBCXX_INLINE_VERSION 361 while (__first != __last)
363 __first = __first->_M_next;
371 :
public _Node_alloc_type
375 _List_impl() _GLIBCXX_NOEXCEPT_IF(
380 _List_impl(
const _Node_alloc_type& __a) _GLIBCXX_NOEXCEPT
381 : _Node_alloc_type(__a)
384 #if __cplusplus >= 201103L 385 _List_impl(_List_impl&&) =
default;
387 _List_impl(_Node_alloc_type&& __a, _List_impl&& __x)
388 : _Node_alloc_type(std::move(__a)), _M_node(std::move(__x._M_node))
391 _List_impl(_Node_alloc_type&& __a) noexcept
392 : _Node_alloc_type(std::move(__a))
399 #if _GLIBCXX_USE_CXX11_ABI 400 size_t _M_get_size()
const {
return _M_impl._M_node._M_size; }
402 void _M_set_size(
size_t __n) { _M_impl._M_node._M_size = __n; }
404 void _M_inc_size(
size_t __n) { _M_impl._M_node._M_size += __n; }
406 void _M_dec_size(
size_t __n) { _M_impl._M_node._M_size -= __n; }
408 # if !_GLIBCXX_INLINE_VERSION 412 {
return _S_distance(__first, __last); }
415 size_t _M_node_count()
const {
return _M_get_size(); }
419 size_t _M_get_size()
const {
return 0; }
420 void _M_set_size(
size_t) { }
421 void _M_inc_size(
size_t) { }
422 void _M_dec_size(
size_t) { }
424 # if !_GLIBCXX_INLINE_VERSION 425 size_t _M_distance(
const void*,
const void*)
const {
return 0; }
428 size_t _M_node_count()
const 430 return _S_distance(_M_impl._M_node._M_next,
436 typename _Node_alloc_traits::pointer
441 _M_put_node(
typename _Node_alloc_traits::pointer __p) _GLIBCXX_NOEXCEPT
445 typedef _Alloc allocator_type;
448 _M_get_Node_allocator() _GLIBCXX_NOEXCEPT
451 const _Node_alloc_type&
452 _M_get_Node_allocator()
const _GLIBCXX_NOEXCEPT
455 #if __cplusplus >= 201103L 461 _List_base(
const _Node_alloc_type& __a) _GLIBCXX_NOEXCEPT
465 #if __cplusplus >= 201103L 468 # if !_GLIBCXX_INLINE_VERSION 470 : _M_impl(std::move(__a))
472 if (__x._M_get_Node_allocator() == _M_get_Node_allocator())
473 _M_move_nodes(std::move(__x));
480 : _M_impl(std::move(__a), std::move(__x._M_impl))
485 : _M_impl(std::move(__a))
490 { _M_impl._M_node._M_move_nodes(std::move(__x._M_impl._M_node)); }
498 _M_clear() _GLIBCXX_NOEXCEPT;
501 _M_init() _GLIBCXX_NOEXCEPT
502 { this->_M_impl._M_node._M_init(); }
551 template<
typename _Tp,
typename _Alloc = std::allocator<_Tp> >
554 #ifdef _GLIBCXX_CONCEPT_CHECKS 556 typedef typename _Alloc::value_type _Alloc_value_type;
557 # if __cplusplus < 201103L 558 __glibcxx_class_requires(_Tp, _SGIAssignableConcept)
560 __glibcxx_class_requires2(_Tp, _Alloc_value_type, _SameTypeConcept)
563 #if __cplusplus >= 201103L 564 static_assert(
is_same<
typename remove_cv<_Tp>::type, _Tp>::value,
565 "std::list must have a non-const, non-volatile value_type");
566 # ifdef __STRICT_ANSI__ 568 "std::list must have the same value_type as its allocator");
573 typedef typename _Base::_Tp_alloc_type _Tp_alloc_type;
575 typedef typename _Base::_Node_alloc_type _Node_alloc_type;
579 typedef _Tp value_type;
580 typedef typename _Tp_alloc_traits::pointer pointer;
581 typedef typename _Tp_alloc_traits::const_pointer const_pointer;
582 typedef typename _Tp_alloc_traits::reference reference;
583 typedef typename _Tp_alloc_traits::const_reference const_reference;
588 typedef size_t size_type;
589 typedef ptrdiff_t difference_type;
590 typedef _Alloc allocator_type;
597 using _Base::_M_impl;
598 using _Base::_M_put_node;
599 using _Base::_M_get_node;
600 using _Base::_M_get_Node_allocator;
608 #if __cplusplus < 201103L 612 _Node* __p = this->_M_get_node();
615 _Tp_alloc_type __alloc(_M_get_Node_allocator());
616 __alloc.construct(__p->_M_valptr(), __x);
621 __throw_exception_again;
626 template<
typename... _Args>
630 auto __p = this->_M_get_node();
631 auto& __alloc = _M_get_Node_allocator();
633 _Node_alloc_traits::construct(__alloc, __p->_M_valptr(),
634 std::forward<_Args>(__args)...);
640 #if _GLIBCXX_USE_CXX11_ABI 642 _S_distance(const_iterator __first, const_iterator __last)
647 _M_node_count()
const 648 {
return this->_M_get_size(); }
652 _S_distance(const_iterator, const_iterator)
657 _M_node_count()
const 668 #if __cplusplus >= 201103L 679 list(
const allocator_type& __a) _GLIBCXX_NOEXCEPT
680 :
_Base(_Node_alloc_type(__a)) { }
682 #if __cplusplus >= 201103L 692 list(size_type __n,
const allocator_type& __a = allocator_type())
693 :
_Base(_Node_alloc_type(__a))
694 { _M_default_initialize(__n); }
704 list(size_type __n,
const value_type& __value,
705 const allocator_type& __a = allocator_type())
706 :
_Base(_Node_alloc_type(__a))
707 { _M_fill_initialize(__n, __value); }
718 list(size_type __n,
const value_type& __value = value_type(),
719 const allocator_type& __a = allocator_type())
720 : _Base(_Node_alloc_type(__a))
721 { _M_fill_initialize(__n, __value); }
733 _S_select_on_copy(__x._M_get_Node_allocator()))
734 { _M_initialize_dispatch(__x.
begin(), __x.
end(), __false_type()); }
736 #if __cplusplus >= 201103L 755 const allocator_type& __a = allocator_type())
756 :
_Base(_Node_alloc_type(__a))
757 { _M_initialize_dispatch(__l.begin(), __l.end(), __false_type()); }
759 list(
const list& __x,
const allocator_type& __a)
760 : _Base(_Node_alloc_type(__a))
761 { _M_initialize_dispatch(__x.
begin(), __x.
end(), __false_type()); }
765 : _Base(_Node_alloc_type(__a), std::move(__x))
769 : _Base(_Node_alloc_type(__a))
771 if (__x._M_get_Node_allocator() == this->_M_get_Node_allocator())
772 this->_M_move_nodes(std::move(__x));
775 std::__make_move_if_noexcept_iterator(__x.
end()));
779 list(
list&& __x,
const allocator_type& __a)
780 noexcept(_Node_alloc_traits::_S_always_equal())
782 typename _Node_alloc_traits::is_always_equal{})
796 #if __cplusplus >= 201103L 797 template<
typename _InputIterator,
798 typename = std::_RequireInputIter<_InputIterator>>
799 list(_InputIterator __first, _InputIterator __last,
800 const allocator_type& __a = allocator_type())
801 :
_Base(_Node_alloc_type(__a))
802 { _M_initialize_dispatch(__first, __last, __false_type()); }
804 template<
typename _InputIterator>
805 list(_InputIterator __first, _InputIterator __last,
806 const allocator_type& __a = allocator_type())
807 : _Base(_Node_alloc_type(__a))
810 typedef typename std::__is_integer<_InputIterator>::__type _Integral;
811 _M_initialize_dispatch(__first, __last, _Integral());
815 #if __cplusplus >= 201103L 837 #if __cplusplus >= 201103L 850 noexcept(_Node_alloc_traits::_S_nothrow_move())
852 constexpr
bool __move_storage =
853 _Node_alloc_traits::_S_propagate_on_move_assign()
854 || _Node_alloc_traits::_S_always_equal();
869 this->
assign(__l.begin(), __l.end());
885 assign(size_type __n,
const value_type& __val)
886 { _M_fill_assign(__n, __val); }
900 #if __cplusplus >= 201103L 901 template<
typename _InputIterator,
902 typename = std::_RequireInputIter<_InputIterator>>
904 assign(_InputIterator __first, _InputIterator __last)
905 { _M_assign_dispatch(__first, __last, __false_type()); }
907 template<
typename _InputIterator>
909 assign(_InputIterator __first, _InputIterator __last)
912 typedef typename std::__is_integer<_InputIterator>::__type _Integral;
913 _M_assign_dispatch(__first, __last, _Integral());
917 #if __cplusplus >= 201103L 927 { this->_M_assign_dispatch(__l.begin(), __l.end(), __false_type()); }
933 {
return allocator_type(_Base::_M_get_Node_allocator()); }
942 {
return iterator(this->_M_impl._M_node._M_next); }
960 {
return iterator(&this->_M_impl._M_node); }
968 end() const _GLIBCXX_NOEXCEPT
985 const_reverse_iterator
1003 const_reverse_iterator
1007 #if __cplusplus >= 201103L 1031 const_reverse_iterator
1040 const_reverse_iterator
1050 _GLIBCXX_NODISCARD
bool 1052 {
return this->_M_impl._M_node._M_next == &this->_M_impl._M_node; }
1057 {
return _M_node_count(); }
1064 #if __cplusplus >= 201103L 1075 resize(size_type __new_size);
1088 resize(size_type __new_size,
const value_type& __x);
1101 resize(size_type __new_size, value_type __x = value_type());
1111 {
return *
begin(); }
1119 {
return *
begin(); }
1158 { this->_M_insert(
begin(), __x); }
1160 #if __cplusplus >= 201103L 1163 { this->_M_insert(
begin(), std::move(__x)); }
1165 template<
typename... _Args>
1166 #if __cplusplus > 201402L 1171 emplace_front(_Args&&... __args)
1173 this->_M_insert(
begin(), std::forward<_Args>(__args)...);
1174 #if __cplusplus > 201402L 1194 { this->_M_erase(
begin()); }
1208 { this->_M_insert(
end(), __x); }
1210 #if __cplusplus >= 201103L 1213 { this->_M_insert(
end(), std::move(__x)); }
1215 template<
typename... _Args>
1216 #if __cplusplus > 201402L 1221 emplace_back(_Args&&... __args)
1223 this->_M_insert(
end(), std::forward<_Args>(__args)...);
1224 #if __cplusplus > 201402L 1243 { this->_M_erase(
iterator(this->_M_impl._M_node._M_prev)); }
1245 #if __cplusplus >= 201103L 1258 template<
typename... _Args>
1260 emplace(const_iterator __position, _Args&&... __args);
1274 insert(const_iterator __position,
const value_type& __x);
1291 #if __cplusplus >= 201103L 1305 {
return emplace(__position, std::move(__x)); }
1324 {
return this->
insert(__p, __l.begin(), __l.end()); }
1327 #if __cplusplus >= 201103L 1343 insert(const_iterator __position, size_type __n,
const value_type& __x);
1358 insert(
iterator __position, size_type __n,
const value_type& __x)
1361 splice(__position, __tmp);
1365 #if __cplusplus >= 201103L 1381 template<
typename _InputIterator,
1382 typename = std::_RequireInputIter<_InputIterator>>
1384 insert(const_iterator __position, _InputIterator __first,
1385 _InputIterator __last);
1400 template<
typename _InputIterator>
1402 insert(iterator __position, _InputIterator __first,
1403 _InputIterator __last)
1406 splice(__position, __tmp);
1426 #if __cplusplus >= 201103L 1427 erase(const_iterator __position) noexcept;
1429 erase(iterator __position);
1451 #if __cplusplus >= 201103L 1457 while (__first != __last)
1458 __first =
erase(__first);
1459 return __last._M_const_cast();
1476 __detail::_List_node_base::swap(this->_M_impl._M_node,
1477 __x._M_impl._M_node);
1479 size_t __xsize = __x._M_get_size();
1480 __x._M_set_size(this->_M_get_size());
1481 this->_M_set_size(__xsize);
1483 _Node_alloc_traits::_S_on_swap(this->_M_get_Node_allocator(),
1484 __x._M_get_Node_allocator());
1513 #if __cplusplus >= 201103L 1521 _M_check_equal_allocators(__x);
1523 this->_M_transfer(__position._M_const_cast(),
1526 this->_M_inc_size(__x._M_get_size());
1531 #if __cplusplus >= 201103L 1533 splice(const_iterator __position,
list& __x) noexcept
1534 {
splice(__position, std::move(__x)); }
1537 #if __cplusplus >= 201103L 1564 iterator __j = __i._M_const_cast();
1566 if (__position == __i || __position == __j)
1570 _M_check_equal_allocators(__x);
1572 this->_M_transfer(__position._M_const_cast(),
1573 __i._M_const_cast(), __j);
1575 this->_M_inc_size(1);
1579 #if __cplusplus >= 201103L 1592 {
splice(__position, std::move(__x), __i); }
1595 #if __cplusplus >= 201103L 1630 if (__first != __last)
1633 _M_check_equal_allocators(__x);
1635 size_t __n = _S_distance(__first, __last);
1636 this->_M_inc_size(__n);
1637 __x._M_dec_size(__n);
1639 this->_M_transfer(__position._M_const_cast(),
1640 __first._M_const_cast(),
1641 __last._M_const_cast());
1645 #if __cplusplus >= 201103L 1662 {
splice(__position, std::move(__x), __first, __last); }
1666 #if __cplusplus > 201703L 1667 # define __cpp_lib_list_remove_return_type 201806L 1668 typedef size_type __remove_return_type;
1669 # define _GLIBCXX_LIST_REMOVE_RETURN_TYPE_TAG \ 1670 __attribute__((__abi_tag__("__cxx20"))) 1672 typedef void __remove_return_type;
1673 # define _GLIBCXX_LIST_REMOVE_RETURN_TYPE_TAG 1688 _GLIBCXX_LIST_REMOVE_RETURN_TYPE_TAG
1689 __remove_return_type
1690 remove(
const _Tp& __value);
1703 template<
typename _Predicate>
1704 __remove_return_type
1717 _GLIBCXX_LIST_REMOVE_RETURN_TYPE_TAG
1718 __remove_return_type
1733 template<
typename _BinaryPredicate>
1734 __remove_return_type
1735 unique(_BinaryPredicate);
1737 #undef _GLIBCXX_LIST_REMOVE_RETURN_TYPE_TAG 1748 #if __cplusplus >= 201103L 1754 {
merge(std::move(__x)); }
1773 #if __cplusplus >= 201103L 1774 template<
typename _StrictWeakOrdering>
1776 merge(
list&& __x, _StrictWeakOrdering __comp);
1778 template<
typename _StrictWeakOrdering>
1780 merge(
list& __x, _StrictWeakOrdering __comp)
1781 {
merge(std::move(__x), __comp); }
1783 template<
typename _StrictWeakOrdering>
1785 merge(
list& __x, _StrictWeakOrdering __comp);
1795 { this->_M_impl._M_node._M_reverse(); }
1812 template<
typename _StrictWeakOrdering>
1814 sort(_StrictWeakOrdering);
1823 template<
typename _Integer>
1825 _M_initialize_dispatch(_Integer __n, _Integer __x, __true_type)
1826 { _M_fill_initialize(static_cast<size_type>(__n), __x); }
1829 template<
typename _InputIterator>
1831 _M_initialize_dispatch(_InputIterator __first, _InputIterator __last,
1834 for (; __first != __last; ++__first)
1835 #
if __cplusplus >= 201103L
1836 emplace_back(*__first);
1845 _M_fill_initialize(size_type __n,
const value_type& __x)
1851 #if __cplusplus >= 201103L 1854 _M_default_initialize(size_type __n)
1862 _M_default_append(size_type __n);
1871 template<
typename _Integer>
1873 _M_assign_dispatch(_Integer __n, _Integer __val, __true_type)
1874 { _M_fill_assign(__n, __val); }
1877 template<
typename _InputIterator>
1879 _M_assign_dispatch(_InputIterator __first, _InputIterator __last,
1885 _M_fill_assign(size_type __n,
const value_type& __val);
1890 _M_transfer(iterator __position, iterator __first, iterator __last)
1891 { __position._M_node->_M_transfer(__first._M_node, __last._M_node); }
1894 #if __cplusplus < 201103L 1896 _M_insert(iterator __position,
const value_type& __x)
1899 __tmp->_M_hook(__position._M_node);
1900 this->_M_inc_size(1);
1903 template<
typename... _Args>
1905 _M_insert(iterator __position, _Args&&... __args)
1908 __tmp->_M_hook(__position._M_node);
1909 this->_M_inc_size(1);
1915 _M_erase(iterator __position) _GLIBCXX_NOEXCEPT
1917 this->_M_dec_size(1);
1918 __position._M_node->_M_unhook();
1919 _Node* __n =
static_cast<_Node*
>(__position._M_node);
1920 #if __cplusplus >= 201103L 1921 _Node_alloc_traits::destroy(_M_get_Node_allocator(), __n->_M_valptr());
1923 _Tp_alloc_type(_M_get_Node_allocator()).destroy(__n->_M_valptr());
1931 _M_check_equal_allocators(
list& __x) _GLIBCXX_NOEXCEPT
1933 if (std::__alloc_neq<typename _Base::_Node_alloc_type>::
1934 _S_do_it(_M_get_Node_allocator(), __x._M_get_Node_allocator()))
1940 _M_resize_pos(size_type& __new_size)
const;
1942 #if __cplusplus >= 201103L 1947 this->_M_move_nodes(std::move(__x));
1948 std::__alloc_on_move(this->_M_get_Node_allocator(),
1949 __x._M_get_Node_allocator());
1955 if (__x._M_get_Node_allocator() == this->_M_get_Node_allocator())
1956 _M_move_assign(std::move(__x),
true_type{});
1960 _M_assign_dispatch(std::__make_move_if_noexcept_iterator(__x.begin()),
1961 std::__make_move_if_noexcept_iterator(__x.end()),
1967 #if __cpp_deduction_guides >= 201606 1968 template<
typename _InputIterator,
typename _ValT
1969 =
typename iterator_traits<_InputIterator>::value_type,
1970 typename _Allocator = allocator<_ValT>,
1971 typename = _RequireInputIter<_InputIterator>,
1972 typename = _RequireAllocator<_Allocator>>
1973 list(_InputIterator, _InputIterator, _Allocator = _Allocator())
1974 -> list<_ValT, _Allocator>;
1977 _GLIBCXX_END_NAMESPACE_CXX11
1989 template<
typename _Tp,
typename _Alloc>
1993 #if _GLIBCXX_USE_CXX11_ABI 1999 const_iterator __end1 = __x.
end();
2000 const_iterator __end2 = __y.
end();
2002 const_iterator __i1 = __x.
begin();
2003 const_iterator __i2 = __y.
begin();
2004 while (__i1 != __end1 && __i2 != __end2 && *__i1 == *__i2)
2009 return __i1 == __end1 && __i2 == __end2;
2023 template<
typename _Tp,
typename _Alloc>
2027 __y.begin(), __y.end()); }
2030 template<
typename _Tp,
typename _Alloc>
2033 {
return !(__x == __y); }
2036 template<
typename _Tp,
typename _Alloc>
2039 {
return __y < __x; }
2042 template<
typename _Tp,
typename _Alloc>
2045 {
return !(__y < __x); }
2048 template<
typename _Tp,
typename _Alloc>
2051 {
return !(__x < __y); }
2054 template<
typename _Tp,
typename _Alloc>
2057 _GLIBCXX_NOEXCEPT_IF(noexcept(__x.swap(__y)))
2060 _GLIBCXX_END_NAMESPACE_CONTAINER
2062 #if _GLIBCXX_USE_CXX11_ABI 2065 template<
typename _Tp>
2067 __distance(_GLIBCXX_STD_C::_List_iterator<_Tp> __first,
2068 _GLIBCXX_STD_C::_List_iterator<_Tp> __last,
2069 input_iterator_tag __tag)
2071 typedef _GLIBCXX_STD_C::_List_const_iterator<_Tp> _CIter;
2072 return std::__distance(_CIter(__first), _CIter(__last), __tag);
2075 template<
typename _Tp>
2077 __distance(_GLIBCXX_STD_C::_List_const_iterator<_Tp> __first,
2078 _GLIBCXX_STD_C::_List_const_iterator<_Tp> __last,
2081 typedef __detail::_List_node_header _Sentinel;
2082 _GLIBCXX_STD_C::_List_const_iterator<_Tp> __beyond = __last;
2084 const bool __whole = __first == __beyond;
2085 if (__builtin_constant_p (__whole) && __whole)
2086 return static_cast<const _Sentinel*
>(__last._M_node)->_M_size;
2089 while (__first != __last)
2098 _GLIBCXX_END_NAMESPACE_VERSION
allocator_type get_allocator() const noexcept
Get a copy of the memory allocation object.
const_iterator cend() const noexcept
void push_front(const value_type &__x)
Add data to the front of the list.
static _GLIBCXX_NODISCARD pointer allocate(_Alloc &__a, size_type __n)
Allocate memory.
integral_constant< bool, false > false_type
The type used as a compile-time boolean with false value.
iterator emplace(const_iterator __position, _Args &&... __args)
Constructs object in list before specified iterator.
void pop_front() noexcept
Removes first element.
A standard container with linear time access to elements, and fixed time insertion/deletion at any po...
void reverse() noexcept
Reverse the elements in list.
An actual node in the list.
ISO C++ entities toplevel namespace is std.
iterator insert(const_iterator __position, const value_type &__x)
Inserts given value into list before specified iterator.
void pop_back() noexcept
Removes last element.
const_reverse_iterator rbegin() const noexcept
reverse_iterator rend() noexcept
list & operator=(list &&__x) noexcept(_Node_alloc_traits::_S_nothrow_move())
List move assignment operator.
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.
integral_constant< bool, true > true_type
The type used as a compile-time boolean with true value.
iterator erase(const_iterator __position) noexcept
Remove element at given position.
iterator begin() noexcept
static void deallocate(_Alloc &__a, pointer __p, size_type __n)
Deallocate memory.
void push_back(const value_type &__x)
Add data to the end of the list.
const_iterator end() const noexcept
bool lexicographical_compare(_II1 __first1, _II1 __last1, _II2 __first2, _II2 __last2, _Compare __comp)
Performs dictionary comparison on ranges.
const_reference back() const noexcept
_Node * _M_create_node(_Args &&... __args)
size_type max_size() const 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.
const_iterator cbegin() const noexcept
void swap(list &__x) noexcept
Swaps data with another list.
const_reverse_iterator rend() 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.
is_nothrow_default_constructible
Non-standard RAII type for managing pointers obtained from allocators.
void splice(const_iterator __position, list &&__x, const_iterator __first, const_iterator __last) noexcept
Insert range from another list.
list(const list &__x)
List copy constructor.
__remove_return_type unique()
Remove consecutive duplicate elements.
list(const allocator_type &__a) noexcept
Creates a list with no elements.
reference back() noexcept
iterator erase(const_iterator __first, const_iterator __last) noexcept
Remove a range of elements.
list & operator=(initializer_list< value_type > __l)
List initializer list assignment operator.
static size_type max_size(const _Alloc &__a) noexcept
The maximum supported allocation size.
iterator insert(const_iterator __position, value_type &&__x)
Inserts given rvalue into list before specified iterator.
Uniform interface to C++98 and C++11 allocators.
reverse_iterator rbegin() noexcept
const_reference front() const noexcept
_GLIBCXX_NODISCARD bool empty() const noexcept
void sort()
Sort the elements.
__remove_return_type remove_if(_Predicate)
Remove all elements satisfying a predicate.
const_reverse_iterator crbegin() const noexcept
constexpr _Tp * __addressof(_Tp &__r) noexcept
Same as C++11 std::addressof.
reference front() noexcept
void assign(_InputIterator __first, _InputIterator __last)
Assigns a range to a list.
void assign(initializer_list< value_type > __l)
Assigns an initializer_list to a list.
const_iterator begin() const noexcept
void assign(size_type __n, const value_type &__val)
Assigns a given value to a list.
size_type size() const noexcept
list & operator=(const list &__x)
List assignment operator.
void resize(size_type __new_size)
Resizes the list to the specified number of elements.
_GLIBCXX17_CONSTEXPR iterator_traits< _InputIterator >::difference_type distance(_InputIterator __first, _InputIterator __last)
A generalization of pointer arithmetic.
void merge(list &&__x)
Merge sorted lists.
Bidirectional iterators support a superset of forward iterator operations.
list(_InputIterator __first, _InputIterator __last, const allocator_type &__a=allocator_type())
Builds a list from a range.
void splice(const_iterator __position, list &&__x, const_iterator __i) noexcept
Insert element from another list.
list()=default
Creates a list with no elements.
list(initializer_list< value_type > __l, const allocator_type &__a=allocator_type())
Builds a list from an initializer_list.
See bits/stl_deque.h's _Deque_base for an explanation.
const_reverse_iterator crend() const noexcept
Common part of a node in the list.