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( noexcept(_Node_alloc_type()) )
391 _List_impl(
const _Node_alloc_type& __a) _GLIBCXX_NOEXCEPT
392 : _Node_alloc_type(__a)
395 #if __cplusplus >= 201103L 396 _List_impl(_List_impl&&) =
default;
398 _List_impl(_Node_alloc_type&& __a, _List_impl&& __x)
399 : _Node_alloc_type(std::move(__a)), _M_node(std::move(__x._M_node))
402 _List_impl(_Node_alloc_type&& __a) noexcept
403 : _Node_alloc_type(std::move(__a))
410 #if _GLIBCXX_USE_CXX11_ABI 411 size_t _M_get_size()
const {
return _M_impl._M_node._M_size; }
413 void _M_set_size(
size_t __n) { _M_impl._M_node._M_size = __n; }
415 void _M_inc_size(
size_t __n) { _M_impl._M_node._M_size += __n; }
417 void _M_dec_size(
size_t __n) { _M_impl._M_node._M_size -= __n; }
419 # if !_GLIBCXX_INLINE_VERSION 423 {
return _S_distance(__first, __last); }
426 size_t _M_node_count()
const {
return _M_get_size(); }
430 size_t _M_get_size()
const {
return 0; }
431 void _M_set_size(
size_t) { }
432 void _M_inc_size(
size_t) { }
433 void _M_dec_size(
size_t) { }
435 # if !_GLIBCXX_INLINE_VERSION 436 size_t _M_distance(
const void*,
const void*)
const {
return 0; }
439 size_t _M_node_count()
const 441 return _S_distance(_M_impl._M_node._M_next,
447 typename _Node_alloc_traits::pointer
452 _M_put_node(
typename _Node_alloc_traits::pointer __p) _GLIBCXX_NOEXCEPT
456 typedef _Alloc allocator_type;
459 _M_get_Node_allocator() _GLIBCXX_NOEXCEPT
462 const _Node_alloc_type&
463 _M_get_Node_allocator()
const _GLIBCXX_NOEXCEPT
466 #if __cplusplus >= 201103L 472 _List_base(
const _Node_alloc_type& __a) _GLIBCXX_NOEXCEPT
476 #if __cplusplus >= 201103L 479 # if !_GLIBCXX_INLINE_VERSION 481 : _M_impl(std::move(__a))
483 if (__x._M_get_Node_allocator() == _M_get_Node_allocator())
484 _M_move_nodes(std::move(__x));
491 : _M_impl(std::move(__a), std::move(__x._M_impl))
496 : _M_impl(std::move(__a))
501 { _M_impl._M_node._M_move_nodes(std::move(__x._M_impl._M_node)); }
509 _M_clear() _GLIBCXX_NOEXCEPT;
512 _M_init() _GLIBCXX_NOEXCEPT
513 { this->_M_impl._M_node._M_init(); }
562 template<
typename _Tp,
typename _Alloc = std::allocator<_Tp> >
565 #ifdef _GLIBCXX_CONCEPT_CHECKS 567 typedef typename _Alloc::value_type _Alloc_value_type;
568 # if __cplusplus < 201103L 569 __glibcxx_class_requires(_Tp, _SGIAssignableConcept)
571 __glibcxx_class_requires2(_Tp, _Alloc_value_type, _SameTypeConcept)
574 #if __cplusplus >= 201103L 575 static_assert(
is_same<
typename remove_cv<_Tp>::type, _Tp>::value,
576 "std::list must have a non-const, non-volatile value_type");
577 # ifdef __STRICT_ANSI__ 579 "std::list must have the same value_type as its allocator");
584 typedef typename _Base::_Tp_alloc_type _Tp_alloc_type;
586 typedef typename _Base::_Node_alloc_type _Node_alloc_type;
590 typedef _Tp value_type;
591 typedef typename _Tp_alloc_traits::pointer pointer;
592 typedef typename _Tp_alloc_traits::const_pointer const_pointer;
593 typedef typename _Tp_alloc_traits::reference reference;
594 typedef typename _Tp_alloc_traits::const_reference const_reference;
599 typedef size_t size_type;
600 typedef ptrdiff_t difference_type;
601 typedef _Alloc allocator_type;
608 using _Base::_M_impl;
609 using _Base::_M_put_node;
610 using _Base::_M_get_node;
611 using _Base::_M_get_Node_allocator;
619 #if __cplusplus < 201103L 623 _Node* __p = this->_M_get_node();
626 _Tp_alloc_type __alloc(_M_get_Node_allocator());
627 __alloc.construct(__p->_M_valptr(), __x);
632 __throw_exception_again;
637 template<
typename... _Args>
641 auto __p = this->_M_get_node();
642 auto& __alloc = _M_get_Node_allocator();
644 _Node_alloc_traits::construct(__alloc, __p->_M_valptr(),
645 std::forward<_Args>(__args)...);
651 #if _GLIBCXX_USE_CXX11_ABI 653 _S_distance(const_iterator __first, const_iterator __last)
658 _M_node_count()
const 659 {
return this->_M_get_size(); }
663 _S_distance(const_iterator, const_iterator)
668 _M_node_count()
const 679 #if __cplusplus >= 201103L 690 list(
const allocator_type& __a) _GLIBCXX_NOEXCEPT
691 :
_Base(_Node_alloc_type(__a)) { }
693 #if __cplusplus >= 201103L 703 list(size_type __n,
const allocator_type& __a = allocator_type())
704 :
_Base(_Node_alloc_type(__a))
705 { _M_default_initialize(__n); }
715 list(size_type __n,
const value_type& __value,
716 const allocator_type& __a = allocator_type())
717 :
_Base(_Node_alloc_type(__a))
718 { _M_fill_initialize(__n, __value); }
729 list(size_type __n,
const value_type& __value = value_type(),
730 const allocator_type& __a = allocator_type())
731 : _Base(_Node_alloc_type(__a))
732 { _M_fill_initialize(__n, __value); }
744 _S_select_on_copy(__x._M_get_Node_allocator()))
745 { _M_initialize_dispatch(__x.
begin(), __x.
end(), __false_type()); }
747 #if __cplusplus >= 201103L 766 const allocator_type& __a = allocator_type())
767 :
_Base(_Node_alloc_type(__a))
768 { _M_initialize_dispatch(__l.begin(), __l.end(), __false_type()); }
770 list(
const list& __x,
const allocator_type& __a)
771 : _Base(_Node_alloc_type(__a))
772 { _M_initialize_dispatch(__x.
begin(), __x.
end(), __false_type()); }
776 : _Base(_Node_alloc_type(__a), std::move(__x))
780 : _Base(_Node_alloc_type(__a))
782 if (__x._M_get_Node_allocator() == this->_M_get_Node_allocator())
783 this->_M_move_nodes(std::move(__x));
786 std::__make_move_if_noexcept_iterator(__x.
end()));
790 list(
list&& __x,
const allocator_type& __a)
791 noexcept(_Node_alloc_traits::_S_always_equal())
793 typename _Node_alloc_traits::is_always_equal{})
807 #if __cplusplus >= 201103L 808 template<
typename _InputIterator,
809 typename = std::_RequireInputIter<_InputIterator>>
810 list(_InputIterator __first, _InputIterator __last,
811 const allocator_type& __a = allocator_type())
812 :
_Base(_Node_alloc_type(__a))
813 { _M_initialize_dispatch(__first, __last, __false_type()); }
815 template<
typename _InputIterator>
816 list(_InputIterator __first, _InputIterator __last,
817 const allocator_type& __a = allocator_type())
818 : _Base(_Node_alloc_type(__a))
821 typedef typename std::__is_integer<_InputIterator>::__type _Integral;
822 _M_initialize_dispatch(__first, __last, _Integral());
826 #if __cplusplus >= 201103L 848 #if __cplusplus >= 201103L 861 noexcept(_Node_alloc_traits::_S_nothrow_move())
863 constexpr
bool __move_storage =
864 _Node_alloc_traits::_S_propagate_on_move_assign()
865 || _Node_alloc_traits::_S_always_equal();
880 this->
assign(__l.begin(), __l.end());
896 assign(size_type __n,
const value_type& __val)
897 { _M_fill_assign(__n, __val); }
911 #if __cplusplus >= 201103L 912 template<
typename _InputIterator,
913 typename = std::_RequireInputIter<_InputIterator>>
915 assign(_InputIterator __first, _InputIterator __last)
916 { _M_assign_dispatch(__first, __last, __false_type()); }
918 template<
typename _InputIterator>
920 assign(_InputIterator __first, _InputIterator __last)
923 typedef typename std::__is_integer<_InputIterator>::__type _Integral;
924 _M_assign_dispatch(__first, __last, _Integral());
928 #if __cplusplus >= 201103L 938 { this->_M_assign_dispatch(__l.begin(), __l.end(), __false_type()); }
944 {
return allocator_type(_Base::_M_get_Node_allocator()); }
953 {
return iterator(this->_M_impl._M_node._M_next); }
971 {
return iterator(&this->_M_impl._M_node); }
979 end() const _GLIBCXX_NOEXCEPT
996 const_reverse_iterator
1014 const_reverse_iterator
1018 #if __cplusplus >= 201103L 1042 const_reverse_iterator
1051 const_reverse_iterator
1063 {
return this->_M_impl._M_node._M_next == &this->_M_impl._M_node; }
1068 {
return _M_node_count(); }
1075 #if __cplusplus >= 201103L 1086 resize(size_type __new_size);
1099 resize(size_type __new_size,
const value_type& __x);
1112 resize(size_type __new_size, value_type __x = value_type());
1122 {
return *
begin(); }
1130 {
return *
begin(); }
1169 { this->_M_insert(
begin(), __x); }
1171 #if __cplusplus >= 201103L 1174 { this->_M_insert(
begin(), std::move(__x)); }
1176 template<
typename... _Args>
1177 #if __cplusplus > 201402L 1182 emplace_front(_Args&&... __args)
1184 this->_M_insert(
begin(), std::forward<_Args>(__args)...);
1185 #if __cplusplus > 201402L 1205 { this->_M_erase(
begin()); }
1219 { this->_M_insert(
end(), __x); }
1221 #if __cplusplus >= 201103L 1224 { this->_M_insert(
end(), std::move(__x)); }
1226 template<
typename... _Args>
1227 #if __cplusplus > 201402L 1232 emplace_back(_Args&&... __args)
1234 this->_M_insert(
end(), std::forward<_Args>(__args)...);
1235 #if __cplusplus > 201402L 1254 { this->_M_erase(
iterator(this->_M_impl._M_node._M_prev)); }
1256 #if __cplusplus >= 201103L 1269 template<
typename... _Args>
1271 emplace(const_iterator __position, _Args&&... __args);
1285 insert(const_iterator __position,
const value_type& __x);
1302 #if __cplusplus >= 201103L 1316 {
return emplace(__position, std::move(__x)); }
1335 {
return this->
insert(__p, __l.begin(), __l.end()); }
1338 #if __cplusplus >= 201103L 1354 insert(const_iterator __position, size_type __n,
const value_type& __x);
1369 insert(
iterator __position, size_type __n,
const value_type& __x)
1372 splice(__position, __tmp);
1376 #if __cplusplus >= 201103L 1392 template<
typename _InputIterator,
1393 typename = std::_RequireInputIter<_InputIterator>>
1395 insert(const_iterator __position, _InputIterator __first,
1396 _InputIterator __last);
1411 template<
typename _InputIterator>
1413 insert(iterator __position, _InputIterator __first,
1414 _InputIterator __last)
1417 splice(__position, __tmp);
1437 #if __cplusplus >= 201103L 1438 erase(const_iterator __position) noexcept;
1440 erase(iterator __position);
1462 #if __cplusplus >= 201103L 1468 while (__first != __last)
1469 __first =
erase(__first);
1470 return __last._M_const_cast();
1487 __detail::_List_node_base::swap(this->_M_impl._M_node,
1488 __x._M_impl._M_node);
1490 size_t __xsize = __x._M_get_size();
1491 __x._M_set_size(this->_M_get_size());
1492 this->_M_set_size(__xsize);
1494 _Node_alloc_traits::_S_on_swap(this->_M_get_Node_allocator(),
1495 __x._M_get_Node_allocator());
1524 #if __cplusplus >= 201103L 1532 _M_check_equal_allocators(__x);
1534 this->_M_transfer(__position._M_const_cast(),
1537 this->_M_inc_size(__x._M_get_size());
1542 #if __cplusplus >= 201103L 1544 splice(const_iterator __position,
list& __x) noexcept
1545 {
splice(__position, std::move(__x)); }
1548 #if __cplusplus >= 201103L 1575 iterator __j = __i._M_const_cast();
1577 if (__position == __i || __position == __j)
1581 _M_check_equal_allocators(__x);
1583 this->_M_transfer(__position._M_const_cast(),
1584 __i._M_const_cast(), __j);
1586 this->_M_inc_size(1);
1590 #if __cplusplus >= 201103L 1603 {
splice(__position, std::move(__x), __i); }
1606 #if __cplusplus >= 201103L 1641 if (__first != __last)
1644 _M_check_equal_allocators(__x);
1646 size_t __n = _S_distance(__first, __last);
1647 this->_M_inc_size(__n);
1648 __x._M_dec_size(__n);
1650 this->_M_transfer(__position._M_const_cast(),
1651 __first._M_const_cast(),
1652 __last._M_const_cast());
1656 #if __cplusplus >= 201103L 1673 {
splice(__position, std::move(__x), __first, __last); }
1688 remove(
const _Tp& __value);
1701 template<
typename _Predicate>
1730 template<
typename _BinaryPredicate>
1732 unique(_BinaryPredicate);
1743 #if __cplusplus >= 201103L 1749 {
merge(std::move(__x)); }
1768 #if __cplusplus >= 201103L 1769 template<
typename _StrictWeakOrdering>
1771 merge(
list&& __x, _StrictWeakOrdering __comp);
1773 template<
typename _StrictWeakOrdering>
1775 merge(
list& __x, _StrictWeakOrdering __comp)
1776 {
merge(std::move(__x), __comp); }
1778 template<
typename _StrictWeakOrdering>
1780 merge(
list& __x, _StrictWeakOrdering __comp);
1790 { this->_M_impl._M_node._M_reverse(); }
1807 template<
typename _StrictWeakOrdering>
1809 sort(_StrictWeakOrdering);
1818 template<
typename _Integer>
1820 _M_initialize_dispatch(_Integer __n, _Integer __x, __true_type)
1821 { _M_fill_initialize(static_cast<size_type>(__n), __x); }
1824 template<
typename _InputIterator>
1826 _M_initialize_dispatch(_InputIterator __first, _InputIterator __last,
1829 for (; __first != __last; ++__first)
1830 #
if __cplusplus >= 201103L
1831 emplace_back(*__first);
1840 _M_fill_initialize(size_type __n,
const value_type& __x)
1846 #if __cplusplus >= 201103L 1849 _M_default_initialize(size_type __n)
1857 _M_default_append(size_type __n);
1866 template<
typename _Integer>
1868 _M_assign_dispatch(_Integer __n, _Integer __val, __true_type)
1869 { _M_fill_assign(__n, __val); }
1872 template<
typename _InputIterator>
1874 _M_assign_dispatch(_InputIterator __first, _InputIterator __last,
1880 _M_fill_assign(size_type __n,
const value_type& __val);
1885 _M_transfer(iterator __position, iterator __first, iterator __last)
1886 { __position._M_node->_M_transfer(__first._M_node, __last._M_node); }
1889 #if __cplusplus < 201103L 1891 _M_insert(iterator __position,
const value_type& __x)
1894 __tmp->_M_hook(__position._M_node);
1895 this->_M_inc_size(1);
1898 template<
typename... _Args>
1900 _M_insert(iterator __position, _Args&&... __args)
1903 __tmp->_M_hook(__position._M_node);
1904 this->_M_inc_size(1);
1910 _M_erase(iterator __position) _GLIBCXX_NOEXCEPT
1912 this->_M_dec_size(1);
1913 __position._M_node->_M_unhook();
1914 _Node* __n =
static_cast<_Node*
>(__position._M_node);
1915 #if __cplusplus >= 201103L 1916 _Node_alloc_traits::destroy(_M_get_Node_allocator(), __n->_M_valptr());
1918 _Tp_alloc_type(_M_get_Node_allocator()).destroy(__n->_M_valptr());
1926 _M_check_equal_allocators(
list& __x) _GLIBCXX_NOEXCEPT
1928 if (std::__alloc_neq<typename _Base::_Node_alloc_type>::
1929 _S_do_it(_M_get_Node_allocator(), __x._M_get_Node_allocator()))
1935 _M_resize_pos(size_type& __new_size)
const;
1937 #if __cplusplus >= 201103L 1942 this->_M_move_nodes(std::move(__x));
1943 std::__alloc_on_move(this->_M_get_Node_allocator(),
1944 __x._M_get_Node_allocator());
1950 if (__x._M_get_Node_allocator() == this->_M_get_Node_allocator())
1951 _M_move_assign(std::move(__x),
true_type{});
1955 _M_assign_dispatch(std::__make_move_if_noexcept_iterator(__x.begin()),
1956 std::__make_move_if_noexcept_iterator(__x.end()),
1962 #if __cpp_deduction_guides >= 201606 1963 template<
typename _InputIterator,
typename _ValT
1964 =
typename iterator_traits<_InputIterator>::value_type,
1965 typename _Allocator = allocator<_ValT>,
1966 typename = _RequireInputIter<_InputIterator>,
1967 typename = _RequireAllocator<_Allocator>>
1968 list(_InputIterator, _InputIterator, _Allocator = _Allocator())
1969 -> list<_ValT, _Allocator>;
1972 _GLIBCXX_END_NAMESPACE_CXX11
1984 template<
typename _Tp,
typename _Alloc>
1988 #if _GLIBCXX_USE_CXX11_ABI 1994 const_iterator __end1 = __x.
end();
1995 const_iterator __end2 = __y.
end();
1997 const_iterator __i1 = __x.
begin();
1998 const_iterator __i2 = __y.
begin();
1999 while (__i1 != __end1 && __i2 != __end2 && *__i1 == *__i2)
2004 return __i1 == __end1 && __i2 == __end2;
2018 template<
typename _Tp,
typename _Alloc>
2022 __y.begin(), __y.end()); }
2025 template<
typename _Tp,
typename _Alloc>
2028 {
return !(__x == __y); }
2031 template<
typename _Tp,
typename _Alloc>
2034 {
return __y < __x; }
2037 template<
typename _Tp,
typename _Alloc>
2040 {
return !(__y < __x); }
2043 template<
typename _Tp,
typename _Alloc>
2046 {
return !(__x < __y); }
2049 template<
typename _Tp,
typename _Alloc>
2052 _GLIBCXX_NOEXCEPT_IF(noexcept(__x.swap(__y)))
2055 _GLIBCXX_END_NAMESPACE_CONTAINER
2057 #if _GLIBCXX_USE_CXX11_ABI 2060 template<
typename _Tp>
2062 __distance(_GLIBCXX_STD_C::_List_iterator<_Tp> __first,
2063 _GLIBCXX_STD_C::_List_iterator<_Tp> __last,
2064 input_iterator_tag __tag)
2066 typedef _GLIBCXX_STD_C::_List_const_iterator<_Tp> _CIter;
2067 return std::__distance(_CIter(__first), _CIter(__last), __tag);
2070 template<
typename _Tp>
2072 __distance(_GLIBCXX_STD_C::_List_const_iterator<_Tp> __first,
2073 _GLIBCXX_STD_C::_List_const_iterator<_Tp> __last,
2076 typedef __detail::_List_node_header _Sentinel;
2077 _GLIBCXX_STD_C::_List_const_iterator<_Tp> __beyond = __last;
2079 const bool __whole = __first == __beyond;
2080 if (__builtin_constant_p (__whole) && __whole)
2081 return static_cast<const _Sentinel*
>(__last._M_node)->_M_size;
2084 while (__first != __last)
2093 _GLIBCXX_END_NAMESPACE_VERSION
reverse_iterator rbegin() noexcept
const_reference front() const noexcept
const_reverse_iterator rbegin() const noexcept
void pop_back() noexcept
Removes last element.
size_type max_size() 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 push_front(const value_type &__x)
Add data to the front of the list.
void assign(size_type __n, const value_type &__val)
Assigns a given value to a 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.
list()=default
Creates a list with no elements.
allocator_type get_allocator() const noexcept
Get a copy of the memory allocation object.
iterator emplace(const_iterator __position, _Args &&... __args)
Constructs object in list before specified iterator.
list(const list &__x)
List copy constructor.
_Node * _M_create_node(_Args &&... __args)
integral_constant< bool, false > false_type
The type used as a compile-time boolean with false value.
void splice(const_iterator __position, list &&__x, const_iterator __i) noexcept
Insert element from another list.
A standard container with linear time access to elements, and fixed time insertion/deletion at any po...
static size_type max_size(const _Alloc &__a) noexcept
The maximum supported allocation size.
list & operator=(initializer_list< value_type > __l)
List initializer list assignment operator.
An actual node in the list.
list & operator=(const list &__x)
List assignment operator.
iterator begin() noexcept
iterator insert(const_iterator __position, const value_type &__x)
Inserts given value into list before specified iterator.
bool empty() const 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.
constexpr _Tp * __addressof(_Tp &__r) noexcept
Same as C++11 std::addressof.
static pointer allocate(_Alloc &__a, size_type __n)
Allocate memory.
void remove_if(_Predicate)
Remove all elements satisfying a predicate.
void reverse() noexcept
Reverse the elements in list.
reference front() noexcept
const_reference back() const noexcept
iterator insert(const_iterator __position, value_type &&__x)
Inserts given rvalue into list before specified iterator.
const_reverse_iterator crbegin() const noexcept
integral_constant< bool, true > true_type
The type used as a compile-time boolean with true value.
void splice(const_iterator __position, list &__x, const_iterator __first, const_iterator __last) noexcept
Insert range from another list.
void push_back(const value_type &__x)
Add data to the end of the list.
ISO C++ entities toplevel namespace is std.
void resize(size_type __new_size)
Resizes the list to the specified number of elements.
Uniform interface to C++98 and C++11 allocators.
Bidirectional iterators support a superset of forward iterator operations.
const_iterator begin() const noexcept
const_iterator end() const noexcept
_GLIBCXX17_CONSTEXPR iterator_traits< _InputIterator >::difference_type distance(_InputIterator __first, _InputIterator __last)
A generalization of pointer arithmetic.
Non-standard RAII type for managing pointers obtained from allocators.
size_type size() const noexcept
Common part of a node in the list.
const_reverse_iterator crend() const noexcept
list(initializer_list< value_type > __l, const allocator_type &__a=allocator_type())
Builds a list from an initializer_list.
bool lexicographical_compare(_II1 __first1, _II1 __last1, _II2 __first2, _II2 __last2, _Compare __comp)
Performs dictionary comparison on ranges.
iterator erase(const_iterator __position) noexcept
Remove element at given position.
list & operator=(list &&__x) noexcept(_Node_alloc_traits::_S_nothrow_move())
List move assignment operator.
See bits/stl_deque.h's _Deque_base for an explanation.
void splice(const_iterator __position, list &&__x, const_iterator __first, const_iterator __last) noexcept
Insert range from another list.
const_iterator cend() const noexcept
void merge(list &&__x)
Merge sorted lists.
list(const allocator_type &__a) noexcept
Creates a list with no elements.
void assign(_InputIterator __first, _InputIterator __last)
Assigns a range to a list.
reverse_iterator rend() noexcept
list(size_type __n, const allocator_type &__a=allocator_type())
Creates a list with default constructed elements.
void sort()
Sort the elements.
static void deallocate(_Alloc &__a, pointer __p, size_type __n)
Deallocate memory.
void unique()
Remove consecutive duplicate elements.
iterator erase(const_iterator __first, const_iterator __last) noexcept
Remove a range of elements.
void assign(initializer_list< value_type > __l)
Assigns an initializer_list to a list.
void swap(list &__x) noexcept
Swaps data with another list.
const_reverse_iterator rend() const noexcept
const_iterator cbegin() const noexcept
reference back() noexcept
void splice(const_iterator __position, list &&__x) noexcept
Insert contents of another list.