60 namespace std _GLIBCXX_VISIBILITY(default)
62 _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
64 template<
typename _Tp,
typename _Alloc>
66 _List_base<_Tp, _Alloc>::
69 typedef _List_node<_Tp> _Node;
70 _Node* __cur =
static_cast<_Node*
>(_M_impl._M_node._M_next);
71 while (__cur != &_M_impl._M_node)
74 __cur =
static_cast<_Node*
>(__cur->_M_next);
75 #ifdef __GXX_EXPERIMENTAL_CXX0X__
76 _M_get_Node_allocator().destroy(__tmp);
84 #ifdef __GXX_EXPERIMENTAL_CXX0X__
85 template<
typename _Tp,
typename _Alloc>
86 template<
typename... _Args>
87 typename list<_Tp, _Alloc>::iterator
89 emplace(iterator __position, _Args&&... __args)
91 _Node* __tmp = _M_create_node(std::forward<_Args>(__args)...);
92 __tmp->_M_hook(__position._M_node);
93 return iterator(__tmp);
97 template<
typename _Tp,
typename _Alloc>
98 typename list<_Tp, _Alloc>::iterator
102 _Node* __tmp = _M_create_node(__x);
103 __tmp->_M_hook(__position._M_node);
107 template<
typename _Tp,
typename _Alloc>
113 _M_erase(__position);
117 #ifdef __GXX_EXPERIMENTAL_CXX0X__
118 template<
typename _Tp,
typename _Alloc>
126 for (; __i < __n; ++__i)
133 __throw_exception_again;
137 template<
typename _Tp,
typename _Alloc>
144 for (; __i !=
end() && __len < __new_size; ++__i, ++__len)
146 if (__len == __new_size)
149 _M_default_append(__new_size - __len);
152 template<
typename _Tp,
typename _Alloc>
155 resize(size_type __new_size,
const value_type& __x)
159 for (; __i !=
end() && __len < __new_size; ++__i, ++__len)
161 if (__len == __new_size)
164 insert(
end(), __new_size - __len, __x);
167 template<
typename _Tp,
typename _Alloc>
170 resize(size_type __new_size, value_type __x)
174 for (; __i !=
end() && __len < __new_size; ++__i, ++__len)
176 if (__len == __new_size)
179 insert(
end(), __new_size - __len, __x);
183 template<
typename _Tp,
typename _Alloc>
194 for (; __first1 != __last1 && __first2 != __last2;
195 ++__first1, ++__first2)
196 *__first1 = *__first2;
197 if (__first2 == __last2)
198 erase(__first1, __last1);
200 insert(__last1, __first2, __last2);
205 template<
typename _Tp,
typename _Alloc>
211 for (; __i !=
end() && __n > 0; ++__i, --__n)
214 insert(
end(), __n, __val);
219 template<
typename _Tp,
typename _Alloc>
220 template <
typename _InputIterator>
223 _M_assign_dispatch(_InputIterator __first2, _InputIterator __last2,
226 iterator __first1 =
begin();
227 iterator __last1 =
end();
228 for (; __first1 != __last1 && __first2 != __last2;
229 ++__first1, ++__first2)
230 *__first1 = *__first2;
231 if (__first2 == __last2)
232 erase(__first1, __last1);
234 insert(__last1, __first2, __last2);
237 template<
typename _Tp,
typename _Alloc>
245 while (__first != __last)
249 if (*__first == __value)
261 if (__extra != __last)
265 template<
typename _Tp,
typename _Alloc>
272 if (__first == __last)
275 while (++__next != __last)
277 if (*__first == *__next)
285 template<
typename _Tp,
typename _Alloc>
288 #ifdef __GXX_EXPERIMENTAL_CXX0X__
298 _M_check_equal_allocators(__x);
304 while (__first1 != __last1 && __first2 != __last2)
305 if (*__first2 < *__first1)
308 _M_transfer(__first1, __first2, ++__next);
313 if (__first2 != __last2)
314 _M_transfer(__last1, __first2, __last2);
318 template<
typename _Tp,
typename _Alloc>
319 template <
typename _StrictWeakOrdering>
322 #ifdef __GXX_EXPERIMENTAL_CXX0X__
323 merge(
list&& __x, _StrictWeakOrdering __comp)
325 merge(
list& __x, _StrictWeakOrdering __comp)
332 _M_check_equal_allocators(__x);
338 while (__first1 != __last1 && __first2 != __last2)
339 if (__comp(*__first2, *__first1))
342 _M_transfer(__first1, __first2, ++__next);
347 if (__first2 != __last2)
348 _M_transfer(__last1, __first2, __last2);
352 template<
typename _Tp,
typename _Alloc>
358 if (this->_M_impl._M_node._M_next != &this->_M_impl._M_node
359 && this->_M_impl._M_node._M_next->_M_next != &this->_M_impl._M_node)
363 list * __fill = &__tmp[0];
370 for(__counter = &__tmp[0];
371 __counter != __fill && !__counter->
empty();
374 __counter->
merge(__carry);
375 __carry.
swap(*__counter);
377 __carry.
swap(*__counter);
378 if (__counter == __fill)
383 for (__counter = &__tmp[1]; __counter != __fill; ++__counter)
384 __counter->
merge(*(__counter - 1));
385 swap( *(__fill - 1) );
389 template<
typename _Tp,
typename _Alloc>
390 template <
typename _Predicate>
397 while (__first != __last)
401 if (__pred(*__first))
407 template<
typename _Tp,
typename _Alloc>
408 template <
typename _BinaryPredicate>
415 if (__first == __last)
418 while (++__next != __last)
420 if (__binary_pred(*__first, *__next))
428 template<
typename _Tp,
typename _Alloc>
429 template <
typename _StrictWeakOrdering>
432 sort(_StrictWeakOrdering __comp)
435 if (this->_M_impl._M_node._M_next != &this->_M_impl._M_node
436 && this->_M_impl._M_node._M_next->_M_next != &this->_M_impl._M_node)
440 list * __fill = &__tmp[0];
447 for(__counter = &__tmp[0];
448 __counter != __fill && !__counter->
empty();
451 __counter->
merge(__carry, __comp);
452 __carry.
swap(*__counter);
454 __carry.
swap(*__counter);
455 if (__counter == __fill)
460 for (__counter = &__tmp[1]; __counter != __fill; ++__counter)
461 __counter->
merge(*(__counter - 1), __comp);
466 _GLIBCXX_END_NAMESPACE_CONTAINER
void remove_if(_Predicate)
Remove all elements satisfying a predicate.
bool empty() const _GLIBCXX_NOEXCEPT
iterator insert(iterator __position, const value_type &__x)
Inserts given value into list before specified iterator.
iterator emplace(iterator __position, _Args &&...__args)
Constructs object in list before specified iterator.
void swap(list &__x)
Swaps data with another list.
constexpr const _Tp * end(initializer_list< _Tp > __ils) noexcept
Return an iterator pointing to one past the last element of the initilizer_list.
void splice(iterator __position, list &&__x)
Insert contents of another list.
void sort()
Sort the elements.
iterator begin() _GLIBCXX_NOEXCEPT
list & operator=(const list &__x)
List assignment operator.
iterator erase(iterator __position)
Remove element at given position.
void unique()
Remove consecutive duplicate elements.
A standard container with linear time access to elements, and fixed time insertion/deletion at any po...
_Tp * __addressof(_Tp &__r) _GLIBCXX_NOEXCEPT
Same as C++11 std::addressof.
iterator end() _GLIBCXX_NOEXCEPT
void merge(list &&__x)
Merge sorted lists.
void remove(const _Tp &__value)
Remove all elements equal to value.
void resize(size_type __new_size)
Resizes the list to the specified number of elements.
constexpr const _Tp * begin(initializer_list< _Tp > __ils) noexcept
Return an iterator pointing to the first element of the initilizer_list.