ReactOS  0.4.14-dev-614-gbfd8a84
_slist.h
Go to the documentation of this file.
1 /*
2  *
3  * Copyright (c) 1996,1997
4  * Silicon Graphics Computer Systems, Inc.
5  *
6  * Copyright (c) 1997
7  * Moscow Center for SPARC Technology
8  *
9  * Copyright (c) 1999
10  * Boris Fomitchev
11  *
12  * This material is provided "as is", with absolutely no warranty expressed
13  * or implied. Any use is at your own risk.
14  *
15  * Permission to use or copy this software for any purpose is hereby granted
16  * without fee, provided the above notices are retained on all copies.
17  * Permission to modify the code and to distribute modified code is granted,
18  * provided the above notices are retained, and a notice that the code was
19  * modified is included with the above copyright notice.
20  *
21  */
22 
23 /* NOTE: This is an internal header file, included by other STL headers.
24  * You should not attempt to use it directly.
25  */
26 
27 #ifndef _STLP_INTERNAL_DBG_SLIST_H
28 #define _STLP_INTERNAL_DBG_SLIST_H
29 
30 #ifndef _STLP_DBG_ITERATOR_H
31 # include <stl/debug/_iterator.h>
32 #endif
33 
34 #define _STLP_NON_DBG_SLIST _STLP_PRIV _STLP_NON_DBG_NAME(slist) <_Tp, _Alloc>
35 
37 
38 #if defined (_STLP_DEBUG_USE_DISTINCT_VALUE_TYPE_HELPERS)
39 template <class _Tp, class _Alloc>
40 inline _Tp*
42 { return (_Tp*)0; }
43 
44 template <class _Tp, class _Alloc>
46 iterator_category(const _STLP_PRIV _DBG_iter_base< _STLP_NON_DBG_SLIST >&)
47 { return forward_iterator_tag(); }
48 #endif
49 
51 
52 /*
53  * slist special debug traits version.
54  */
55 template <class _Traits>
56 struct _SlistDbgTraits : _Traits {
59 
60  /*
61  * We don't want the before_begin iterator to return false at _Dereferenceable
62  * call to do not break the current debug framework but calling * operator should
63  * fail.
64  */
65  template <class _Iterator>
66  static bool _Check(const _Iterator& __it)
67  { return !(__it._M_iterator == (__it._Get_container_ptr())->before_begin()); }
68 };
69 
71 
72 template <class _Tp, _STLP_DFL_TMPL_PARAM(_Alloc, allocator<_Tp>) >
73 class slist :
74 #if !defined (__DMC__)
75  private
76 #endif
77  _STLP_PRIV __construct_checker<_STLP_NON_DBG_SLIST >
78 #if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND)
79  , public __stlport_class<slist<_Tp, _Alloc> >
80 #endif
81 {
82 private:
86 
87 public:
88 
90 
93 
94  allocator_type get_allocator() const { return _M_non_dbg_impl.get_allocator(); }
95 private:
97  _STLP_PRIV __owned_list _M_iter_list;
98 
100  { _STLP_PRIV __invalidate_iterator(&_M_iter_list, __it); }
101  void _Invalidate_iterators(const iterator& __first, const iterator& __last)
102  { _STLP_PRIV __invalidate_range(&_M_iter_list, __first, __last); }
103 
104  typedef typename _Base::iterator _Base_iterator;
105 
106 public:
107  explicit slist(const allocator_type& __a = allocator_type())
109 
110 #if !defined(_STLP_DONT_SUP_DFLT_PARAM)
111  explicit slist(size_type __n, const value_type& __x = _Tp(),
112 #else
113  slist(size_type __n, const value_type& __x,
114 #endif /*_STLP_DONT_SUP_DFLT_PARAM*/
115  const allocator_type& __a = allocator_type())
117 
118 #if defined(_STLP_DONT_SUP_DFLT_PARAM)
120 #endif /*_STLP_DONT_SUP_DFLT_PARAM*/
121 
122 #if !defined (_STLP_NO_MOVE_SEMANTIC)
126 # if defined (_STLP_NO_EXTENSIONS) || (_STLP_DEBUG_LEVEL == _STLP_STANDARD_DBG_LEVEL)
127  src.get()._M_iter_list._Invalidate_all();
128 # else
129  src.get()._M_iter_list._Set_owner(_M_iter_list);
130 # endif
131  }
132 #endif
133 
134 #if defined (_STLP_MEMBER_TEMPLATES)
135  // We don't need any dispatching tricks here, because _M_insert_after_range
136  // already does them.
137  template <class _InputIterator>
138  slist(_InputIterator __first, _InputIterator __last,
140  : _ConstructCheck(__first, __last),
143 # if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS)
144  template <class _InputIterator>
145  slist(_InputIterator __first, _InputIterator __last)
146  : _ConstructCheck(__first, __last),
149 # endif
150 #else
151 
152  slist(const value_type* __first, const value_type* __last,
153  const allocator_type& __a = allocator_type())
154  : _ConstructCheck(__first, __last),
155  _M_non_dbg_impl(__first, __last, __a),
157 
159  const allocator_type& __a = allocator_type() )
160  : _ConstructCheck(__first, __last),
161  _M_non_dbg_impl(__first._M_iterator, __last._M_iterator, __a),
163 #endif
164 
165  slist(const _Self& __x) :
166  _ConstructCheck(__x),
168 
169  _Self& operator= (const _Self& __x) {
170  if (this != &__x) {
173  }
174  return *this;
175  }
176 
177  ~slist() {}
178 
181  _M_non_dbg_impl.assign(__n, __val);
182  }
183 
185  { return iterator(&_M_iter_list, _M_non_dbg_impl.before_begin()); }
187  { return const_iterator(&_M_iter_list, _M_non_dbg_impl.before_begin()); }
188 
190  { return iterator(&_M_iter_list, _M_non_dbg_impl.begin()); }
192  { return const_iterator(&_M_iter_list, _M_non_dbg_impl.begin());}
193 
195  { return iterator(&_M_iter_list, _M_non_dbg_impl.end()); }
197  { return const_iterator(&_M_iter_list, _M_non_dbg_impl.end()); }
198 
199  bool empty() const { return _M_non_dbg_impl.empty(); }
200  size_type size() const { return _M_non_dbg_impl.size(); }
201  size_type max_size() const { return _M_non_dbg_impl.max_size(); }
202 
203  void swap(_Self& __x) {
204  _M_iter_list._Swap_owners(__x._M_iter_list);
206  }
207 #if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
208  void _M_swap_workaround(_Self& __x) { swap(__x); }
209 #endif
210 
212  _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER)
213  return _M_non_dbg_impl.front();
214  }
216  _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER)
217  return _M_non_dbg_impl.front();
218  }
219  void push_front(const_reference __x) { _M_non_dbg_impl.push_front(__x); }
220  void pop_front() {
221  _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER)
222  _M_non_dbg_impl.pop_front();
223  }
225  _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
226  _STLP_VERBOSE_ASSERT(!(__pos._M_iterator == _M_non_dbg_impl.before_begin()), _StlMsg_INVALID_ARGUMENT)
227  return iterator(&_M_iter_list, _M_non_dbg_impl.previous(__pos._M_iterator));
228  }
230  _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
231  _STLP_VERBOSE_ASSERT(!(__pos._M_iterator == _M_non_dbg_impl.before_begin()), _StlMsg_INVALID_ARGUMENT)
232  return const_iterator(&_M_iter_list, _M_non_dbg_impl.previous(__pos._M_iterator));
233  }
234 
235 public:
236 
237 #if !defined (_STLP_DONT_SUP_DFLT_PARAM)
238  iterator insert_after(iterator __pos, const value_type& __x = _Tp()) {
239 #else
240  iterator insert_after(iterator __pos, const value_type& __x) {
241 #endif /*_STLP_DONT_SUP_DFLT_PARAM*/
243  _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
244  return iterator(&_M_iter_list,_M_non_dbg_impl.insert_after(__pos._M_iterator, __x));
245  }
246 
247 #if defined (_STLP_DONT_SUP_DFLT_PARAM)
249  return insert_after(__pos, _STLP_DEFAULT_CONSTRUCTED(_Tp));
250  }
251 #endif /*_STLP_DONT_SUP_DFLT_PARAM*/
252 
253  void insert_after(iterator __pos, size_type __n, const value_type& __x) {
255  _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
256  _M_non_dbg_impl.insert_after(__pos._M_iterator, __n, __x);
257  }
258 
259 #if defined (_STLP_MEMBER_TEMPLATES)
260  template <class _InputIterator>
261  void assign(_InputIterator __first, _InputIterator __last) {
262  _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
265  }
266 #else
268  _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
270  _M_non_dbg_impl.assign(__first._M_iterator, __last._M_iterator);
271  }
272  void assign(const value_type *__first, const value_type *__last) {
273  _STLP_DEBUG_CHECK(_STLP_PRIV __check_ptr_range(__first, __last))
275  _M_non_dbg_impl.assign(__first, __last);
276  }
277 #endif
278 
279 #if defined (_STLP_MEMBER_TEMPLATES)
280  template <class _InIter>
281  void insert_after(iterator __pos, _InIter __first, _InIter __last) {
283  _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
284  _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
285  _M_non_dbg_impl.insert_after(__pos._M_iterator,
287  }
288 
289  template <class _InIter>
290  void insert(iterator __pos, _InIter __first, _InIter __last) {
291  _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
292  _STLP_VERBOSE_ASSERT(!(__pos._M_iterator == _M_non_dbg_impl.before_begin()), _StlMsg_INVALID_ARGUMENT)
293  _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
294  _M_non_dbg_impl.insert(__pos._M_iterator,
296  }
297 #else
298  void insert_after(iterator __pos,
301  _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
302  _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
303  _M_non_dbg_impl.insert_after(__pos._M_iterator, __first._M_iterator, __last._M_iterator);
304  }
305  void insert_after(iterator __pos,
306  const value_type* __first, const value_type* __last) {
308  _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
309  _STLP_DEBUG_CHECK(_STLP_PRIV __check_ptr_range(__first, __last))
310  _M_non_dbg_impl.insert_after(__pos._M_iterator, __first, __last);
311  }
312 
314  _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
315  _STLP_VERBOSE_ASSERT(!(__pos._M_iterator == _M_non_dbg_impl.before_begin()), _StlMsg_INVALID_ARGUMENT)
316  _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
317  _M_non_dbg_impl.insert(__pos._M_iterator, __first._M_iterator, __last._M_iterator);
318  }
319  void insert(iterator __pos, const value_type* __first,
320  const value_type* __last) {
321  _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__pos))
322  _STLP_VERBOSE_ASSERT(!(__pos._M_iterator == _M_non_dbg_impl.before_begin()), _StlMsg_INVALID_ARGUMENT)
323  _STLP_DEBUG_CHECK(_STLP_PRIV __check_ptr_range(__first, __last))
324  _M_non_dbg_impl.insert(__pos._M_iterator, __first, __last);
325  }
326 #endif
327 
328 #if !defined (_STLP_DONT_SUP_DFLT_PARAM)
329  iterator insert(iterator __pos, const value_type& __x = _Tp()) {
330 #else
331  iterator insert(iterator __pos, const value_type& __x) {
332 #endif /*_STLP_DONT_SUP_DFLT_PARAM*/
333  _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
334  _STLP_VERBOSE_ASSERT(!(__pos._M_iterator == _M_non_dbg_impl.before_begin()), _StlMsg_INVALID_ARGUMENT)
335  return iterator(&_M_iter_list, _M_non_dbg_impl.insert(__pos._M_iterator, __x));
336  }
337 
338 #if defined (_STLP_DONT_SUP_DFLT_PARAM)
339  iterator insert(iterator __pos) {
340  return insert(__pos, _STLP_DEFAULT_CONSTRUCTED(_Tp));
341  }
342 #endif /*_STLP_DONT_SUP_DFLT_PARAM*/
343 
344  void insert(iterator __pos, size_type __n, const value_type& __x) {
345  _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
346  _STLP_VERBOSE_ASSERT(!(__pos._M_iterator == _M_non_dbg_impl.before_begin()), _StlMsg_INVALID_ARGUMENT)
347  _M_non_dbg_impl.insert(__pos._M_iterator, __n, __x);
348  }
349 
350 public:
353  _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__pos))
354  iterator __tmp = __pos; ++__tmp;
356  _Invalidate_iterator(__tmp);
357  return iterator(&_M_iter_list, _M_non_dbg_impl.erase_after(__pos._M_iterator));
358  }
361  _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__before_first, __last, begin(), end()))
362  iterator __tmp = __before_first; ++__tmp;
365  return iterator(&_M_iter_list, _M_non_dbg_impl.erase_after(__before_first._M_iterator, __last._M_iterator));
366  }
367 
370  _STLP_VERBOSE_ASSERT(__pos._M_iterator != _M_non_dbg_impl.before_begin(), _StlMsg_INVALID_ARGUMENT)
371  _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
372  _Invalidate_iterator(__pos);
373  return iterator(&_M_iter_list, _M_non_dbg_impl.erase(__pos._M_iterator));
374  }
376  _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last, begin(), end()))
377  _Invalidate_iterators(__first, __last);
378  return iterator(&_M_iter_list, _M_non_dbg_impl.erase(__first._M_iterator, __last._M_iterator));
379  }
380 
381 #if !defined(_STLP_DONT_SUP_DFLT_PARAM)
382  void resize(size_type __new_size, const value_type& __x = _Tp()) {
383 #else
384  void resize(size_type __new_size, const value_type& __x) {
385 #endif /*_STLP_DONT_SUP_DFLT_PARAM*/
386  _M_non_dbg_impl.resize(__new_size, __x);
387  }
388 
389 #if defined(_STLP_DONT_SUP_DFLT_PARAM)
390  void resize(size_type __new_size) { resize(__new_size, _STLP_DEFAULT_CONSTRUCTED(_Tp)); }
391 #endif /*_STLP_DONT_SUP_DFLT_PARAM*/
392 
393  void clear() {
395  _M_non_dbg_impl.clear();
396  }
397 
398 public:
399  // Removes all of the elements from the list __x to *this, inserting
400  // them immediately after __pos. __x must not be *this. Complexity:
401  // linear in __x.size().
402  void splice_after(iterator __pos, _Self& __x) {
404  _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__pos))
405  _STLP_VERBOSE_ASSERT(!(&__x == this), _StlMsg_INVALID_ARGUMENT)
406  _M_non_dbg_impl.splice_after(__pos._M_iterator, __x._M_non_dbg_impl);
407  if (get_allocator() == __x.get_allocator()) {
408  __x._M_iter_list._Set_owner(_M_iter_list);
409  }
410  else {
411  __x._Invalidate_iterators(__x.begin(), __x.end());
412  }
413  }
414 
415  // Moves the element that follows __prev to *this, inserting it immediately
416  // after __pos. This is constant time.
417  void splice_after(iterator __pos, _Self& __x, iterator __prev) {
419  _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
421  _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&__x._M_iter_list, __prev))
422  iterator __elem = __prev; ++__elem;
423  _M_non_dbg_impl.splice_after(__pos._M_iterator, __x._M_non_dbg_impl, __prev._M_iterator);
424  if (get_allocator() == __x.get_allocator()) {
425  _STLP_PRIV __change_ite_owner(__elem, &_M_iter_list);
426  }
427  else {
428  __x._Invalidate_iterator(__elem);
429  }
430  }
431 
432  // Moves the range [__before_first + 1, __before_last + 1) to *this,
433  // inserting it immediately after __pos. This is constant time.
434  void splice_after(iterator __pos, _Self& __x,
435  iterator __before_first, iterator __before_last) {
437  _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__pos))
438  _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__before_first, __before_last))
439  _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&__x._M_iter_list, __before_first))
442  iterator __first = __before_first; ++__first;
443  iterator __last = __before_last; ++__last;
444  if (get_allocator() == __x.get_allocator()) {
445  _STLP_PRIV __change_range_owner(__first, __last, &_M_iter_list);
446  }
447  else {
448  __x._Invalidate_iterators(__first, __last);
449  }
450  _M_non_dbg_impl.splice_after(__pos._M_iterator, __x._M_non_dbg_impl,
451  __before_first._M_iterator, __before_last._M_iterator);
452  }
453 
454  void splice(iterator __pos, _Self& __x) {
455  _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__pos))
456  _STLP_VERBOSE_ASSERT(!(__pos._M_iterator == _M_non_dbg_impl.before_begin()), _StlMsg_INVALID_ARGUMENT)
457  _STLP_VERBOSE_ASSERT(!(&__x == this), _StlMsg_INVALID_ARGUMENT)
458  _M_non_dbg_impl.splice(__pos._M_iterator, __x._M_non_dbg_impl);
459  if (get_allocator() == __x.get_allocator()) {
460  __x._M_iter_list._Set_owner(_M_iter_list);
461  }
462  else {
463  __x._Invalidate_iterators(__x.begin(), __x.end());
464  }
465  }
466 
467  void splice(iterator __pos, _Self& __x, iterator __i) {
468  //__pos should be owned by *this and not be the before_begin iterator
469  _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__pos))
470  _STLP_VERBOSE_ASSERT(!(__pos._M_iterator == _M_non_dbg_impl.before_begin()), _StlMsg_INVALID_ARGUMENT)
471  //__i should be dereferenceable, not before_begin and be owned by __x
473  _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&__x._M_iter_list ,__i))
474  _STLP_VERBOSE_ASSERT(!(__i == __x.before_begin()), _StlMsg_INVALID_ARGUMENT)
475  if (get_allocator() == __x.get_allocator()) {
476  _STLP_PRIV __change_ite_owner(__i, &_M_iter_list);
477  }
478  else {
479  __x._Invalidate_iterator(__i);
480  }
481  _M_non_dbg_impl.splice(__pos._M_iterator, __x._M_non_dbg_impl, __i._M_iterator);
482  }
483 
484  void splice(iterator __pos, _Self& __x, iterator __first, iterator __last) {
485  _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__pos))
486  _STLP_VERBOSE_ASSERT(!(__pos._M_iterator == _M_non_dbg_impl.before_begin()), _StlMsg_INVALID_ARGUMENT)
487  //_STLP_VERBOSE_ASSERT(&__x != this, _StlMsg_INVALID_ARGUMENT)
488  _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last, __x.begin(), __x.end()))
489  if (get_allocator() == __x.get_allocator()) {
490  _STLP_PRIV __change_range_owner(__first, __last, &_M_iter_list);
491  }
492  else {
493  __x._Invalidate_iterators(__first, __last);
494  }
495  _M_non_dbg_impl.splice(__pos._M_iterator, __x._M_non_dbg_impl,
496  __first._M_iterator, __last._M_iterator);
497  }
498 
499  void reverse()
500  { _M_non_dbg_impl.reverse(); }
501 
502  void remove(const value_type& __val) {
503  _Base_iterator __first = _M_non_dbg_impl.begin(), __last = _M_non_dbg_impl.end();
504  while (__first != __last) {
505  _Base_iterator __next = __first;
506  ++__next;
507  if (__val == *__first) {
509  _M_non_dbg_impl.erase(__first);
510  }
511  __first = __next;
512  }
513  }
514  void unique() {
515  _Base_iterator __first = _M_non_dbg_impl.begin(), __last = _M_non_dbg_impl.end();
516  if (__first == __last) return;
517  _Base_iterator __next = __first;
518  while (++__next != __last) {
519  if (*__first == *__next) {
521  _M_non_dbg_impl.erase(__next);
522  }
523  else
524  __first = __next;
525  __next = __first;
526  }
527  }
528  void merge(_Self& __x) {
529  _STLP_VERBOSE_ASSERT(&__x != this, _StlMsg_INVALID_ARGUMENT)
530 #if !defined (_STLP_NO_EXTENSIONS)
531  /* comments below due to bug in GCC compilers: ones eat all memory and die if see
532  * something like namespace_name::func_name() - ptr
533  */
534  _STLP_DEBUG_CHECK( /* _STLP_STD:: */ is_sorted(_M_non_dbg_impl.begin(), _M_non_dbg_impl.end()))
535  _STLP_DEBUG_CHECK( /* _STLP_STD:: */ is_sorted(__x.begin()._M_iterator, __x.end()._M_iterator))
536 #endif
537  _M_non_dbg_impl.merge(__x._M_non_dbg_impl);
538  if (get_allocator() == __x.get_allocator()) {
539  __x._M_iter_list._Set_owner(_M_iter_list);
540  }
541  else {
542  __x._Invalidate_iterators(__x.begin(), __x.end());
543  }
544  }
545  void sort() {
546  _M_non_dbg_impl.sort();
547  }
548 
549 #if defined (_STLP_MEMBER_TEMPLATES)
550  template <class _Predicate>
551  void remove_if(_Predicate __pred) {
552  _Base_iterator __first = _M_non_dbg_impl.begin(), __last = _M_non_dbg_impl.end();
553  while (__first != __last) {
554  _Base_iterator __next = __first;
555  ++__next;
556  if (__pred(*__first)) {
558  _M_non_dbg_impl.erase(__first);
559  }
560  __first = __next;
561  }
562  }
563 
564  template <class _BinaryPredicate>
565  void unique(_BinaryPredicate __pred) {
566  _Base_iterator __first = _M_non_dbg_impl.begin(), __last = _M_non_dbg_impl.end();
567  if (__first == __last) return;
568  _Base_iterator __next = __first;
569  while (++__next != __last) {
570  if (__binary_pred(*__first, *__next)) {
572  _M_non_dbg_impl.erase(__next);
573  }
574  else
575  __first = __next;
576  __next = __first;
577  }
578  }
579 
580  template <class _StrictWeakOrdering>
581  void merge(_Self& __x, _StrictWeakOrdering __ord) {
582  _STLP_VERBOSE_ASSERT(&__x != this, _StlMsg_INVALID_ARGUMENT)
583 #if !defined (_STLP_NO_EXTENSIONS)
584  /* comments below due to bug in GCC compilers: ones eat all memory and die if see
585  * something like namespace_name::func_name() - ptr
586  */
587  _STLP_DEBUG_CHECK( /* _STLP_STD:: */ is_sorted(_M_non_dbg_impl.begin(), _M_non_dbg_impl.end(), __ord))
588  _STLP_DEBUG_CHECK( /* _STLP_STD:: */ is_sorted(__x.begin()._M_iterator, __x.end()._M_iterator, __ord))
589 #endif
590  _M_non_dbg_impl.merge(__x._M_non_dbg_impl, __ord);
591  if (get_allocator() == __x.get_allocator()) {
592  __x._M_iter_list._Set_owner(_M_iter_list);
593  }
594  else {
595  __x._Invalidate_iterators(__x.begin(), __x.end());
596  }
597  }
598 
599  template <class _StrictWeakOrdering>
600  void sort(_StrictWeakOrdering __comp)
601  { _M_non_dbg_impl.sort(__comp); }
602 #endif
603 };
604 
606 
607 #undef _STLP_NON_DBG_SLIST
608 
609 #endif /* _STLP_INTERNAL_DBG_SLIST_H */
610 
611 // Local Variables:
612 // mode:C++
613 // End:
void insert(iterator __pos, size_type __n, const value_type &__x)
Definition: _slist.h:344
_STLP_NON_DBG_SLIST _Base
Definition: _slist.h:83
_SlistDbgTraits< typename _Traits::_NonConstTraits > _NonConstTraits
Definition: _slist.h:58
iterator insert_after(iterator __pos, const value_type &__x=_Tp())
Definition: _slist.h:238
iterator erase(iterator __pos)
Definition: _slist.h:368
void insert_after(iterator __pos, const value_type *__first, const value_type *__last)
Definition: _slist.h:305
return __n
Definition: _algo.h:75
bool empty() const
Definition: _slist.h:199
value_type & reference
Definition: _slist.h:233
Definition: _slist.h:198
_STLP_INLINE_LOOP _InputIter _Predicate __pred
Definition: _algo.h:68
bool _Dereferenceable(const _Iterator &__it)
Definition: _iterator.h:93
slist(const allocator_type &__a=allocator_type())
Definition: _slist.h:107
iterator before_begin()
Definition: _slist.h:184
GLuint GLuint end
Definition: gl.h:1545
#define _STLP_NON_DBG_SLIST
Definition: _slist.h:34
void assign(size_type __n, const _Tp &__val)
Definition: _slist.h:348
void splice_after(iterator __pos, _Self &__x, iterator __prev)
Definition: _slist.h:417
_STLP_PRIV _Slist_base< value_type, _Alloc > _Base
Definition: _slist.h:226
_STLP_PRIV _Slist_iterator< value_type, _Const_traits< value_type > > const_iterator
Definition: _slist.h:240
iterator begin()
Definition: _slist.h:416
_Base _M_non_dbg_impl
Definition: _slist.h:96
slist(__move_source< _Self > src)
Definition: _slist.h:123
const_reference front() const
Definition: _slist.h:215
#define _STLP_MOVE_TO_PRIV_NAMESPACE
Definition: features.h:524
void assign(const value_type *__first, const value_type *__last)
Definition: _slist.h:272
slist(size_type __n, const value_type &__x=_Tp(), const allocator_type &__a=allocator_type())
Definition: _slist.h:111
void _Invalidate_iterator(const iterator &__it)
Definition: _slist.h:99
reference front()
Definition: _slist.h:211
void _Invalidate_iterators(const iterator &__first, const iterator &__last)
Definition: _slist.h:101
void push_front(const_reference __x)
Definition: _slist.h:219
void resize(size_type new_size, const value_type &__x=_Tp())
Definition: _slist.c:106
~slist()
Definition: _slist.h:177
#define _STLP_DEFAULT_CONSTRUCTED(_TTp)
Definition: _construct.h:265
slist(const_iterator __first, const_iterator __last, const allocator_type &__a=allocator_type())
Definition: _slist.h:158
iterator previous(const_iterator __pos)
Definition: _slist.h:224
_Base::allocator_type allocator_type
Definition: _slist.h:243
_STLP_INLINE_LOOP _InputIter __last
Definition: _algo.h:68
const_iterator previous(const_iterator __pos) const
Definition: _slist.h:229
_Self & operator=(const _Self &__x)
Definition: _slist.c:70
const_iterator begin() const
Definition: _slist.h:191
#define __IMPORT_CONTAINER_TYPEDEFS(_Super)
Definition: features.h:750
_Iterator _Non_Dbg_iter(_Iterator __it)
Definition: _iterator.h:362
const value_type & const_reference
Definition: _slist.h:234
void insert_after(iterator __pos, const_iterator __first, const_iterator __last)
Definition: _slist.h:298
#define _STLP_MOVE_TO_STD_NAMESPACE
Definition: features.h:525
void get(int argc, const char *argv[])
Definition: cmds.c:480
iterator erase(iterator __first, iterator __last)
Definition: _slist.h:375
_STLP_MOVE_TO_STD_NAMESPACE bool is_sorted(_ForwardIter __first, _ForwardIter __last)
Definition: _algo.h:722
void remove(const value_type &__val)
Definition: _slist.h:502
#define _STLP_ALLOCATOR_TYPE_DFL
Definition: features.h:691
_STLP_INLINE_LOOP _InputIter const _Tp & __val
Definition: _algobase.h:656
slist< _Tp, _Alloc > _Self
Definition: _slist.h:84
iterator erase_after(iterator __pos)
Definition: _slist.h:351
void sort()
Definition: _slist.h:545
void insert_after(iterator __pos, size_type __n, const value_type &__x)
Definition: _slist.h:253
size_type size() const
Definition: _slist.h:200
void splice_after(iterator __pos, _Self &__x)
Definition: _slist.h:402
void pop_front()
Definition: _slist.h:220
_STLP_MOVE_TO_PRIV_NAMESPACE const _InputIterator const input_iterator_tag &_InputIterator __it(__first)
_STLP_INLINE_LOOP _ForwardIter remove_if(_ForwardIter __first, _ForwardIter __last, _Predicate __pred)
Definition: _algo.h:278
const_iterator before_begin() const
Definition: _slist.h:186
_SlistDbgTraits< typename _Traits::_ConstTraits > _ConstTraits
Definition: _slist.h:57
void resize(size_type __new_size, const value_type &__x=_Tp())
Definition: _slist.h:382
#define _STLP_PRIV
Definition: _dm.h:70
void reverse()
Definition: _slist.h:499
slist(const value_type *__first, const value_type *__last, const allocator_type &__a=allocator_type())
Definition: _slist.h:152
void clear()
Definition: _slist.h:393
#define _STLP_DEBUG_CHECK(expr)
Definition: _debug.h:440
GLenum src
Definition: glext.h:6340
_STLP_PRIV __owned_list _M_iter_list
Definition: _slist.h:97
iterator insert(iterator __pos, const value_type &__x=_Tp())
Definition: _slist.h:635
void assign(const_iterator __first, const_iterator __last)
Definition: _slist.h:267
_STLP_PRIV _Slist_iterator< _Tp, _Nonconst_traits< _Tp > > iterator
Definition: _slist.h:239
void assign(size_type __n, const value_type &__val)
Definition: _slist.h:179
allocator_type get_allocator() const
Definition: _slist.h:277
static bool _Check(const _Iterator &__it)
Definition: _slist.h:66
void swap(_Self &__x)
Definition: _slist.h:203
void insert(iterator __pos, const value_type *__first, const value_type *__last)
Definition: _slist.h:319
iterator end()
Definition: _slist.h:420
void splice(iterator __pos, _Self &__x, iterator __first, iterator __last)
Definition: _slist.h:484
void splice(iterator __pos, _Self &__x)
Definition: _slist.h:454
#define _STLP_END_NAMESPACE
Definition: features.h:503
void insert(iterator __pos, const_iterator __first, const_iterator __last)
Definition: _slist.h:313
_STLP_PRIV __construct_checker< _STLP_NON_DBG_SLIST > _ConstructCheck
Definition: _slist.h:85
void merge(_Self &__x)
Definition: _slist.h:528
_Base::iterator _Base_iterator
Definition: _slist.h:104
value_type value_type
Definition: _slist.h:229
void splice_after(iterator __pos, _Self &__x, iterator __before_first, iterator __before_last)
Definition: _slist.h:434
size_type max_size() const
Definition: _slist.h:201
slist(const _Self &__x)
Definition: _slist.h:165
#define _STLP_BEGIN_NAMESPACE
Definition: features.h:501
__ord
Definition: getopt_int.h:55
void splice(iterator __pos, _Self &__x, iterator __i)
Definition: _slist.h:467
void unique()
Definition: _slist.h:514
iterator erase_after(iterator __before_first, iterator __last)
Definition: _slist.h:359
#define _STLP_VERBOSE_ASSERT(expr, diagnostic)
Definition: _debug.h:439
const_iterator end() const
Definition: _slist.h:196