59namespace std _GLIBCXX_VISIBILITY(default)
61_GLIBCXX_BEGIN_NAMESPACE_VERSION
62_GLIBCXX_BEGIN_NAMESPACE_CONTAINER
64 template<
typename _Tp,
typename _Alloc>
66 _List_base<_Tp, _Alloc>::
67 _M_clear() _GLIBCXX_NOEXCEPT
69 typedef typename _Node_traits::_Node _Node;
70 typedef typename _Node_traits::_Node_base _Node_base;
71 typename _Node_base::_Base_ptr __cur = _M_impl._M_node._M_next;
72 while (__cur != _M_impl._M_node._M_base())
74 _Node& __tmp =
static_cast<_Node&
>(*__cur);
75 __cur = __tmp._M_next;
76 this->_M_destroy_node(__tmp._M_node_ptr());
80#if __cplusplus >= 201103L
81 template<
typename _Tp,
typename _Alloc>
82 template<
typename... _Args>
83 typename list<_Tp, _Alloc>::iterator
90 return iterator(
__tmp->_M_base());
94 template<
typename _Tp,
typename _Alloc>
95 typename list<_Tp, _Alloc>::iterator
97#if __cplusplus >= 201103L
98 insert(const_iterator
__position,
const value_type& __x)
100 insert(iterator
__position,
const value_type& __x)
103 _Node_ptr
__tmp = _M_create_node(__x);
105 this->_M_inc_size(1);
106 return iterator(
__tmp->_M_base());
109#if __cplusplus >= 201103L
110 template<
typename _Tp,
typename _Alloc>
111 typename list<_Tp, _Alloc>::iterator
125 template<
typename _Tp,
typename _Alloc>
126 template<
typename _InputIterator,
typename>
127 typename list<_Tp, _Alloc>::iterator
132 list __tmp(__first, __last, get_allocator());
143 template<
typename _Tp,
typename _Alloc>
144 typename list<_Tp, _Alloc>::iterator
146#if __cplusplus >= 201103L
168 template<
typename _Tp,
typename _Alloc>
169 typename list<_Tp, _Alloc>::const_iterator
174#if _GLIBCXX_USE_CXX11_ABI
186 ptrdiff_t __num_erase = __len - __new_size;
196 for (__i =
begin(); __i !=
end() && __len < __new_size; ++__i, ++__len)
203#if __cplusplus >= 201103L
204 template<
typename _Tp,
typename _Alloc>
207 _M_default_append(size_type __n)
212 for (; __i < __n; ++__i)
219 __throw_exception_again;
223 template<
typename _Tp,
typename _Alloc>
228 const_iterator __i = _M_resize_pos(
__new_size);
235 template<
typename _Tp,
typename _Alloc>
240 const_iterator __i = _M_resize_pos(
__new_size);
247 template<
typename _Tp,
typename _Alloc>
252 const_iterator __i = _M_resize_pos(
__new_size);
256 erase(__i._M_const_cast(),
end());
260 template<
typename _Tp,
typename _Alloc>
267#if __cplusplus >= 201103L
268 if (_Node_alloc_traits::_S_propagate_on_copy_assign())
272 if (!_Node_alloc_traits::_S_always_equal()
281 _M_assign_dispatch(__x.
begin(), __x.
end(), __false_type());
286 template<
typename _Tp,
typename _Alloc>
292 for (; __i !=
end() && __n > 0; ++__i, --__n)
295 insert(
end(), __n, __val);
300 template<
typename _Tp,
typename _Alloc>
301 template <
typename _InputIterator>
304 _M_assign_dispatch(_InputIterator __first2, _InputIterator __last2,
307 iterator __first1 =
begin();
308 iterator __last1 =
end();
309 for (; __first1 != __last1 && __first2 != __last2;
310 ++__first1, (void)++__first2)
311 *__first1 = *__first2;
312 if (__first2 == __last2)
313 erase(__first1, __last1);
315 insert(__last1, __first2, __last2);
318#if __cplusplus > 201703L
319# define _GLIBCXX20_ONLY(__expr) __expr
321# define _GLIBCXX20_ONLY(__expr)
324 template<
typename _Tp,
typename _Alloc>
325 typename list<_Tp, _Alloc>::__remove_return_type
327 remove(
const value_type& __value)
329#if !_GLIBCXX_USE_CXX11_ABI
333 iterator __first =
begin();
334 iterator __last =
end();
335 while (__first != __last)
337 iterator __next = __first;
339 if (*__first == __value)
345#if !_GLIBCXX_USE_CXX11_ABI
353#if !_GLIBCXX_USE_CXX11_ABI
360 template<
typename _Tp,
typename _Alloc>
361 typename list<_Tp, _Alloc>::__remove_return_type
365 iterator __first =
begin();
366 iterator __last =
end();
367 if (__first == __last)
368 return _GLIBCXX20_ONLY( 0 );
369#if !_GLIBCXX_USE_CXX11_ABI
373 iterator __next = __first;
374 while (++__next != __last)
376 if (*__first == *__next)
379#if !_GLIBCXX_USE_CXX11_ABI
388#if !_GLIBCXX_USE_CXX11_ABI
395 template<
typename _Tp,
typename _Alloc>
398#if __cplusplus >= 201103L
408 _M_check_equal_allocators(__x);
434 template<
typename _Tp,
typename _Alloc>
435 template <
typename _StrictWeakOrdering>
438#if __cplusplus >= 201103L
448 _M_check_equal_allocators(__x);
474 template<
typename _Tp,
typename _Alloc>
484 typedef __list::_Scratch_list<typename _Node_traits::_Node_base>
496 _Scratch_list
__tmp[64];
497 _Scratch_list* __fill =
__tmp;
524 __fill[-1].swap(this->_M_impl._M_node);
530 for (
int __i = 0; __i <
sizeof(
__tmp)/
sizeof(
__tmp[0]); ++__i)
531 __tmp[__i]._M_put_all(
end()._M_node);
532 __throw_exception_again;
537 template<
typename _Tp,
typename _Alloc>
538 template <
typename _Predicate>
539 typename list<_Tp, _Alloc>::__remove_return_type
543#if !_GLIBCXX_USE_CXX11_ABI
547 iterator __first =
begin();
548 iterator __last =
end();
549 while (__first != __last)
551 iterator __next = __first;
556#if !_GLIBCXX_USE_CXX11_ABI
563#if !_GLIBCXX_USE_CXX11_ABI
570 template<
typename _Tp,
typename _Alloc>
571 template <
typename _BinaryPredicate>
572 typename list<_Tp, _Alloc>::__remove_return_type
576 iterator __first =
begin();
577 iterator __last =
end();
578 if (__first == __last)
579 return _GLIBCXX20_ONLY(0);
580#if !_GLIBCXX_USE_CXX11_ABI
584 iterator __next = __first;
585 while (++__next != __last)
590#if !_GLIBCXX_USE_CXX11_ABI
599#if !_GLIBCXX_USE_CXX11_ABI
606#undef _GLIBCXX20_ONLY
608 template<
typename _Tp,
typename _Alloc>
609 template <
typename _StrictWeakOrdering>
619 typedef __list::_Scratch_list<typename _Node_traits::_Node_base>
623 _Scratch_list
__tmp[64];
624 _Scratch_list* __fill =
__tmp;
627 typename _Scratch_list::
653 __fill[-1].swap(this->_M_impl._M_node);
659 for (
size_t __i = 0; __i <
sizeof(
__tmp)/
sizeof(
__tmp[0]); ++__i)
660 __tmp[__i]._M_put_all(
end()._M_node);
661 __throw_exception_again;
666_GLIBCXX_END_NAMESPACE_CONTAINER
667_GLIBCXX_END_NAMESPACE_VERSION
constexpr _Tp * __addressof(_Tp &__r) noexcept
Same as C++11 std::addressof.
_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.
ISO C++ entities toplevel namespace is std.
constexpr auto empty(const _Container &__cont) noexcept(noexcept(__cont.empty())) -> decltype(__cont.empty())
Return whether a container is empty.
constexpr auto size(const _Container &__cont) noexcept(noexcept(__cont.size())) -> decltype(__cont.size())
Return the size of a container.
constexpr void advance(_InputIterator &__i, _Distance __n)
A generalization of pointer arithmetic.
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 sort()
Sort the elements.
iterator begin() noexcept
iterator emplace(const_iterator __position, _Args &&... __args)
Constructs object in list before specified iterator.
list & operator=(const list &__x)
List assignment operator.
__remove_return_type unique()
Remove consecutive duplicate elements.
__remove_return_type remove(const _Tp &__value)
Remove all elements equal to value.
__remove_return_type remove_if(_Predicate)
Remove all elements satisfying a predicate.