]> git.buserror.net Git - polintos/scott/priv.git/blob - include/c++/stl/stl/debug/_slist.h
minor doc updates
[polintos/scott/priv.git] / include / c++ / stl / stl / debug / _slist.h
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
36 _STLP_BEGIN_NAMESPACE
37
38 #if defined (_STLP_DEBUG_USE_DISTINCT_VALUE_TYPE_HELPERS)
39 template <class _Tp, class _Alloc>
40 inline _Tp*
41 value_type(const _STLP_PRIV _DBG_iter_base< _STLP_NON_DBG_SLIST >&)
42 { return (_Tp*)0; }
43
44 template <class _Tp, class _Alloc>
45 inline forward_iterator_tag
46 iterator_category(const _STLP_PRIV _DBG_iter_base< _STLP_NON_DBG_SLIST >&)
47 { return forward_iterator_tag(); }
48 #endif
49
50 _STLP_MOVE_TO_PRIV_NAMESPACE
51
52 /*
53  * slist special debug traits version.
54  */
55 template <class _Traits>
56 struct _SlistDbgTraits : _Traits {
57   typedef _SlistDbgTraits<typename _Traits::_ConstTraits> _ConstTraits;
58   typedef _SlistDbgTraits<typename _Traits::_NonConstTraits> _NonConstTraits;
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
70 _STLP_MOVE_TO_STD_NAMESPACE
71
72 template <class _Tp, _STLP_DEFAULT_ALLOCATOR_SELECT(_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:
83   typedef _STLP_NON_DBG_SLIST _Base;
84   typedef slist<_Tp,_Alloc> _Self;
85   typedef _STLP_PRIV __construct_checker<_STLP_NON_DBG_SLIST > _ConstructCheck;
86
87 public:
88
89   __IMPORT_CONTAINER_TYPEDEFS(_Base)
90
91   typedef _STLP_PRIV _DBG_iter<_Base, _STLP_PRIV _SlistDbgTraits<_Nonconst_traits<value_type> > > iterator;
92   typedef _STLP_PRIV _DBG_iter<_Base, _STLP_PRIV _SlistDbgTraits<_Const_traits<value_type> > >    const_iterator;
93
94   allocator_type get_allocator() const { return _M_non_dbg_impl.get_allocator(); }
95 private:
96   _Base _M_non_dbg_impl;
97   _STLP_PRIV __owned_list _M_iter_list;
98
99   void _Invalidate_iterator(const iterator& __it)
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())
108     : _M_non_dbg_impl(__a) , _M_iter_list(&_M_non_dbg_impl) {}
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())
116     : _M_non_dbg_impl(__n, __x, __a), _M_iter_list(&_M_non_dbg_impl) {}
117
118 #if defined(_STLP_DONT_SUP_DFLT_PARAM)
119   explicit slist(size_type __n) : _M_non_dbg_impl(__n) , _M_iter_list(&_M_non_dbg_impl) {}
120 #endif /*_STLP_DONT_SUP_DFLT_PARAM*/
121
122   slist(__move_source<_Self> src)
123     : _M_non_dbg_impl(__move_source<_Base>(src.get()._M_non_dbg_impl)),
124       _M_iter_list(&_M_non_dbg_impl) {
125 #if defined (_STLP_NO_EXTENSIONS) || (_STLP_DEBUG_LEVEL == _STLP_STANDARD_DBG_LEVEL)
126     src.get()._M_iter_list._Invalidate_all();
127 #else
128     src.get()._M_iter_list._Set_owner(_M_iter_list);
129 #endif
130   }
131
132 #if defined (_STLP_MEMBER_TEMPLATES)
133   // We don't need any dispatching tricks here, because _M_insert_after_range
134   // already does them.
135   template <class _InputIterator>
136   slist(_InputIterator __first, _InputIterator __last,
137         const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL)
138     : _ConstructCheck(__first, __last),
139       _M_non_dbg_impl(_STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last), __a),
140       _M_iter_list(&_M_non_dbg_impl) {}
141 #  if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS)
142   template <class _InputIterator>
143   slist(_InputIterator __first, _InputIterator __last)
144     : _ConstructCheck(__first, __last),
145       _M_non_dbg_impl(_STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last)),
146       _M_iter_list(&_M_non_dbg_impl) {}
147 #  endif
148 #else
149
150   slist(const value_type* __first, const value_type* __last,
151         const allocator_type& __a =  allocator_type())
152     : _ConstructCheck(__first, __last),
153       _M_non_dbg_impl(__first, __last, __a),
154       _M_iter_list(&_M_non_dbg_impl) {}
155
156   slist(const_iterator __first, const_iterator __last,
157         const allocator_type& __a = allocator_type() )
158     : _ConstructCheck(__first, __last),
159       _M_non_dbg_impl(__first._M_iterator, __last._M_iterator, __a),
160       _M_iter_list(&_M_non_dbg_impl) {}
161 #endif
162
163   slist(const _Self& __x) :
164     _ConstructCheck(__x),
165     _M_non_dbg_impl(__x._M_non_dbg_impl), _M_iter_list(&_M_non_dbg_impl) {}
166
167   _Self& operator= (const _Self& __x) {
168     if (this != &__x) {
169       _Invalidate_iterators(begin(), end());
170       _M_non_dbg_impl = __x._M_non_dbg_impl;
171     }
172     return *this;
173   }
174
175   ~slist() {}
176
177   void assign(size_type __n, const value_type& __val) {
178     _Invalidate_iterators(begin(), end());
179     _M_non_dbg_impl.assign(__n, __val);
180   }
181
182   iterator before_begin()
183   { return iterator(&_M_iter_list, _M_non_dbg_impl.before_begin()); }
184   const_iterator before_begin() const
185   { return const_iterator(&_M_iter_list, _M_non_dbg_impl.before_begin()); }
186
187   iterator begin()
188   { return iterator(&_M_iter_list, _M_non_dbg_impl.begin()); }
189   const_iterator begin() const
190   { return const_iterator(&_M_iter_list, _M_non_dbg_impl.begin());}
191
192   iterator end()
193   { return iterator(&_M_iter_list, _M_non_dbg_impl.end()); }
194   const_iterator end() const
195   { return const_iterator(&_M_iter_list, _M_non_dbg_impl.end()); }
196
197   bool empty() const { return _M_non_dbg_impl.empty(); }
198   size_type size() const { return _M_non_dbg_impl.size(); }
199   size_type max_size() const { return _M_non_dbg_impl.max_size(); }
200
201   void swap(_Self& __x) {
202     _M_iter_list._Swap_owners(__x._M_iter_list);
203     _M_non_dbg_impl.swap(__x._M_non_dbg_impl);
204   }
205
206   reference front() {
207     _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER)
208     return _M_non_dbg_impl.front();
209   }
210   const_reference front() const {
211     _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER)
212     return _M_non_dbg_impl.front();
213   }
214   void push_front(const_reference __x) { _M_non_dbg_impl.push_front(__x); }
215   void pop_front() {
216     _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER)
217     _M_non_dbg_impl.pop_front();
218   }
219   iterator previous(const_iterator __pos) {
220     _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
221     _STLP_VERBOSE_ASSERT(!(__pos._M_iterator == _M_non_dbg_impl.before_begin()), _StlMsg_INVALID_ARGUMENT)
222     return iterator(&_M_iter_list, _M_non_dbg_impl.previous(__pos._M_iterator));
223   }
224   const_iterator previous(const_iterator __pos) const {
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 const_iterator(&_M_iter_list, _M_non_dbg_impl.previous(__pos._M_iterator));
228   }
229
230 public:
231
232 #if !defined (_STLP_DONT_SUP_DFLT_PARAM)
233   iterator insert_after(iterator __pos, const value_type& __x = _Tp()) {
234 #else
235   iterator insert_after(iterator __pos, const value_type& __x) {
236 #endif /*_STLP_DONT_SUP_DFLT_PARAM*/
237     _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__pos))
238     _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
239     return iterator(&_M_iter_list,_M_non_dbg_impl.insert_after(__pos._M_iterator, __x));
240   }
241
242 #if defined (_STLP_DONT_SUP_DFLT_PARAM)
243   iterator insert_after(iterator __pos) {
244     return insert_after(__pos, _STLP_DEFAULT_CONSTRUCTED(_Tp));
245   }
246 #endif /*_STLP_DONT_SUP_DFLT_PARAM*/
247
248   void insert_after(iterator __pos, size_type __n, const value_type& __x) {
249     _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__pos))
250     _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
251     _M_non_dbg_impl.insert_after(__pos._M_iterator, __n, __x);
252   }
253
254 #if defined (_STLP_MEMBER_TEMPLATES)
255   template <class _InputIterator>
256   void assign(_InputIterator __first, _InputIterator __last) {
257     _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
258     _Invalidate_iterators(begin(), end());
259     _M_non_dbg_impl.assign(_STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last));
260   }
261 #else
262   void assign(const_iterator __first, const_iterator __last) {
263     _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
264     _Invalidate_iterators(begin(), end());
265     _M_non_dbg_impl.assign(__first._M_iterator, __last._M_iterator);
266   }
267   void assign(const value_type *__first, const value_type *__last) {
268     _STLP_DEBUG_CHECK(_STLP_PRIV __check_ptr_range(__first, __last))
269     _Invalidate_iterators(begin(), end());
270     _M_non_dbg_impl.assign(__first, __last);
271   }
272 #endif
273
274 #if defined (_STLP_MEMBER_TEMPLATES)
275   template <class _InIter>
276   void insert_after(iterator __pos, _InIter __first, _InIter __last) {
277     _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__pos))
278     _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
279     _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
280     _M_non_dbg_impl.insert_after(__pos._M_iterator,
281                                  _STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last));
282   }
283
284   template <class _InIter>
285   void insert(iterator __pos, _InIter __first, _InIter __last) {
286     _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
287     _STLP_VERBOSE_ASSERT(!(__pos._M_iterator == _M_non_dbg_impl.before_begin()), _StlMsg_INVALID_ARGUMENT)
288     _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
289     _M_non_dbg_impl.insert(__pos._M_iterator,
290                            _STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last));
291   }
292 #else
293   void insert_after(iterator __pos,
294                     const_iterator __first, const_iterator __last) {
295     _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__pos))
296     _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
297     _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
298     _M_non_dbg_impl.insert_after(__pos._M_iterator, __first._M_iterator, __last._M_iterator);
299   }
300   void insert_after(iterator __pos,
301                     const value_type* __first, const value_type* __last) {
302     _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__pos))
303     _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
304     _STLP_DEBUG_CHECK(_STLP_PRIV __check_ptr_range(__first, __last))
305     _M_non_dbg_impl.insert_after(__pos._M_iterator, __first, __last);
306   }
307
308   void insert(iterator __pos, const_iterator __first, const_iterator __last) {
309     _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
310     _STLP_VERBOSE_ASSERT(!(__pos._M_iterator == _M_non_dbg_impl.before_begin()), _StlMsg_INVALID_ARGUMENT)
311     _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
312     _M_non_dbg_impl.insert(__pos._M_iterator, __first._M_iterator, __last._M_iterator);
313   }
314   void insert(iterator __pos, const value_type* __first,
315                               const value_type* __last) {
316     _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__pos))
317     _STLP_VERBOSE_ASSERT(!(__pos._M_iterator == _M_non_dbg_impl.before_begin()), _StlMsg_INVALID_ARGUMENT)
318     _STLP_DEBUG_CHECK(_STLP_PRIV __check_ptr_range(__first, __last))
319     _M_non_dbg_impl.insert(__pos._M_iterator, __first, __last);
320   }
321 #endif
322
323 #if !defined (_STLP_DONT_SUP_DFLT_PARAM)
324   iterator insert(iterator __pos, const value_type& __x = _Tp()) {
325 #else
326   iterator insert(iterator __pos, const value_type& __x) {
327 #endif /*_STLP_DONT_SUP_DFLT_PARAM*/
328     _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
329     _STLP_VERBOSE_ASSERT(!(__pos._M_iterator == _M_non_dbg_impl.before_begin()), _StlMsg_INVALID_ARGUMENT)
330     return iterator(&_M_iter_list, _M_non_dbg_impl.insert(__pos._M_iterator, __x));
331   }
332
333 #if defined (_STLP_DONT_SUP_DFLT_PARAM)
334   iterator insert(iterator __pos) {
335     return insert(__pos, _STLP_DEFAULT_CONSTRUCTED(_Tp));
336   }
337 #endif /*_STLP_DONT_SUP_DFLT_PARAM*/
338
339   void insert(iterator __pos, size_type __n, const value_type& __x) {
340     _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
341     _STLP_VERBOSE_ASSERT(!(__pos._M_iterator == _M_non_dbg_impl.before_begin()), _StlMsg_INVALID_ARGUMENT)
342     _M_non_dbg_impl.insert(__pos._M_iterator, __n, __x);
343   }
344
345 public:
346   iterator erase_after(iterator __pos) {
347     _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__pos))
348     _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__pos))
349     iterator __tmp = __pos; ++__tmp;
350     _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__tmp))
351     _Invalidate_iterator(__tmp);
352     return iterator(&_M_iter_list, _M_non_dbg_impl.erase_after(__pos._M_iterator));
353   }
354   iterator erase_after(iterator __before_first, iterator __last) {
355     _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__before_first))
356     _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__before_first, __last, begin(), end()))
357     iterator __tmp = __before_first; ++__tmp;
358     _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__tmp))
359     _Invalidate_iterators(__tmp, __last);
360     return iterator(&_M_iter_list, _M_non_dbg_impl.erase_after(__before_first._M_iterator, __last._M_iterator));
361   }
362
363   iterator erase(iterator __pos) {
364     _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__pos))
365     _STLP_VERBOSE_ASSERT(__pos._M_iterator != _M_non_dbg_impl.before_begin(), _StlMsg_INVALID_ARGUMENT)
366     _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
367     _Invalidate_iterator(__pos);
368     return iterator(&_M_iter_list, _M_non_dbg_impl.erase(__pos._M_iterator));
369   }
370   iterator erase(iterator __first, iterator __last) {
371     _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last, begin(), end()))
372     _Invalidate_iterators(__first, __last);
373     return iterator(&_M_iter_list, _M_non_dbg_impl.erase(__first._M_iterator, __last._M_iterator));
374   }
375
376 #if !defined(_STLP_DONT_SUP_DFLT_PARAM)
377   void resize(size_type __new_size, const value_type& __x = _Tp()) {
378 #else
379   void resize(size_type __new_size, const value_type& __x) {
380 #endif /*_STLP_DONT_SUP_DFLT_PARAM*/
381     _M_non_dbg_impl.resize(__new_size, __x);
382   }
383
384 #if defined(_STLP_DONT_SUP_DFLT_PARAM)
385   void resize(size_type __new_size) { resize(__new_size, _STLP_DEFAULT_CONSTRUCTED(_Tp)); }
386 #endif /*_STLP_DONT_SUP_DFLT_PARAM*/
387
388   void clear() {
389     _Invalidate_iterators(begin(), end());
390     _M_non_dbg_impl.clear();
391   }
392
393 public:
394   // Removes all of the elements from the list __x to *this, inserting
395   // them immediately after __pos.  __x must not be *this.  Complexity:
396   // linear in __x.size().
397   void splice_after(iterator __pos, _Self& __x) {
398     _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__pos))
399     _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__pos))
400     _STLP_VERBOSE_ASSERT(!(&__x == this), _StlMsg_INVALID_ARGUMENT)
401     _M_non_dbg_impl.splice_after(__pos._M_iterator, __x._M_non_dbg_impl);
402     if (get_allocator() == __x.get_allocator()) {
403       __x._M_iter_list._Set_owner(_M_iter_list);
404     }
405     else {
406       __x._Invalidate_iterators(__x.begin(), __x.end());
407     }
408   }
409
410   // Moves the element that follows __prev to *this, inserting it immediately
411   //  after __pos.  This is constant time.
412   void splice_after(iterator __pos, _Self& __x, iterator __prev) {
413     _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__pos))
414     _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
415     _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__prev))
416     _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&__x._M_iter_list, __prev))
417     iterator __elem = __prev; ++__elem;
418     _M_non_dbg_impl.splice_after(__pos._M_iterator, __x._M_non_dbg_impl, __prev._M_iterator);
419     if (get_allocator() == __x.get_allocator()) {
420       _STLP_PRIV __change_ite_owner(__elem, &_M_iter_list);
421     }
422     else {
423       __x._Invalidate_iterator(__elem);
424     }
425   }
426
427   // Moves the range [__before_first + 1, __before_last + 1) to *this,
428   //  inserting it immediately after __pos.  This is constant time.
429   void splice_after(iterator __pos, _Self& __x,
430                     iterator __before_first, iterator __before_last) {
431     _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__pos))
432     _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__pos))
433     _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__before_first, __before_last))
434     _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&__x._M_iter_list, __before_first))
435     _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__before_first))
436     _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__before_last))
437     iterator __first = __before_first; ++__first;
438     iterator __last = __before_last; ++__last;
439     if (get_allocator() == __x.get_allocator()) {
440       _STLP_PRIV __change_range_owner(__first, __last, &_M_iter_list);
441     }
442     else {
443       __x._Invalidate_iterators(__first, __last);
444     }
445     _M_non_dbg_impl.splice_after(__pos._M_iterator, __x._M_non_dbg_impl,
446                                  __before_first._M_iterator, __before_last._M_iterator);
447   }
448
449   // Linear in distance(begin(), __pos), and linear in __x.size().
450   void splice(iterator __pos, _Self& __x) {
451     _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__pos))
452     _STLP_VERBOSE_ASSERT(!(__pos._M_iterator == _M_non_dbg_impl.before_begin()), _StlMsg_INVALID_ARGUMENT)
453     _STLP_VERBOSE_ASSERT(!(&__x == this), _StlMsg_INVALID_ARGUMENT)
454     _M_non_dbg_impl.splice(__pos._M_iterator, __x._M_non_dbg_impl);
455     if (get_allocator() == __x.get_allocator()) {
456       __x._M_iter_list._Set_owner(_M_iter_list);
457     }
458     else {
459       __x._Invalidate_iterators(__x.begin(), __x.end());
460     }
461   }
462
463   // Linear in distance(begin(), __pos), and in distance(__x.begin(), __i).
464   void splice(iterator __pos, _Self& __x, iterator __i) {
465     //__pos should be owned by *this and not be the before_begin iterator
466     _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__pos))
467     _STLP_VERBOSE_ASSERT(!(__pos._M_iterator == _M_non_dbg_impl.before_begin()), _StlMsg_INVALID_ARGUMENT)
468     //__i should be dereferenceable, not before_begin and be owned by __x
469     _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__i))
470     _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&__x._M_iter_list ,__i))
471     _STLP_VERBOSE_ASSERT(!(__i == __x.before_begin()), _StlMsg_INVALID_ARGUMENT)
472     if (get_allocator() == __x.get_allocator()) {
473       _STLP_PRIV __change_ite_owner(__i, &_M_iter_list);
474     }
475     else {
476       __x._Invalidate_iterator(__i);
477     }
478     _M_non_dbg_impl.splice(__pos._M_iterator, __x._M_non_dbg_impl, __i._M_iterator);
479   }
480
481   // Linear in distance(begin(), __pos), in distance(__x.begin(), __first),
482   // and in distance(__first, __last).
483   void splice(iterator __pos, _Self& __x, iterator __first, iterator __last) {
484     _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__pos))
485     _STLP_VERBOSE_ASSERT(!(__pos._M_iterator == _M_non_dbg_impl.before_begin()), _StlMsg_INVALID_ARGUMENT)
486     //_STLP_VERBOSE_ASSERT(&__x != this, _StlMsg_INVALID_ARGUMENT)
487     _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last, __x.begin(), __x.end()))
488     if (get_allocator() == __x.get_allocator()) {
489       _STLP_PRIV __change_range_owner(__first, __last, &_M_iter_list);
490     }
491     else {
492       __x._Invalidate_iterators(__first, __last);
493     }
494     _M_non_dbg_impl.splice(__pos._M_iterator, __x._M_non_dbg_impl,
495                            __first._M_iterator, __last._M_iterator);
496   }
497
498   void reverse()
499   { _M_non_dbg_impl.reverse(); }
500
501   void remove(const value_type& __val) {
502     _Base_iterator __first = _M_non_dbg_impl.begin(), __last = _M_non_dbg_impl.end();
503     while (__first != __last) {
504       _Base_iterator __next = __first;
505       ++__next;
506       if (__val == *__first) {
507         _Invalidate_iterator(iterator(&_M_iter_list, __first));
508         _M_non_dbg_impl.erase(__first);
509       }
510       __first = __next;
511     }
512   }
513   void unique() {
514     _Base_iterator __first = _M_non_dbg_impl.begin(), __last = _M_non_dbg_impl.end();
515     if (__first == __last) return;
516     _Base_iterator __next = __first;
517     while (++__next != __last) {
518       if (*__first == *__next) {
519         _Invalidate_iterator(iterator(&_M_iter_list, __next));
520         _M_non_dbg_impl.erase(__next);
521       }
522       else
523         __first = __next;
524       __next = __first;
525     }
526   }
527   void merge(_Self& __x) {
528     _STLP_VERBOSE_ASSERT(&__x != this, _StlMsg_INVALID_ARGUMENT)
529 #if !defined (_STLP_NO_EXTENSIONS)
530     /* comments below due to bug in GCC compilers: ones eat all memory  and die if see
531      * something like namespace_name::func_name() - ptr
532      */
533     _STLP_DEBUG_CHECK( /* _STLP_STD:: */ is_sorted(_M_non_dbg_impl.begin(), _M_non_dbg_impl.end()))
534     _STLP_DEBUG_CHECK( /* _STLP_STD:: */ is_sorted(__x.begin()._M_iterator, __x.end()._M_iterator))
535 #endif
536     _M_non_dbg_impl.merge(__x._M_non_dbg_impl);
537     if (get_allocator() == __x.get_allocator()) {
538       __x._M_iter_list._Set_owner(_M_iter_list);
539     }
540     else {
541       __x._Invalidate_iterators(__x.begin(), __x.end());
542     }
543   }
544   void sort() {
545     _M_non_dbg_impl.sort();
546   }
547
548 #if defined (_STLP_MEMBER_TEMPLATES)
549   template <class _Predicate>
550   void remove_if(_Predicate __pred) {
551     _Base_iterator __first = _M_non_dbg_impl.begin(), __last = _M_non_dbg_impl.end();
552     while (__first != __last) {
553       _Base_iterator __next = __first;
554       ++__next;
555       if (__pred(*__first)) {
556         _Invalidate_iterator(iterator(&_M_iter_list, __first));
557         _M_non_dbg_impl.erase(__first);
558       }
559       __first = __next;
560     }
561   }
562
563   template <class _BinaryPredicate>
564   void unique(_BinaryPredicate __pred) {
565     _Base_iterator __first = _M_non_dbg_impl.begin(), __last = _M_non_dbg_impl.end();
566     if (__first == __last) return;
567     _Base_iterator __next = __first;
568     while (++__next != __last) {
569       if (__binary_pred(*__first, *__next)) {
570         _Invalidate_iterator(iterator(&_M_iter_list, __next));
571         _M_non_dbg_impl.erase(__next);
572       }
573       else
574         __first = __next;
575       __next = __first;
576     }
577   }
578
579   template <class _StrictWeakOrdering>
580   void merge(_Self& __x, _StrictWeakOrdering __ord) {
581     _STLP_VERBOSE_ASSERT(&__x != this, _StlMsg_INVALID_ARGUMENT)
582 #if !defined (_STLP_NO_EXTENSIONS)
583     /* comments below due to bug in GCC compilers: ones eat all memory  and die if see
584      * something like namespace_name::func_name() - ptr
585      */
586     _STLP_DEBUG_CHECK( /* _STLP_STD:: */ is_sorted(_M_non_dbg_impl.begin(), _M_non_dbg_impl.end(), __ord))
587     _STLP_DEBUG_CHECK( /* _STLP_STD:: */ is_sorted(__x.begin()._M_iterator, __x.end()._M_iterator, __ord))
588 #endif
589     _M_non_dbg_impl.merge(__x._M_non_dbg_impl, __ord);
590     if (get_allocator() == __x.get_allocator()) {
591       __x._M_iter_list._Set_owner(_M_iter_list);
592     }
593     else {
594       __x._Invalidate_iterators(__x.begin(), __x.end());
595     }
596   }
597
598   template <class _StrictWeakOrdering>
599   void sort(_StrictWeakOrdering __comp)
600   { _M_non_dbg_impl.sort(__comp); }
601 #endif
602 };
603
604 _STLP_END_NAMESPACE
605
606 #undef _STLP_NON_DBG_SLIST
607
608 #endif /* _STLP_INTERNAL_DBG_SLIST_H */
609
610 // Local Variables:
611 // mode:C++
612 // End: