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

_list.h
Go to the documentation of this file.
00001 /*
00002  *
00003  * Copyright (c) 1994
00004  * Hewlett-Packard Company
00005  *
00006  * Copyright (c) 1996,1997
00007  * Silicon Graphics Computer Systems, Inc.
00008  *
00009  * Copyright (c) 1997
00010  * Moscow Center for SPARC Technology
00011  *
00012  * Copyright (c) 1999
00013  * Boris Fomitchev
00014  *
00015  * This material is provided "as is", with absolutely no warranty expressed
00016  * or implied. Any use is at your own risk.
00017  *
00018  * Permission to use or copy this software for any purpose is hereby granted
00019  * without fee, provided the above notices are retained on all copies.
00020  * Permission to modify the code and to distribute modified code is granted,
00021  * provided the above notices are retained, and a notice that the code was
00022  * modified is included with the above copyright notice.
00023  *
00024  */
00025 
00026 /* NOTE: This is an internal header file, included by other STL headers.
00027  *   You should not attempt to use it directly.
00028  */
00029 
00030 #ifndef _STLP_INTERNAL_LIST_IMPL_H
00031 #define _STLP_INTERNAL_LIST_IMPL_H
00032 
00033 #ifndef _STLP_INTERNAL_ALGOBASE_H
00034 #  include <stl/_algobase.h>
00035 #endif
00036 
00037 #ifndef _STLP_INTERNAL_ALLOC_H
00038 #  include <stl/_alloc.h>
00039 #endif
00040 
00041 #ifndef _STLP_INTERNAL_ITERATOR_H
00042 #  include <stl/_iterator.h>
00043 #endif
00044 
00045 #ifndef _STLP_INTERNAL_CONSTRUCT_H
00046 #  include <stl/_construct.h>
00047 #endif
00048 
00049 #ifndef _STLP_INTERNAL_FUNCTION_BASE_H
00050 #  include <stl/_function_base.h>
00051 #endif
00052 
00053 _STLP_BEGIN_NAMESPACE
00054 
00055 _STLP_MOVE_TO_PRIV_NAMESPACE
00056 
00057 struct _List_node_base {
00058   _List_node_base* _M_next;
00059   _List_node_base* _M_prev;
00060 };
00061 
00062 template <class _Dummy>
00063 class _List_global {
00064 public:
00065   typedef _List_node_base _Node_base;
00066   static void  _STLP_CALL _Transfer(_Node_base* __pos,
00067                                     _Node_base* __first, _Node_base* __last);
00068 };
00069 
00070 #if defined (_STLP_USE_TEMPLATE_EXPORT)
00071 _STLP_EXPORT_TEMPLATE_CLASS _List_global<bool>;
00072 #endif
00073 typedef _List_global<bool> _List_global_inst;
00074 
00075 template <class _Tp>
00076 class _List_node : public _List_node_base {
00077 public:
00078   _Tp _M_data;
00079   __TRIVIAL_STUFF(_List_node)
00080 };
00081 
00082 struct _List_iterator_base {
00083   typedef size_t                     size_type;
00084   typedef ptrdiff_t                  difference_type;
00085   typedef bidirectional_iterator_tag iterator_category;
00086 
00087   _List_node_base* _M_node;
00088 
00089   _List_iterator_base(_List_node_base* __x) : _M_node(__x) {}
00090 
00091   void _M_incr() { _M_node = _M_node->_M_next; }
00092   void _M_decr() { _M_node = _M_node->_M_prev; }
00093 };
00094 
00095 
00096 template<class _Tp, class _Traits>
00097 struct _List_iterator : public _List_iterator_base {
00098   typedef _Tp value_type;
00099   typedef typename _Traits::pointer    pointer;
00100   typedef typename _Traits::reference  reference;
00101 
00102   typedef _List_iterator<_Tp, _Traits>         _Self;
00103   typedef typename _Traits::_NonConstTraits    _NonConstTraits;
00104   typedef _List_iterator<_Tp, _NonConstTraits> iterator;
00105   typedef typename _Traits::_ConstTraits       _ConstTraits;
00106   typedef _List_iterator<_Tp, _ConstTraits>    const_iterator;
00107 
00108   typedef bidirectional_iterator_tag iterator_category;
00109   typedef _List_node<_Tp> _Node;
00110   typedef size_t size_type;
00111   typedef ptrdiff_t difference_type;
00112 
00113   explicit _List_iterator(_List_node_base* __x) : _List_iterator_base(__x) {}
00114   _List_iterator() : _List_iterator_base(0) {}
00115   //copy constructor for iterator and constructor from iterator for const_iterator
00116   _List_iterator(const iterator& __x) :  _List_iterator_base(__x._M_node) {}
00117 
00118   reference operator*() const { return __STATIC_CAST(_Node*, this->_M_node)->_M_data; }
00119 
00120   _STLP_DEFINE_ARROW_OPERATOR
00121 
00122   _Self& operator++() {
00123     this->_M_incr();
00124     return *this;
00125   }
00126   _Self operator++(int) {
00127     _Self __tmp = *this;
00128     this->_M_incr();
00129     return __tmp;
00130   }
00131   _Self& operator--() {
00132     this->_M_decr();
00133     return *this;
00134   }
00135   _Self operator--(int) {
00136     _Self __tmp = *this;
00137     this->_M_decr();
00138     return __tmp;
00139   }
00140   bool operator==(const_iterator __y ) const {
00141     return this->_M_node == __y._M_node;
00142   }
00143   bool operator!=(const_iterator __y ) const {
00144     return this->_M_node != __y._M_node;
00145   }
00146 };
00147 
00148 #if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
00149 _STLP_MOVE_TO_STD_NAMESPACE
00150 template <class _Tp, class _Traits>
00151 struct __type_traits<_STLP_PRIV _List_iterator<_Tp, _Traits> > {
00152   typedef __false_type   has_trivial_default_constructor;
00153   typedef __true_type    has_trivial_copy_constructor;
00154   typedef __true_type    has_trivial_assignment_operator;
00155   typedef __true_type    has_trivial_destructor;
00156   typedef __false_type   is_POD_type;
00157 };
00158 _STLP_MOVE_TO_PRIV_NAMESPACE
00159 #endif
00160 
00161 #if defined (_STLP_USE_OLD_HP_ITERATOR_QUERIES)
00162 _STLP_MOVE_TO_STD_NAMESPACE
00163 template <class _Tp, class _Traits>
00164 inline _Tp* value_type(const _STLP_PRIV _List_iterator<_Tp, _Traits>&) { return 0; }
00165 inline bidirectional_iterator_tag iterator_category(const _STLP_PRIV _List_iterator_base&) { return bidirectional_iterator_tag();}
00166 inline ptrdiff_t* distance_type(const _STLP_PRIV _List_iterator_base&) { return 0; }
00167 _STLP_MOVE_TO_PRIV_NAMESPACE
00168 #endif
00169 
00170 // Base class that encapsulates details of allocators and helps
00171 // to simplify EH
00172 
00173 template <class _Tp, class _Alloc>
00174 class _List_base {
00175 protected:
00176   _STLP_FORCE_ALLOCATORS(_Tp, _Alloc)
00177   typedef _List_node_base _Node_base;
00178   typedef _List_node<_Tp> _Node;
00179   typedef _List_base<_Tp, _Alloc> _Self;
00180   typedef typename _Alloc_traits<_Node, _Alloc>::allocator_type _Node_allocator_type;
00181 public:
00182   typedef _STLP_alloc_proxy<_Node_base, _Node, _Node_allocator_type> _AllocProxy;
00183   typedef _Alloc allocator_type;
00184 
00185   allocator_type get_allocator() const
00186   { return _STLP_CONVERT_ALLOCATOR((const _Node_allocator_type&)_M_node, _Tp); }
00187 
00188   _List_base(const allocator_type& __a) : _M_node(_STLP_CONVERT_ALLOCATOR(__a, _Node), _Node_base())
00189   { _M_empty_initialize(); }
00190 
00191 #if !defined (_STLP_NO_MOVE_SEMANTIC)
00192   _List_base(__move_source<_Self> src) :
00193     _M_node(__move_source<_AllocProxy>(src.get()._M_node)) {
00194     if (src.get().empty())
00195       //We force this to empty.
00196       _M_empty_initialize();
00197     else {
00198       src.get()._M_empty_initialize();
00199       _M_node._M_data._M_prev->_M_next = _M_node._M_data._M_next->_M_prev = &_M_node._M_data;
00200     }
00201   }
00202 #endif
00203 
00204   ~_List_base()
00205   { clear(); }
00206 
00207   void clear();
00208   bool empty() const { return _M_node._M_data._M_next == &_M_node._M_data; }
00209 
00210   void _M_empty_initialize() {
00211     _M_node._M_data._M_next = &_M_node._M_data;
00212     _M_node._M_data._M_prev = _M_node._M_data._M_next;
00213   }
00214 
00215 public:
00216   _AllocProxy _M_node;
00217 };
00218 
00219 #if defined (_STLP_USE_PTR_SPECIALIZATIONS)
00220 #  define list _STLP_PTR_IMPL_NAME(list)
00221 #elif defined (_STLP_DEBUG)
00222 #  define list _STLP_NON_DBG_NAME(list)
00223 #else
00224 _STLP_MOVE_TO_STD_NAMESPACE
00225 #endif
00226 
00227 template <class _Tp, _STLP_DFL_TMPL_PARAM(_Alloc, allocator<_Tp>) >
00228 class list;
00229 
00230 #if !defined (list)
00231 _STLP_MOVE_TO_PRIV_NAMESPACE
00232 #endif
00233 
00234 // helper functions to reduce code duplication
00235 template <class _Tp, class _Alloc, class _Predicate>
00236 void _S_remove_if(list<_Tp, _Alloc>& __that, _Predicate __pred);
00237 
00238 template <class _Tp, class _Alloc, class _BinaryPredicate>
00239 void _S_unique(list<_Tp, _Alloc>& __that, _BinaryPredicate __binary_pred);
00240 
00241 template <class _Tp, class _Alloc, class _StrictWeakOrdering>
00242 void _S_merge(list<_Tp, _Alloc>& __that, list<_Tp, _Alloc>& __x,
00243               _StrictWeakOrdering __comp);
00244 
00245 template <class _Tp, class _Alloc, class _StrictWeakOrdering>
00246 void _S_sort(list<_Tp, _Alloc>& __that, _StrictWeakOrdering __comp);
00247 
00248 #if !defined (list)
00249 _STLP_MOVE_TO_STD_NAMESPACE
00250 #endif
00251 
00252 template <class _Tp, class _Alloc>
00253 class list : public _STLP_PRIV _List_base<_Tp, _Alloc>
00254 #if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (list)
00255            , public __stlport_class<list<_Tp, _Alloc> >
00256 #endif
00257 {
00258   typedef _STLP_PRIV _List_base<_Tp, _Alloc> _Base;
00259   typedef list<_Tp, _Alloc> _Self;
00260   typedef _STLP_PRIV _List_node<_Tp> _Node;
00261   typedef _STLP_PRIV _List_node_base _Node_base;
00262 public:
00263   typedef _Tp value_type;
00264   typedef value_type* pointer;
00265   typedef const value_type* const_pointer;
00266   typedef value_type& reference;
00267   typedef const value_type& const_reference;
00268   typedef size_t size_type;
00269   typedef ptrdiff_t difference_type;
00270   _STLP_FORCE_ALLOCATORS(_Tp, _Alloc)
00271   typedef typename _Base::allocator_type allocator_type;
00272   typedef bidirectional_iterator_tag _Iterator_category;
00273 
00274 public:
00275   typedef _STLP_PRIV _List_iterator<_Tp, _Nonconst_traits<_Tp> > iterator;
00276   typedef _STLP_PRIV _List_iterator<_Tp, _Const_traits<_Tp> >    const_iterator;
00277   _STLP_DECLARE_BIDIRECTIONAL_REVERSE_ITERATORS;
00278 
00279 protected:
00280 #if !defined (_STLP_DONT_SUP_DFLT_PARAM)
00281   _Node_base* _M_create_node(const_reference __x = value_type()) {
00282 #else
00283   _Node_base* _M_create_node(const_reference __x) {
00284 #endif
00285     _Node* __p = this->_M_node.allocate(1);
00286     _STLP_TRY {
00287       _Copy_Construct(&__p->_M_data, __x);
00288     }
00289     _STLP_UNWIND(this->_M_node.deallocate(__p, 1))
00290     return __p;
00291   }
00292 
00293 #if defined (_STLP_DONT_SUP_DFLT_PARAM)
00294   _Node_base* _M_create_node() {
00295     _Node* __p = this->_M_node.allocate(1);
00296     _STLP_TRY {
00297       _STLP_STD::_Construct(&__p->_M_data);
00298     }
00299     _STLP_UNWIND(this->_M_node.deallocate(__p, 1))
00300     return __p;
00301   }
00302 #endif
00303 
00304 public:
00305 #if !defined (_STLP_DONT_SUP_DFLT_PARAM)
00306   explicit list(size_type __n, const_reference __val = _STLP_DEFAULT_CONSTRUCTED(value_type),
00307                 const allocator_type& __a = allocator_type())
00308 #else
00309   explicit list(size_type __n)
00310     : _STLP_PRIV _List_base<_Tp, _Alloc>(allocator_type())
00311     { this->insert(begin(), __n, _STLP_DEFAULT_CONSTRUCTED(value_type)); }
00312   list(size_type __n, const_reference __val)
00313     : _STLP_PRIV _List_base<_Tp, _Alloc>(allocator_type())
00314     { this->insert(begin(), __n, __val); }
00315   list(size_type __n, const_reference __val, const allocator_type& __a)
00316 #endif /*_STLP_DONT_SUP_DFLT_PARAM*/
00317     : _STLP_PRIV _List_base<_Tp, _Alloc>(__a)
00318     { this->insert(begin(), __n, __val); }
00319 
00320 #if defined (_STLP_MEMBER_TEMPLATES)
00321   // We don't need any dispatching tricks here, because insert does all of
00322   // that anyway.
00323   template <class _InputIterator>
00324   list(_InputIterator __first, _InputIterator __last,
00325        const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL)
00326     : _STLP_PRIV _List_base<_Tp, _Alloc>(__a)
00327   { _M_insert(begin(), __first, __last); }
00328 
00329 #  if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS)
00330   template <class _InputIterator>
00331   list(_InputIterator __first, _InputIterator __last)
00332     : _STLP_PRIV _List_base<_Tp, _Alloc>(allocator_type())
00333   { _M_insert(begin(), __first, __last); }
00334 #  endif
00335 #else /* _STLP_MEMBER_TEMPLATES */
00336   list(const value_type* __first, const value_type* __last,
00337        const allocator_type& __a = allocator_type())
00338     : _STLP_PRIV _List_base<_Tp, _Alloc>(__a)
00339     { _M_insert(begin(), __first, __last); }
00340   list(const_iterator __first, const_iterator __last,
00341        const allocator_type& __a = allocator_type())
00342     : _STLP_PRIV _List_base<_Tp, _Alloc>(__a)
00343     { _M_insert(begin(), __first, __last); }
00344 #endif /* _STLP_MEMBER_TEMPLATES */
00345 
00346 #if !defined (_STLP_DONT_SUP_DFLT_PARAM)
00347   explicit list(const allocator_type& __a = allocator_type())
00348 #else
00349   list()
00350     : _STLP_PRIV _List_base<_Tp, _Alloc>(allocator_type()) {}
00351   list(const allocator_type& __a)
00352 #endif
00353     : _STLP_PRIV _List_base<_Tp, _Alloc>(__a) {}
00354 
00355   list(const _Self& __x) : _STLP_PRIV _List_base<_Tp, _Alloc>(__x.get_allocator())
00356   { _M_insert(begin(), __x.begin(), __x.end()); }
00357 
00358 #if !defined (_STLP_NO_MOVE_SEMANTIC)
00359   list(__move_source<_Self> src)
00360     : _STLP_PRIV _List_base<_Tp, _Alloc>(__move_source<_Base>(src.get())) {}
00361 #endif
00362 
00363   ~list() {}
00364 
00365   _Self& operator = (const _Self& __x);
00366 
00367   iterator begin()                      { return iterator(this->_M_node._M_data._M_next); }
00368   const_iterator begin() const          { return const_iterator(this->_M_node._M_data._M_next); }
00369 
00370   iterator end()                        { return iterator(&this->_M_node._M_data); }
00371   const_iterator end() const            { return const_iterator(__CONST_CAST(_Node_base*, &this->_M_node._M_data)); }
00372 
00373   reverse_iterator rbegin()             { return reverse_iterator(end()); }
00374   const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); }
00375 
00376   reverse_iterator rend()               { return reverse_iterator(begin()); }
00377   const_reverse_iterator rend() const   { return const_reverse_iterator(begin()); }
00378 
00379   size_type size() const {
00380     size_type __result = _STLP_STD::distance(begin(), end());
00381     return __result;
00382   }
00383   size_type max_size() const { return size_type(-1); }
00384 
00385   reference front()             { return *begin(); }
00386   const_reference front() const { return *begin(); }
00387   reference back()              { return *(--end()); }
00388   const_reference back() const  { return *(--end()); }
00389 
00390 private:
00391   void _M_swap_aux(_Self& __x) {
00392     __x._M_node._M_swap_alloc(this->_M_node);
00393     __x._M_node._M_data._M_next = this->_M_node._M_data._M_next;
00394     __x._M_node._M_data._M_next->_M_prev = &__x._M_node._M_data;
00395     __x._M_node._M_data._M_prev = this->_M_node._M_data._M_prev;
00396     __x._M_node._M_data._M_prev->_M_next = &__x._M_node._M_data;
00397     this->_M_empty_initialize();
00398   }
00399 
00400 public:
00401   void swap(_Self& __x) {
00402     if (__x.empty()) {
00403       if (this->empty()) {
00404         return;
00405       }
00406       this->_M_swap_aux(__x);
00407     } else if (this->empty()) {
00408       __x._M_swap_aux(*this);
00409     } else {
00410       this->_M_node.swap(__x._M_node);
00411       _STLP_STD::swap(this->_M_node._M_data._M_prev->_M_next, __x._M_node._M_data._M_prev->_M_next);
00412       _STLP_STD::swap(this->_M_node._M_data._M_next->_M_prev, __x._M_node._M_data._M_next->_M_prev);
00413     }
00414   }
00415 #if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
00416   void _M_swap_workaround(_Self& __x) { swap(__x); }
00417 #endif
00418 
00419 #if !defined(_STLP_DONT_SUP_DFLT_PARAM) && !defined(_STLP_NO_ANACHRONISMS)
00420   iterator insert(iterator __pos, const_reference __x = value_type())
00421 #else
00422   iterator insert(iterator __pos, const_reference __x)
00423 #endif 
00424   {
00425     _Node_base* __tmp = _M_create_node(__x);
00426     _Node_base* __n = __pos._M_node;
00427     _Node_base* __p = __n->_M_prev;
00428     __tmp->_M_next = __n;
00429     __tmp->_M_prev = __p;
00430     __p->_M_next = __tmp;
00431     __n->_M_prev = __tmp;
00432     return iterator(__tmp);
00433   }
00434 
00435 private:
00436 #if defined (_STLP_MEMBER_TEMPLATES)
00437   template <class _InputIterator>
00438   void _M_insert(iterator __pos, _InputIterator __first, _InputIterator __last) {
00439     typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
00440     _M_insert_dispatch(__pos, __first, __last, _Integral());
00441   }
00442 
00443   // Check whether it's an integral type.  If so, it's not an iterator.
00444   template<class _Integer>
00445   void _M_insert_dispatch(iterator __pos, _Integer __n, _Integer __x,
00446                           const __true_type& /*_IsIntegral*/) {
00447     _M_fill_insert(__pos, __n, __x);
00448   }
00449   template <class _InputIter>
00450   void _M_insert_dispatch(iterator __pos,
00451                           _InputIter __first, _InputIter __last,
00452                           const __false_type& /*_IsIntegral*/) {
00453 #else /* _STLP_MEMBER_TEMPLATES */
00454   void _M_insert(iterator __pos, const value_type* __first, const value_type* __last) {
00455     for (; __first != __last; ++__first)
00456       insert(__pos, *__first);
00457   }
00458   void _M_insert(iterator __pos, const_iterator __first, const_iterator __last) {
00459 #endif /* _STLP_MEMBER_TEMPLATES */
00460     //We use a temporary list to avoid the auto reference troubles (infinite loop)
00461     for (; __first != __last; ++__first)
00462       insert(__pos, *__first);
00463   }
00464 
00465 public:
00466 #if defined (_STLP_MEMBER_TEMPLATES)
00467   template <class _InputIterator>
00468   void insert(iterator __pos, _InputIterator __first, _InputIterator __last) {
00469     typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
00470     _M_splice_insert_dispatch(__pos, __first, __last, _Integral());
00471   }
00472 
00473 private:
00474   // Check whether it's an integral type.  If so, it's not an iterator.
00475   template<class _Integer>
00476   void _M_splice_insert_dispatch(iterator __pos, _Integer __n, _Integer __x,
00477                           const __true_type& /*_IsIntegral*/) {
00478     _M_fill_insert(__pos, __n, __x);
00479   }
00480   template <class _InputIter>
00481   void _M_splice_insert_dispatch(iterator __pos,
00482                           _InputIter __first, _InputIter __last,
00483                           const __false_type& /*_IsIntegral*/) {
00484 #else /* _STLP_MEMBER_TEMPLATES */
00485   void insert(iterator __pos, const value_type* __first, const value_type* __last) {
00486     _Self __tmp(__first, __last, this->get_allocator());
00487     _STLP_ASSERT(__tmp.get_allocator() == this->get_allocator())
00488     splice(__pos, __tmp);
00489   }
00490   void insert(iterator __pos, const_iterator __first, const_iterator __last) {
00491 #endif /* _STLP_MEMBER_TEMPLATES */
00492     //We use a temporary list to avoid the auto reference troubles (infinite loop)
00493     _Self __tmp(__first, __last, this->get_allocator());
00494     splice(__pos, __tmp);
00495   }
00496 
00497 public:
00498   void insert(iterator __pos, size_type __n, const_reference __x)
00499   { _M_fill_insert(__pos, __n, __x); }
00500 
00501 private:
00502   void _M_fill_insert(iterator __pos, size_type __n, const_reference __x) {
00503     for ( ; __n > 0; --__n)
00504       insert(__pos, __x);
00505   }
00506 
00507 public:
00508   void push_front(const_reference __x) { insert(begin(), __x); }
00509   void push_back (const_reference __x) { insert(end(), __x); }
00510 
00511 #if defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS)
00512   iterator insert(iterator __pos)
00513   { return insert(__pos, _STLP_DEFAULT_CONSTRUCTED(value_type)); }
00514   void push_front() {insert(begin());}
00515   void push_back() {insert(end());}
00516 # endif /*_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
00517 
00518   iterator erase(iterator __pos) {
00519     _Node_base* __next_node = __pos._M_node->_M_next;
00520     _Node_base* __prev_node = __pos._M_node->_M_prev;
00521     _Node* __n = __STATIC_CAST(_Node*, __pos._M_node);
00522     __prev_node->_M_next = __next_node;
00523     __next_node->_M_prev = __prev_node;
00524     _STLP_STD::_Destroy(&__n->_M_data);
00525     this->_M_node.deallocate(__n, 1);
00526     return iterator(__next_node);
00527   }
00528 
00529   iterator erase(iterator __first, iterator __last) {
00530     while (__first != __last)
00531       erase(__first++);
00532     return __last;
00533   }
00534 
00535 #if !defined (_STLP_DONT_SUP_DFLT_PARAM)
00536   void resize(size_type __new_size, const_reference __x = value_type());
00537 #else
00538   void resize(size_type __new_size, const_reference __x);
00539   void resize(size_type __new_size)
00540   { this->resize(__new_size, _STLP_DEFAULT_CONSTRUCTED(value_type)); }
00541 #endif 
00543   void pop_front() { erase(begin()); }
00544   void pop_back() {
00545     iterator __tmp = end();
00546     erase(--__tmp);
00547   }
00548 
00549 public:
00550   // assign(), a generalized assignment member function.  Two
00551   // versions: one that takes a count, and one that takes a range.
00552   // The range version is a member template, so we dispatch on whether
00553   // or not the type is an integer.
00554 
00555   void assign(size_type __n, const_reference __val) { _M_fill_assign(__n, __val); }
00556 
00557   void _M_fill_assign(size_type __n, const_reference __val);
00558 
00559 #if defined (_STLP_MEMBER_TEMPLATES)
00560   template <class _InputIterator>
00561   void assign(_InputIterator __first, _InputIterator __last) {
00562     typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
00563     _M_assign_dispatch(__first, __last, _Integral());
00564   }
00565 
00566   template <class _Integer>
00567   void _M_assign_dispatch(_Integer __n, _Integer __val,
00568                           const __true_type& /*_IsIntegral*/) {
00569     _M_fill_assign(__n, __val);
00570   }
00571 
00572   template <class _InputIterator>
00573   void _M_assign_dispatch(_InputIterator __first2, _InputIterator __last2,
00574                           const __false_type& /*_IsIntegral*/) {
00575 #else
00576   void assign(const value_type *__first2, const value_type *__last2) {
00577     iterator __first1 = begin();
00578     iterator __last1 = end();
00579     for ( ; __first1 != __last1 && __first2 != __last2; ++__first1, ++__first2)
00580       *__first1 = *__first2;
00581     if (__first2 == __last2)
00582       erase(__first1, __last1);
00583     else
00584       insert(__last1, __first2, __last2);
00585   }
00586   void assign(const_iterator __first2, const_iterator __last2) {
00587 #endif /* _STLP_MEMBER_TEMPLATES */
00588     iterator __first1 = begin();
00589     iterator __last1 = end();
00590     for ( ; __first1 != __last1 && __first2 != __last2; ++__first1, ++__first2)
00591       *__first1 = *__first2;
00592     if (__first2 == __last2)
00593       erase(__first1, __last1);
00594     else
00595       insert(__last1, __first2, __last2);
00596   }
00597 
00598 public:
00599   void splice(iterator __pos, _Self& __x) {
00600     if (!__x.empty()) {
00601       if (this->get_allocator() == __x.get_allocator()) {
00602         _STLP_PRIV _List_global_inst::_Transfer(__pos._M_node, __x.begin()._M_node, __x.end()._M_node);
00603       }
00604       else {
00605         insert(__pos, __x.begin(), __x.end());
00606         __x.clear();
00607       }
00608     }
00609   }
00610   void splice(iterator __pos, _Self& __x, iterator __i) {
00611     iterator __j = __i;
00612     ++__j;
00613     if (__pos == __i || __pos == __j) return;
00614     if (this->get_allocator() == __x.get_allocator()) {
00615       _STLP_PRIV _List_global_inst::_Transfer(__pos._M_node, __i._M_node, __j._M_node);
00616     }
00617     else {
00618       insert(__pos, *__i);
00619       __x.erase(__i);
00620     }
00621   }
00622   void splice(iterator __pos, _Self& __x, iterator __first, iterator __last) {
00623     if (__first != __last) {
00624       if (this->get_allocator() == __x.get_allocator()) {
00625         _STLP_PRIV _List_global_inst::_Transfer(__pos._M_node, __first._M_node, __last._M_node);
00626       }
00627       else {
00628         insert(__pos, __first, __last);
00629         __x.erase(__first, __last);
00630       }
00631     }
00632   }
00633 
00634   void remove(const_reference __val) {
00635     iterator __first = begin();
00636     iterator __last = end();
00637     while (__first != __last) {
00638       iterator __next = __first;
00639       ++__next;
00640       if (__val == *__first) erase(__first);
00641       __first = __next;
00642     }
00643   }
00644 
00645   void unique()
00646   { _STLP_PRIV _S_unique(*this, equal_to<value_type>()); }
00647 
00648   void merge(_Self& __x)
00649   { _STLP_PRIV _S_merge(*this, __x, less<value_type>()); }
00650 
00651   void reverse() {
00652     _Node_base* __p = &this->_M_node._M_data;
00653     _Node_base* __tmp = __p;
00654     do {
00655       _STLP_STD::swap(__tmp->_M_next, __tmp->_M_prev);
00656       __tmp = __tmp->_M_prev;     // Old next node is now prev.
00657     } while (__tmp != __p);
00658   }
00659 
00660   void sort()
00661   { _STLP_PRIV _S_sort(*this, less<value_type>()); }
00662 
00663 #if defined (_STLP_MEMBER_TEMPLATES)
00664   template <class _Predicate>
00665   void remove_if(_Predicate __pred)
00666   { _STLP_PRIV _S_remove_if(*this, __pred); }
00667   template <class _BinaryPredicate>
00668   void unique(_BinaryPredicate __binary_pred)
00669   { _STLP_PRIV _S_unique(*this, __binary_pred); }
00670 
00671   template <class _StrictWeakOrdering>
00672   void merge(_Self& __x,
00673              _StrictWeakOrdering __comp) {
00674     _STLP_PRIV _S_merge(*this, __x, __comp);
00675   }
00676 
00677   template <class _StrictWeakOrdering>
00678   void sort(_StrictWeakOrdering __comp)
00679   { _STLP_PRIV _S_sort(*this, __comp); }
00680 #endif /* _STLP_MEMBER_TEMPLATES */
00681 };
00682 
00683 #if defined (list)
00684 #  undef list
00685 _STLP_MOVE_TO_STD_NAMESPACE
00686 #endif
00687 
00688 _STLP_END_NAMESPACE
00689 
00690 #if !defined (_STLP_LINK_TIME_INSTANTIATION)
00691 #  include <stl/_list.c>
00692 #endif
00693 
00694 #if defined (_STLP_USE_PTR_SPECIALIZATIONS)
00695 #  include <stl/pointers/_list.h>
00696 #endif
00697 
00698 #if defined (_STLP_DEBUG)
00699 #  include <stl/debug/_list.h>
00700 #endif
00701 
00702 _STLP_BEGIN_NAMESPACE
00703 
00704 template <class _Tp, class _Alloc>
00705 _STLP_INLINE_LOOP bool  _STLP_CALL
00706 operator==(const list<_Tp,_Alloc>& __x, const list<_Tp,_Alloc>& __y) {
00707   typedef typename list<_Tp,_Alloc>::const_iterator const_iterator;
00708   const_iterator __end1 = __x.end();
00709   const_iterator __end2 = __y.end();
00710 
00711   const_iterator __i1 = __x.begin();
00712   const_iterator __i2 = __y.begin();
00713   while (__i1 != __end1 && __i2 != __end2 && *__i1 == *__i2) {
00714     ++__i1;
00715     ++__i2;
00716   }
00717   return __i1 == __end1 && __i2 == __end2;
00718 }
00719 
00720 #define _STLP_EQUAL_OPERATOR_SPECIALIZED
00721 #define _STLP_TEMPLATE_HEADER    template <class _Tp, class _Alloc>
00722 #define _STLP_TEMPLATE_CONTAINER list<_Tp, _Alloc>
00723 #include <stl/_relops_cont.h>
00724 #undef _STLP_TEMPLATE_CONTAINER
00725 #undef _STLP_TEMPLATE_HEADER
00726 #undef _STLP_EQUAL_OPERATOR_SPECIALIZED
00727 
00728 #if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) && !defined (_STLP_NO_MOVE_SEMANTIC)
00729 template <class _Tp, class _Alloc>
00730 struct __move_traits<list<_Tp, _Alloc> > {
00731   typedef __true_type implemented;
00732   typedef typename __move_traits<_Alloc>::complete complete;
00733 };
00734 #endif
00735 
00736 _STLP_END_NAMESPACE
00737 
00738 #endif /* _STLP_INTERNAL_LIST_IMPL_H */
00739 
00740 // Local Variables:
00741 // mode:C++
00742 // End:

Generated on Fri May 25 2012 04:27:47 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.