59 namespace std _GLIBCXX_VISIBILITY(default)
61 _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
63 template<
typename _Tp,
typename _Alloc>
65 _List_base<_Tp, _Alloc>::
66 _M_clear() _GLIBCXX_NOEXCEPT
68 typedef _List_node<_Tp> _Node;
69 __detail::_List_node_base* __cur = _M_impl._M_node._M_next;
70 while (__cur != &_M_impl._M_node)
72 _Node* __tmp =
static_cast<_Node*
>(__cur);
73 __cur = __tmp->_M_next;
74 #if __cplusplus >= 201103L 75 _M_get_Node_allocator().destroy(__tmp);
83 #if __cplusplus >= 201103L 84 template<
typename _Tp,
typename _Alloc>
85 template<
typename... _Args>
86 typename list<_Tp, _Alloc>::iterator
90 _Node* __tmp = _M_create_node(std::forward<_Args>(__args)...);
91 __tmp->_M_hook(__position._M_const_cast()._M_node);
97 template<
typename _Tp,
typename _Alloc>
100 #if __cplusplus >= 201103L 103 insert(
iterator __position,
const value_type& __x)
106 _Node* __tmp = _M_create_node(__x);
107 __tmp->_M_hook(__position._M_const_cast()._M_node);
108 this->_M_inc_size(1);
112 #if __cplusplus >= 201103L 113 template<
typename _Tp,
typename _Alloc>
120 list __tmp(__n, __x, get_allocator());
122 splice(__position, __tmp);
125 return __position._M_const_cast();
128 template<
typename _Tp,
typename _Alloc>
129 template<
typename _InputIterator,
typename>
133 _InputIterator __last)
135 list __tmp(__first, __last, get_allocator());
139 splice(__position, __tmp);
142 return __position._M_const_cast();
146 template<
typename _Tp,
typename _Alloc>
149 #if __cplusplus >= 201103L 156 _M_erase(__position._M_const_cast());
160 #if __cplusplus >= 201103L 161 template<
typename _Tp,
typename _Alloc>
169 for (; __i < __n; ++__i)
176 __throw_exception_again;
180 template<
typename _Tp,
typename _Alloc>
187 for (; __i !=
end() && __len < __new_size; ++__i, ++__len)
189 if (__len == __new_size)
192 _M_default_append(__new_size - __len);
195 template<
typename _Tp,
typename _Alloc>
198 resize(size_type __new_size,
const value_type& __x)
202 for (; __i !=
end() && __len < __new_size; ++__i, ++__len)
204 if (__len == __new_size)
207 insert(
end(), __new_size - __len, __x);
210 template<
typename _Tp,
typename _Alloc>
213 resize(size_type __new_size, value_type __x)
217 for (; __i !=
end() && __len < __new_size; ++__i, ++__len)
219 if (__len == __new_size)
222 insert(
end(), __new_size - __len, __x);
226 template<
typename _Tp,
typename _Alloc>
237 for (; __first1 != __last1 && __first2 != __last2;
238 ++__first1, ++__first2)
239 *__first1 = *__first2;
240 if (__first2 == __last2)
241 erase(__first1, __last1);
243 insert(__last1, __first2, __last2);
248 template<
typename _Tp,
typename _Alloc>
254 for (; __i !=
end() && __n > 0; ++__i, --__n)
257 insert(
end(), __n, __val);
262 template<
typename _Tp,
typename _Alloc>
263 template <
typename _InputIterator>
271 for (; __first1 != __last1 && __first2 != __last2;
272 ++__first1, ++__first2)
273 *__first1 = *__first2;
274 if (__first2 == __last2)
275 erase(__first1, __last1);
277 insert(__last1, __first2, __last2);
280 template<
typename _Tp,
typename _Alloc>
288 while (__first != __last)
292 if (*__first == __value)
304 if (__extra != __last)
308 template<
typename _Tp,
typename _Alloc>
315 if (__first == __last)
318 while (++__next != __last)
320 if (*__first == *__next)
328 template<
typename _Tp,
typename _Alloc>
331 #if __cplusplus >= 201103L 341 _M_check_equal_allocators(__x);
347 while (__first1 != __last1 && __first2 != __last2)
348 if (*__first2 < *__first1)
351 _M_transfer(__first1, __first2, ++__next);
356 if (__first2 != __last2)
357 _M_transfer(__last1, __first2, __last2);
359 this->_M_inc_size(__x._M_get_size());
364 template<
typename _Tp,
typename _Alloc>
365 template <
typename _StrictWeakOrdering>
368 #if __cplusplus >= 201103L 369 merge(
list&& __x, _StrictWeakOrdering __comp)
371 merge(
list& __x, _StrictWeakOrdering __comp)
378 _M_check_equal_allocators(__x);
384 while (__first1 != __last1 && __first2 != __last2)
385 if (__comp(*__first2, *__first1))
388 _M_transfer(__first1, __first2, ++__next);
393 if (__first2 != __last2)
394 _M_transfer(__last1, __first2, __last2);
396 this->_M_inc_size(__x._M_get_size());
401 template<
typename _Tp,
typename _Alloc>
407 if (this->_M_impl._M_node._M_next != &this->_M_impl._M_node
408 && this->_M_impl._M_node._M_next->_M_next != &this->_M_impl._M_node)
412 list * __fill = &__tmp[0];
419 for(__counter = &__tmp[0];
420 __counter != __fill && !__counter->
empty();
423 __counter->
merge(__carry);
424 __carry.
swap(*__counter);
426 __carry.
swap(*__counter);
427 if (__counter == __fill)
432 for (__counter = &__tmp[1]; __counter != __fill; ++__counter)
433 __counter->
merge(*(__counter - 1));
434 swap( *(__fill - 1) );
438 template<
typename _Tp,
typename _Alloc>
439 template <
typename _Predicate>
446 while (__first != __last)
450 if (__pred(*__first))
456 template<
typename _Tp,
typename _Alloc>
457 template <
typename _BinaryPredicate>
464 if (__first == __last)
467 while (++__next != __last)
469 if (__binary_pred(*__first, *__next))
477 template<
typename _Tp,
typename _Alloc>
478 template <
typename _StrictWeakOrdering>
481 sort(_StrictWeakOrdering __comp)
484 if (this->_M_impl._M_node._M_next != &this->_M_impl._M_node
485 && this->_M_impl._M_node._M_next->_M_next != &this->_M_impl._M_node)
489 list * __fill = &__tmp[0];
496 for(__counter = &__tmp[0];
497 __counter != __fill && !__counter->
empty();
500 __counter->
merge(__carry, __comp);
501 __carry.
swap(*__counter);
503 __carry.
swap(*__counter);
504 if (__counter == __fill)
509 for (__counter = &__tmp[1]; __counter != __fill; ++__counter)
510 __counter->
merge(*(__counter - 1), __comp);
515 _GLIBCXX_END_NAMESPACE_CONTAINER
_Tp * __addressof(_Tp &__r) noexcept
Same as C++11 std::addressof.
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 remove(const _Tp &__value)
Remove all elements equal to value.
void swap(list &__x)
Swaps data with another list.
constexpr const _Tp * begin(initializer_list< _Tp > __ils) noexcept
Return an iterator pointing to the first element of the initializer_list.
void unique()
Remove consecutive duplicate elements.
void splice(const_iterator __position, list &&__x) noexcept
Insert contents of another list.
bool empty() const noexcept
void merge(list &&__x)
Merge sorted lists.
iterator emplace(const_iterator __position, _Args &&...__args)
Constructs object in list before specified iterator.
void sort()
Sort the elements.
iterator begin() noexcept
void remove_if(_Predicate)
Remove all elements satisfying a predicate.
list & operator=(const list &__x)
List assignment operator.
ISO C++ entities toplevel namespace is std.
constexpr const _Tp * end(initializer_list< _Tp > __ils) noexcept
Return an iterator pointing to one past the last element of the initializer_list. ...
A standard container with linear time access to elements, and fixed time insertion/deletion at any po...