ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

_slist.h
Go to the documentation of this file.
00001 /*
00002  *
00003  * Copyright (c) 1996,1997
00004  * Silicon Graphics Computer Systems, Inc.
00005  *
00006  * Copyright (c) 1997
00007  * Moscow Center for SPARC Technology
00008  *
00009  * Copyright (c) 1999
00010  * Boris Fomitchev
00011  *
00012  * This material is provided "as is", with absolutely no warranty expressed
00013  * or implied. Any use is at your own risk.
00014  *
00015  * Permission to use or copy this software for any purpose is hereby granted
00016  * without fee, provided the above notices are retained on all copies.
00017  * Permission to modify the code and to distribute modified code is granted,
00018  * provided the above notices are retained, and a notice that the code was
00019  * modified is included with the above copyright notice.
00020  *
00021  */
00022 
00023 /* NOTE: This is an internal header file, included by other STL headers.
00024  *   You should not attempt to use it directly.
00025  */
00026 
00027 #ifndef _STLP_INTERNAL_DBG_SLIST_H
00028 #define _STLP_INTERNAL_DBG_SLIST_H
00029 
00030 #ifndef _STLP_DBG_ITERATOR_H
00031 #  include <stl/debug/_iterator.h>
00032 #endif
00033 
00034 #define _STLP_NON_DBG_SLIST _STLP_PRIV _STLP_NON_DBG_NAME(slist) <_Tp, _Alloc>
00035 
00036 _STLP_BEGIN_NAMESPACE
00037 
00038 #if defined (_STLP_DEBUG_USE_DISTINCT_VALUE_TYPE_HELPERS)
00039 template <class _Tp, class _Alloc>
00040 inline _Tp*
00041 value_type(const _STLP_PRIV _DBG_iter_base< _STLP_NON_DBG_SLIST >&)
00042 { return (_Tp*)0; }
00043 
00044 template <class _Tp, class _Alloc>
00045 inline forward_iterator_tag
00046 iterator_category(const _STLP_PRIV _DBG_iter_base< _STLP_NON_DBG_SLIST >&)
00047 { return forward_iterator_tag(); }
00048 #endif
00049 
00050 _STLP_MOVE_TO_PRIV_NAMESPACE
00051 
00052 /*
00053  * slist special debug traits version.
00054  */
00055 template <class _Traits>
00056 struct _SlistDbgTraits : _Traits {
00057   typedef _SlistDbgTraits<typename _Traits::_ConstTraits> _ConstTraits;
00058   typedef _SlistDbgTraits<typename _Traits::_NonConstTraits> _NonConstTraits;
00059 
00060   /*
00061    * We don't want the before_begin iterator to return false at _Dereferenceable
00062    * call to do not break the current debug framework but calling * operator should
00063    * fail.
00064    */
00065   template <class _Iterator>
00066   static bool _Check(const _Iterator& __it)
00067   { return !(__it._M_iterator == (__it._Get_container_ptr())->before_begin()); }
00068 };
00069 
00070 _STLP_MOVE_TO_STD_NAMESPACE
00071 
00072 template <class _Tp, _STLP_DFL_TMPL_PARAM(_Alloc, allocator<_Tp>) >
00073 class slist :
00074 #if !defined (__DMC__)
00075              private
00076 #endif
00077                      _STLP_PRIV __construct_checker<_STLP_NON_DBG_SLIST >
00078 #if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND)
00079             , public __stlport_class<slist<_Tp, _Alloc> >
00080 #endif
00081 {
00082 private:
00083   typedef _STLP_NON_DBG_SLIST _Base;
00084   typedef slist<_Tp,_Alloc> _Self;
00085   typedef _STLP_PRIV __construct_checker<_STLP_NON_DBG_SLIST > _ConstructCheck;
00086 
00087 public:
00088 
00089   __IMPORT_CONTAINER_TYPEDEFS(_Base)
00090 
00091   typedef _STLP_PRIV _DBG_iter<_Base, _STLP_PRIV _SlistDbgTraits<_Nonconst_traits<value_type> > > iterator;
00092   typedef _STLP_PRIV _DBG_iter<_Base, _STLP_PRIV _SlistDbgTraits<_Const_traits<value_type> > >    const_iterator;
00093 
00094   allocator_type get_allocator() const { return _M_non_dbg_impl.get_allocator(); }
00095 private:
00096   _Base _M_non_dbg_impl;
00097   _STLP_PRIV __owned_list _M_iter_list;
00098 
00099   void _Invalidate_iterator(const iterator& __it)
00100   { _STLP_PRIV __invalidate_iterator(&_M_iter_list, __it); }
00101   void _Invalidate_iterators(const iterator& __first, const iterator& __last)
00102   { _STLP_PRIV __invalidate_range(&_M_iter_list, __first, __last); }
00103 
00104   typedef typename _Base::iterator _Base_iterator;
00105 
00106 public:
00107   explicit slist(const allocator_type& __a = allocator_type())
00108     : _M_non_dbg_impl(__a) , _M_iter_list(&_M_non_dbg_impl) {}
00109 
00110 #if !defined(_STLP_DONT_SUP_DFLT_PARAM)
00111   explicit slist(size_type __n, const value_type& __x = _Tp(),
00112 #else
00113   slist(size_type __n, const value_type& __x,
00114 #endif /*_STLP_DONT_SUP_DFLT_PARAM*/
00115         const allocator_type& __a =  allocator_type())
00116     : _M_non_dbg_impl(__n, __x, __a), _M_iter_list(&_M_non_dbg_impl) {}
00117 
00118 #if defined(_STLP_DONT_SUP_DFLT_PARAM)
00119   explicit slist(size_type __n) : _M_non_dbg_impl(__n) , _M_iter_list(&_M_non_dbg_impl) {}
00120 #endif /*_STLP_DONT_SUP_DFLT_PARAM*/
00121 
00122 #if !defined (_STLP_NO_MOVE_SEMANTIC)
00123   slist(__move_source<_Self> src)
00124     : _M_non_dbg_impl(__move_source<_Base>(src.get()._M_non_dbg_impl)),
00125       _M_iter_list(&_M_non_dbg_impl) {
00126 #  if defined (_STLP_NO_EXTENSIONS) || (_STLP_DEBUG_LEVEL == _STLP_STANDARD_DBG_LEVEL)
00127     src.get()._M_iter_list._Invalidate_all();
00128 #  else
00129     src.get()._M_iter_list._Set_owner(_M_iter_list);
00130 #  endif
00131   }
00132 #endif
00133 
00134 #if defined (_STLP_MEMBER_TEMPLATES)
00135   // We don't need any dispatching tricks here, because _M_insert_after_range
00136   // already does them.
00137   template <class _InputIterator>
00138   slist(_InputIterator __first, _InputIterator __last,
00139         const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL)
00140     : _ConstructCheck(__first, __last),
00141       _M_non_dbg_impl(_STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last), __a),
00142       _M_iter_list(&_M_non_dbg_impl) {}
00143 #  if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS)
00144   template <class _InputIterator>
00145   slist(_InputIterator __first, _InputIterator __last)
00146     : _ConstructCheck(__first, __last),
00147       _M_non_dbg_impl(_STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last)),
00148       _M_iter_list(&_M_non_dbg_impl) {}
00149 #  endif
00150 #else
00151 
00152   slist(const value_type* __first, const value_type* __last,
00153         const allocator_type& __a =  allocator_type())
00154     : _ConstructCheck(__first, __last),
00155       _M_non_dbg_impl(__first, __last, __a),
00156       _M_iter_list(&_M_non_dbg_impl) {}
00157 
00158   slist(const_iterator __first, const_iterator __last,
00159         const allocator_type& __a = allocator_type() )
00160     : _ConstructCheck(__first, __last),
00161       _M_non_dbg_impl(__first._M_iterator, __last._M_iterator, __a),
00162       _M_iter_list(&_M_non_dbg_impl) {}
00163 #endif
00164 
00165   slist(const _Self& __x) :
00166     _ConstructCheck(__x),
00167     _M_non_dbg_impl(__x._M_non_dbg_impl), _M_iter_list(&_M_non_dbg_impl) {}
00168 
00169   _Self& operator= (const _Self& __x) {
00170     if (this != &__x) {
00171       _Invalidate_iterators(begin(), end());
00172       _M_non_dbg_impl = __x._M_non_dbg_impl;
00173     }
00174     return *this;
00175   }
00176 
00177   ~slist() {}
00178 
00179   void assign(size_type __n, const value_type& __val) {
00180     _Invalidate_iterators(begin(), end());
00181     _M_non_dbg_impl.assign(__n, __val);
00182   }
00183 
00184   iterator before_begin()
00185   { return iterator(&_M_iter_list, _M_non_dbg_impl.before_begin()); }
00186   const_iterator before_begin() const
00187   { return const_iterator(&_M_iter_list, _M_non_dbg_impl.before_begin()); }
00188 
00189   iterator begin()
00190   { return iterator(&_M_iter_list, _M_non_dbg_impl.begin()); }
00191   const_iterator begin() const
00192   { return const_iterator(&_M_iter_list, _M_non_dbg_impl.begin());}
00193 
00194   iterator end()
00195   { return iterator(&_M_iter_list, _M_non_dbg_impl.end()); }
00196   const_iterator end() const
00197   { return const_iterator(&_M_iter_list, _M_non_dbg_impl.end()); }
00198 
00199   bool empty() const { return _M_non_dbg_impl.empty(); }
00200   size_type size() const { return _M_non_dbg_impl.size(); }
00201   size_type max_size() const { return _M_non_dbg_impl.max_size(); }
00202 
00203   void swap(_Self& __x) {
00204     _M_iter_list._Swap_owners(__x._M_iter_list);
00205     _M_non_dbg_impl.swap(__x._M_non_dbg_impl);
00206   }
00207 #if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
00208   void _M_swap_workaround(_Self& __x) { swap(__x); }
00209 #endif
00210 
00211   reference front() {
00212     _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER)
00213     return _M_non_dbg_impl.front();
00214   }
00215   const_reference front() const {
00216     _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER)
00217     return _M_non_dbg_impl.front();
00218   }
00219   void push_front(const_reference __x) { _M_non_dbg_impl.push_front(__x); }
00220   void pop_front() {
00221     _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER)
00222     _M_non_dbg_impl.pop_front();
00223   }
00224   iterator previous(const_iterator __pos) {
00225     _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
00226     _STLP_VERBOSE_ASSERT(!(__pos._M_iterator == _M_non_dbg_impl.before_begin()), _StlMsg_INVALID_ARGUMENT)
00227     return iterator(&_M_iter_list, _M_non_dbg_impl.previous(__pos._M_iterator));
00228   }
00229   const_iterator previous(const_iterator __pos) const {
00230     _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
00231     _STLP_VERBOSE_ASSERT(!(__pos._M_iterator == _M_non_dbg_impl.before_begin()), _StlMsg_INVALID_ARGUMENT)
00232     return const_iterator(&_M_iter_list, _M_non_dbg_impl.previous(__pos._M_iterator));
00233   }
00234 
00235 public:
00236 
00237 #if !defined (_STLP_DONT_SUP_DFLT_PARAM)
00238   iterator insert_after(iterator __pos, const value_type& __x = _Tp()) {
00239 #else
00240   iterator insert_after(iterator __pos, const value_type& __x) {
00241 #endif /*_STLP_DONT_SUP_DFLT_PARAM*/
00242     _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__pos))
00243     _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
00244     return iterator(&_M_iter_list,_M_non_dbg_impl.insert_after(__pos._M_iterator, __x));
00245   }
00246 
00247 #if defined (_STLP_DONT_SUP_DFLT_PARAM)
00248   iterator insert_after(iterator __pos) {
00249     return insert_after(__pos, _STLP_DEFAULT_CONSTRUCTED(_Tp));
00250   }
00251 #endif /*_STLP_DONT_SUP_DFLT_PARAM*/
00252 
00253   void insert_after(iterator __pos, size_type __n, const value_type& __x) {
00254     _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__pos))
00255     _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
00256     _M_non_dbg_impl.insert_after(__pos._M_iterator, __n, __x);
00257   }
00258 
00259 #if defined (_STLP_MEMBER_TEMPLATES)
00260   template <class _InputIterator>
00261   void assign(_InputIterator __first, _InputIterator __last) {
00262     _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
00263     _Invalidate_iterators(begin(), end());
00264     _M_non_dbg_impl.assign(_STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last));
00265   }
00266 #else
00267   void assign(const_iterator __first, const_iterator __last) {
00268     _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
00269     _Invalidate_iterators(begin(), end());
00270     _M_non_dbg_impl.assign(__first._M_iterator, __last._M_iterator);
00271   }
00272   void assign(const value_type *__first, const value_type *__last) {
00273     _STLP_DEBUG_CHECK(_STLP_PRIV __check_ptr_range(__first, __last))
00274     _Invalidate_iterators(begin(), end());
00275     _M_non_dbg_impl.assign(__first, __last);
00276   }
00277 #endif
00278 
00279 #if defined (_STLP_MEMBER_TEMPLATES)
00280   template <class _InIter>
00281   void insert_after(iterator __pos, _InIter __first, _InIter __last) {
00282     _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__pos))
00283     _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
00284     _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
00285     _M_non_dbg_impl.insert_after(__pos._M_iterator,
00286                                  _STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last));
00287   }
00288 
00289   template <class _InIter>
00290   void insert(iterator __pos, _InIter __first, _InIter __last) {
00291     _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
00292     _STLP_VERBOSE_ASSERT(!(__pos._M_iterator == _M_non_dbg_impl.before_begin()), _StlMsg_INVALID_ARGUMENT)
00293     _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
00294     _M_non_dbg_impl.insert(__pos._M_iterator,
00295                            _STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last));
00296   }
00297 #else
00298   void insert_after(iterator __pos,
00299                     const_iterator __first, const_iterator __last) {
00300     _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__pos))
00301     _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
00302     _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
00303     _M_non_dbg_impl.insert_after(__pos._M_iterator, __first._M_iterator, __last._M_iterator);
00304   }
00305   void insert_after(iterator __pos,
00306                     const value_type* __first, const value_type* __last) {
00307     _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__pos))
00308     _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
00309     _STLP_DEBUG_CHECK(_STLP_PRIV __check_ptr_range(__first, __last))
00310     _M_non_dbg_impl.insert_after(__pos._M_iterator, __first, __last);
00311   }
00312 
00313   void insert(iterator __pos, const_iterator __first, const_iterator __last) {
00314     _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
00315     _STLP_VERBOSE_ASSERT(!(__pos._M_iterator == _M_non_dbg_impl.before_begin()), _StlMsg_INVALID_ARGUMENT)
00316     _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
00317     _M_non_dbg_impl.insert(__pos._M_iterator, __first._M_iterator, __last._M_iterator);
00318   }
00319   void insert(iterator __pos, const value_type* __first,
00320                               const value_type* __last) {
00321     _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__pos))
00322     _STLP_VERBOSE_ASSERT(!(__pos._M_iterator == _M_non_dbg_impl.before_begin()), _StlMsg_INVALID_ARGUMENT)
00323     _STLP_DEBUG_CHECK(_STLP_PRIV __check_ptr_range(__first, __last))
00324     _M_non_dbg_impl.insert(__pos._M_iterator, __first, __last);
00325   }
00326 #endif
00327 
00328 #if !defined (_STLP_DONT_SUP_DFLT_PARAM)
00329   iterator insert(iterator __pos, const value_type& __x = _Tp()) {
00330 #else
00331   iterator insert(iterator __pos, const value_type& __x) {
00332 #endif /*_STLP_DONT_SUP_DFLT_PARAM*/
00333     _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
00334     _STLP_VERBOSE_ASSERT(!(__pos._M_iterator == _M_non_dbg_impl.before_begin()), _StlMsg_INVALID_ARGUMENT)
00335     return iterator(&_M_iter_list, _M_non_dbg_impl.insert(__pos._M_iterator, __x));
00336   }
00337 
00338 #if defined (_STLP_DONT_SUP_DFLT_PARAM)
00339   iterator insert(iterator __pos) {
00340     return insert(__pos, _STLP_DEFAULT_CONSTRUCTED(_Tp));
00341   }
00342 #endif /*_STLP_DONT_SUP_DFLT_PARAM*/
00343 
00344   void insert(iterator __pos, size_type __n, const value_type& __x) {
00345     _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
00346     _STLP_VERBOSE_ASSERT(!(__pos._M_iterator == _M_non_dbg_impl.before_begin()), _StlMsg_INVALID_ARGUMENT)
00347     _M_non_dbg_impl.insert(__pos._M_iterator, __n, __x);
00348   }
00349 
00350 public:
00351   iterator erase_after(iterator __pos) {
00352     _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__pos))
00353     _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__pos))
00354     iterator __tmp = __pos; ++__tmp;
00355     _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__tmp))
00356     _Invalidate_iterator(__tmp);
00357     return iterator(&_M_iter_list, _M_non_dbg_impl.erase_after(__pos._M_iterator));
00358   }
00359   iterator erase_after(iterator __before_first, iterator __last) {
00360     _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__before_first))
00361     _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__before_first, __last, begin(), end()))
00362     iterator __tmp = __before_first; ++__tmp;
00363     _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__tmp))
00364     _Invalidate_iterators(__tmp, __last);
00365     return iterator(&_M_iter_list, _M_non_dbg_impl.erase_after(__before_first._M_iterator, __last._M_iterator));
00366   }
00367 
00368   iterator erase(iterator __pos) {
00369     _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__pos))
00370     _STLP_VERBOSE_ASSERT(__pos._M_iterator != _M_non_dbg_impl.before_begin(), _StlMsg_INVALID_ARGUMENT)
00371     _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
00372     _Invalidate_iterator(__pos);
00373     return iterator(&_M_iter_list, _M_non_dbg_impl.erase(__pos._M_iterator));
00374   }
00375   iterator erase(iterator __first, iterator __last) {
00376     _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last, begin(), end()))
00377     _Invalidate_iterators(__first, __last);
00378     return iterator(&_M_iter_list, _M_non_dbg_impl.erase(__first._M_iterator, __last._M_iterator));
00379   }
00380 
00381 #if !defined(_STLP_DONT_SUP_DFLT_PARAM)
00382   void resize(size_type __new_size, const value_type& __x = _Tp()) {
00383 #else
00384   void resize(size_type __new_size, const value_type& __x) {
00385 #endif /*_STLP_DONT_SUP_DFLT_PARAM*/
00386     _M_non_dbg_impl.resize(__new_size, __x);
00387   }
00388 
00389 #if defined(_STLP_DONT_SUP_DFLT_PARAM)
00390   void resize(size_type __new_size) { resize(__new_size, _STLP_DEFAULT_CONSTRUCTED(_Tp)); }
00391 #endif /*_STLP_DONT_SUP_DFLT_PARAM*/
00392 
00393   void clear() {
00394     _Invalidate_iterators(begin(), end());
00395     _M_non_dbg_impl.clear();
00396   }
00397 
00398 public:
00399   // Removes all of the elements from the list __x to *this, inserting
00400   // them immediately after __pos.  __x must not be *this.  Complexity:
00401   // linear in __x.size().
00402   void splice_after(iterator __pos, _Self& __x) {
00403     _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__pos))
00404     _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__pos))
00405     _STLP_VERBOSE_ASSERT(!(&__x == this), _StlMsg_INVALID_ARGUMENT)
00406     _M_non_dbg_impl.splice_after(__pos._M_iterator, __x._M_non_dbg_impl);
00407     if (get_allocator() == __x.get_allocator()) {
00408       __x._M_iter_list._Set_owner(_M_iter_list);
00409     }
00410     else {
00411       __x._Invalidate_iterators(__x.begin(), __x.end());
00412     }
00413   }
00414 
00415   // Moves the element that follows __prev to *this, inserting it immediately
00416   //  after __pos.  This is constant time.
00417   void splice_after(iterator __pos, _Self& __x, iterator __prev) {
00418     _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__pos))
00419     _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
00420     _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__prev))
00421     _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&__x._M_iter_list, __prev))
00422     iterator __elem = __prev; ++__elem;
00423     _M_non_dbg_impl.splice_after(__pos._M_iterator, __x._M_non_dbg_impl, __prev._M_iterator);
00424     if (get_allocator() == __x.get_allocator()) {
00425       _STLP_PRIV __change_ite_owner(__elem, &_M_iter_list);
00426     }
00427     else {
00428       __x._Invalidate_iterator(__elem);
00429     }
00430   }
00431 
00432   // Moves the range [__before_first + 1, __before_last + 1) to *this,
00433   //  inserting it immediately after __pos.  This is constant time.
00434   void splice_after(iterator __pos, _Self& __x,
00435                     iterator __before_first, iterator __before_last) {
00436     _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__pos))
00437     _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__pos))
00438     _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__before_first, __before_last))
00439     _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&__x._M_iter_list, __before_first))
00440     _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__before_first))
00441     _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__before_last))
00442     iterator __first = __before_first; ++__first;
00443     iterator __last = __before_last; ++__last;
00444     if (get_allocator() == __x.get_allocator()) {
00445       _STLP_PRIV __change_range_owner(__first, __last, &_M_iter_list);
00446     }
00447     else {
00448       __x._Invalidate_iterators(__first, __last);
00449     }
00450     _M_non_dbg_impl.splice_after(__pos._M_iterator, __x._M_non_dbg_impl,
00451                                  __before_first._M_iterator, __before_last._M_iterator);
00452   }
00453 
00454   void splice(iterator __pos, _Self& __x) {
00455     _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__pos))
00456     _STLP_VERBOSE_ASSERT(!(__pos._M_iterator == _M_non_dbg_impl.before_begin()), _StlMsg_INVALID_ARGUMENT)
00457     _STLP_VERBOSE_ASSERT(!(&__x == this), _StlMsg_INVALID_ARGUMENT)
00458     _M_non_dbg_impl.splice(__pos._M_iterator, __x._M_non_dbg_impl);
00459     if (get_allocator() == __x.get_allocator()) {
00460       __x._M_iter_list._Set_owner(_M_iter_list);
00461     }
00462     else {
00463       __x._Invalidate_iterators(__x.begin(), __x.end());
00464     }
00465   }
00466 
00467   void splice(iterator __pos, _Self& __x, iterator __i) {
00468     //__pos should be owned by *this and not be the before_begin iterator
00469     _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__pos))
00470     _STLP_VERBOSE_ASSERT(!(__pos._M_iterator == _M_non_dbg_impl.before_begin()), _StlMsg_INVALID_ARGUMENT)
00471     //__i should be dereferenceable, not before_begin and be owned by __x
00472     _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__i))
00473     _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&__x._M_iter_list ,__i))
00474     _STLP_VERBOSE_ASSERT(!(__i == __x.before_begin()), _StlMsg_INVALID_ARGUMENT)
00475     if (get_allocator() == __x.get_allocator()) {
00476       _STLP_PRIV __change_ite_owner(__i, &_M_iter_list);
00477     }
00478     else {
00479       __x._Invalidate_iterator(__i);
00480     }
00481     _M_non_dbg_impl.splice(__pos._M_iterator, __x._M_non_dbg_impl, __i._M_iterator);
00482   }
00483 
00484   void splice(iterator __pos, _Self& __x, iterator __first, iterator __last) {
00485     _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__pos))
00486     _STLP_VERBOSE_ASSERT(!(__pos._M_iterator == _M_non_dbg_impl.before_begin()), _StlMsg_INVALID_ARGUMENT)
00487     //_STLP_VERBOSE_ASSERT(&__x != this, _StlMsg_INVALID_ARGUMENT)
00488     _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last, __x.begin(), __x.end()))
00489     if (get_allocator() == __x.get_allocator()) {
00490       _STLP_PRIV __change_range_owner(__first, __last, &_M_iter_list);
00491     }
00492     else {
00493       __x._Invalidate_iterators(__first, __last);
00494     }
00495     _M_non_dbg_impl.splice(__pos._M_iterator, __x._M_non_dbg_impl,
00496                            __first._M_iterator, __last._M_iterator);
00497   }
00498 
00499   void reverse()
00500   { _M_non_dbg_impl.reverse(); }
00501 
00502   void remove(const value_type& __val) {
00503     _Base_iterator __first = _M_non_dbg_impl.begin(), __last = _M_non_dbg_impl.end();
00504     while (__first != __last) {
00505       _Base_iterator __next = __first;
00506       ++__next;
00507       if (__val == *__first) {
00508         _Invalidate_iterator(iterator(&_M_iter_list, __first));
00509         _M_non_dbg_impl.erase(__first);
00510       }
00511       __first = __next;
00512     }
00513   }
00514   void unique() {
00515     _Base_iterator __first = _M_non_dbg_impl.begin(), __last = _M_non_dbg_impl.end();
00516     if (__first == __last) return;
00517     _Base_iterator __next = __first;
00518     while (++__next != __last) {
00519       if (*__first == *__next) {
00520         _Invalidate_iterator(iterator(&_M_iter_list, __next));
00521         _M_non_dbg_impl.erase(__next);
00522       }
00523       else
00524         __first = __next;
00525       __next = __first;
00526     }
00527   }
00528   void merge(_Self& __x) {
00529     _STLP_VERBOSE_ASSERT(&__x != this, _StlMsg_INVALID_ARGUMENT)
00530 #if !defined (_STLP_NO_EXTENSIONS)
00531     /* comments below due to bug in GCC compilers: ones eat all memory  and die if see
00532      * something like namespace_name::func_name() - ptr
00533      */
00534     _STLP_DEBUG_CHECK( /* _STLP_STD:: */ is_sorted(_M_non_dbg_impl.begin(), _M_non_dbg_impl.end()))
00535     _STLP_DEBUG_CHECK( /* _STLP_STD:: */ is_sorted(__x.begin()._M_iterator, __x.end()._M_iterator))
00536 #endif
00537     _M_non_dbg_impl.merge(__x._M_non_dbg_impl);
00538     if (get_allocator() == __x.get_allocator()) {
00539       __x._M_iter_list._Set_owner(_M_iter_list);
00540     }
00541     else {
00542       __x._Invalidate_iterators(__x.begin(), __x.end());
00543     }
00544   }
00545   void sort() {
00546     _M_non_dbg_impl.sort();
00547   }
00548 
00549 #if defined (_STLP_MEMBER_TEMPLATES)
00550   template <class _Predicate>
00551   void remove_if(_Predicate __pred) {
00552     _Base_iterator __first = _M_non_dbg_impl.begin(), __last = _M_non_dbg_impl.end();
00553     while (__first != __last) {
00554       _Base_iterator __next = __first;
00555       ++__next;
00556       if (__pred(*__first)) {
00557         _Invalidate_iterator(iterator(&_M_iter_list, __first));
00558         _M_non_dbg_impl.erase(__first);
00559       }
00560       __first = __next;
00561     }
00562   }
00563 
00564   template <class _BinaryPredicate>
00565   void unique(_BinaryPredicate __pred) {
00566     _Base_iterator __first = _M_non_dbg_impl.begin(), __last = _M_non_dbg_impl.end();
00567     if (__first == __last) return;
00568     _Base_iterator __next = __first;
00569     while (++__next != __last) {
00570       if (__binary_pred(*__first, *__next)) {
00571         _Invalidate_iterator(iterator(&_M_iter_list, __next));
00572         _M_non_dbg_impl.erase(__next);
00573       }
00574       else
00575         __first = __next;
00576       __next = __first;
00577     }
00578   }
00579 
00580   template <class _StrictWeakOrdering>
00581   void merge(_Self& __x, _StrictWeakOrdering __ord) {
00582     _STLP_VERBOSE_ASSERT(&__x != this, _StlMsg_INVALID_ARGUMENT)
00583 #if !defined (_STLP_NO_EXTENSIONS)
00584     /* comments below due to bug in GCC compilers: ones eat all memory  and die if see
00585      * something like namespace_name::func_name() - ptr
00586      */
00587     _STLP_DEBUG_CHECK( /* _STLP_STD:: */ is_sorted(_M_non_dbg_impl.begin(), _M_non_dbg_impl.end(), __ord))
00588     _STLP_DEBUG_CHECK( /* _STLP_STD:: */ is_sorted(__x.begin()._M_iterator, __x.end()._M_iterator, __ord))
00589 #endif
00590     _M_non_dbg_impl.merge(__x._M_non_dbg_impl, __ord);
00591     if (get_allocator() == __x.get_allocator()) {
00592       __x._M_iter_list._Set_owner(_M_iter_list);
00593     }
00594     else {
00595       __x._Invalidate_iterators(__x.begin(), __x.end());
00596     }
00597   }
00598 
00599   template <class _StrictWeakOrdering>
00600   void sort(_StrictWeakOrdering __comp)
00601   { _M_non_dbg_impl.sort(__comp); }
00602 #endif
00603 };
00604 
00605 _STLP_END_NAMESPACE
00606 
00607 #undef _STLP_NON_DBG_SLIST
00608 
00609 #endif /* _STLP_INTERNAL_DBG_SLIST_H */
00610 
00611 // Local Variables:
00612 // mode:C++
00613 // End:

Generated on Sun May 27 2012 04:29:30 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.