60 _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
62 template<typename _Tp, typename _Alloc>
64 _List_base<_Tp, _Alloc>::
67 typedef _List_node<_Tp> _Node;
68 _Node* __cur =
static_cast<_Node*
>(this->_M_impl._M_node._M_next);
69 while (__cur != &this->_M_impl._M_node)
72 __cur =
static_cast<_Node*
>(__cur->_M_next);
73 #ifdef __GXX_EXPERIMENTAL_CXX0X__
74 _M_get_Node_allocator().destroy(__tmp);
76 _M_get_Tp_allocator().destroy(&__tmp->_M_data);
82 #ifdef __GXX_EXPERIMENTAL_CXX0X__
83 template<
typename _Tp,
typename _Alloc>
84 template<
typename... _Args>
85 typename list<_Tp, _Alloc>::iterator
87 emplace(iterator __position, _Args&&... __args)
89 _Node* __tmp = _M_create_node(std::forward<_Args>(__args)...);
90 __tmp->hook(__position._M_node);
91 return iterator(__tmp);
95 template<
typename _Tp,
typename _Alloc>
96 typename list<_Tp, _Alloc>::iterator
98 insert(
iterator __position,
const value_type& __x)
100 _Node* __tmp = _M_create_node(__x);
101 __tmp->hook(__position._M_node);
105 template<
typename _Tp,
typename _Alloc>
111 _M_erase(__position);
115 template<
typename _Tp,
typename _Alloc>
118 resize(size_type __new_size, value_type __x)
122 for (; __i != end() && __len < __new_size; ++__i, ++__len)
124 if (__len == __new_size)
127 insert(end(), __new_size - __len, __x);
130 template<
typename _Tp,
typename _Alloc>
141 for (; __first1 != __last1 && __first2 != __last2;
142 ++__first1, ++__first2)
143 *__first1 = *__first2;
144 if (__first2 == __last2)
145 erase(__first1, __last1);
147 insert(__last1, __first2, __last2);
152 template<
typename _Tp,
typename _Alloc>
158 for (; __i != end() && __n > 0; ++__i, --__n)
161 insert(end(), __n, __val);
166 template<
typename _Tp,
typename _Alloc>
167 template <
typename _InputIterator>
170 _M_assign_dispatch(_InputIterator __first2, _InputIterator __last2,
173 iterator __first1 = begin();
174 iterator __last1 = end();
175 for (; __first1 != __last1 && __first2 != __last2;
176 ++__first1, ++__first2)
177 *__first1 = *__first2;
178 if (__first2 == __last2)
179 erase(__first1, __last1);
181 insert(__last1, __first2, __last2);
184 template<
typename _Tp,
typename _Alloc>
187 remove(
const value_type& __value)
192 while (__first != __last)
196 if (*__first == __value)
201 if (&*__first != &__value)
208 if (__extra != __last)
212 template<
typename _Tp,
typename _Alloc>
219 if (__first == __last)
222 while (++__next != __last)
224 if (*__first == *__next)
232 template<
typename _Tp,
typename _Alloc>
235 #ifdef __GXX_EXPERIMENTAL_CXX0X__
245 _M_check_equal_allocators(__x);
251 while (__first1 != __last1 && __first2 != __last2)
252 if (*__first2 < *__first1)
255 _M_transfer(__first1, __first2, ++__next);
260 if (__first2 != __last2)
261 _M_transfer(__last1, __first2, __last2);
265 template<
typename _Tp,
typename _Alloc>
266 template <
typename _StrictWeakOrdering>
269 #ifdef __GXX_EXPERIMENTAL_CXX0X__
270 merge(
list&& __x, _StrictWeakOrdering __comp)
272 merge(
list& __x, _StrictWeakOrdering __comp)
279 _M_check_equal_allocators(__x);
285 while (__first1 != __last1 && __first2 != __last2)
286 if (__comp(*__first2, *__first1))
289 _M_transfer(__first1, __first2, ++__next);
294 if (__first2 != __last2)
295 _M_transfer(__last1, __first2, __last2);
299 template<
typename _Tp,
typename _Alloc>
305 if (this->_M_impl._M_node._M_next != &this->_M_impl._M_node
306 && this->_M_impl._M_node._M_next->_M_next != &this->_M_impl._M_node)
310 list * __fill = &__tmp[0];
317 for(__counter = &__tmp[0];
318 __counter != __fill && !__counter->
empty();
321 __counter->
merge(__carry);
322 __carry.
swap(*__counter);
324 __carry.
swap(*__counter);
325 if (__counter == __fill)
330 for (__counter = &__tmp[1]; __counter != __fill; ++__counter)
331 __counter->
merge(*(__counter - 1));
332 swap( *(__fill - 1) );
336 template<
typename _Tp,
typename _Alloc>
337 template <
typename _Predicate>
344 while (__first != __last)
348 if (__pred(*__first))
354 template<
typename _Tp,
typename _Alloc>
355 template <
typename _BinaryPredicate>
362 if (__first == __last)
365 while (++__next != __last)
367 if (__binary_pred(*__first, *__next))
375 template<
typename _Tp,
typename _Alloc>
376 template <
typename _StrictWeakOrdering>
379 sort(_StrictWeakOrdering __comp)
382 if (this->_M_impl._M_node._M_next != &this->_M_impl._M_node
383 && this->_M_impl._M_node._M_next->_M_next != &this->_M_impl._M_node)
387 list * __fill = &__tmp[0];
394 for(__counter = &__tmp[0];
395 __counter != __fill && !__counter->
empty();
398 __counter->
merge(__carry, __comp);
399 __carry.
swap(*__counter);
401 __carry.
swap(*__counter);
402 if (__counter == __fill)
407 for (__counter = &__tmp[1]; __counter != __fill; ++__counter)
408 __counter->
merge(*(__counter - 1), __comp);
413 _GLIBCXX_END_NESTED_NAMESPACE