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  * Copyright (c) 2003
00003  * Francois Dumont
00004  *
00005  * This material is provided "as is", with absolutely no warranty expressed
00006  * or implied. Any use is at your own risk.
00007  *
00008  * Permission to use or copy this software for any purpose is hereby granted
00009  * without fee, provided the above notices are retained on all copies.
00010  * Permission to modify the code and to distribute modified code is granted,
00011  * provided the above notices are retained, and a notice that the code was
00012  * modified is included with the above copyright notice.
00013  *
00014  */
00015 
00016 /* NOTE: This is an internal header file, included by other STL headers.
00017  *   You should not attempt to use it directly.
00018  */
00019 
00020 #ifndef _STLP_PTR_SPECIALIZED_LIST_H
00021 #define _STLP_PTR_SPECIALIZED_LIST_H
00022 
00023 #ifndef _STLP_POINTERS_SPEC_TOOLS_H
00024 #  include <stl/pointers/_tools.h>
00025 #endif
00026 
00027 _STLP_BEGIN_NAMESPACE
00028 
00029 #define LIST_IMPL _STLP_PTR_IMPL_NAME(list)
00030 #if defined (__BORLANDC__) || defined (__DMC__)
00031 #  define typename
00032 #endif
00033 
00034 #if defined (_STLP_USE_TEMPLATE_EXPORT) && !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
00035 
00036 _STLP_MOVE_TO_PRIV_NAMESPACE
00037 
00038 _STLP_EXPORT_TEMPLATE_CLASS _List_node<void*>;
00039 
00040 _STLP_MOVE_TO_STD_NAMESPACE
00041 
00042 _STLP_EXPORT_TEMPLATE_CLASS allocator<_STLP_PRIV _List_node<void*> >;
00043 
00044 _STLP_MOVE_TO_PRIV_NAMESPACE
00045 
00046 _STLP_EXPORT_TEMPLATE_CLASS _STLP_alloc_proxy<_List_node_base, _List_node<void*>, allocator<_List_node<void*> > >;
00047 _STLP_EXPORT_TEMPLATE_CLASS _List_base<void*, allocator<void*> >;
00048 _STLP_EXPORT_TEMPLATE_CLASS LIST_IMPL<void*, allocator<void*> >;
00049 
00050 _STLP_MOVE_TO_STD_NAMESPACE
00051 #endif
00052 
00053 #if defined (_STLP_DEBUG)
00054 #  define list _STLP_NON_DBG_NAME(list)
00055 _STLP_MOVE_TO_PRIV_NAMESPACE
00056 #endif
00057 
00058 template <class _Tp, _STLP_DFL_TMPL_PARAM(_Alloc, allocator<_Tp>) >
00059 class list
00060 #if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (list)
00061            : public __stlport_class<list<_Tp, _Alloc> >
00062 #endif
00063 {
00064   typedef _STLP_TYPENAME _STLP_PRIV _StorageType<_Tp>::_Type _StorageType;
00065   typedef typename _Alloc_traits<_StorageType, _Alloc>::allocator_type _StorageTypeAlloc;
00066   typedef _STLP_PRIV LIST_IMPL<_StorageType, _StorageTypeAlloc> _Base;
00067   typedef typename _Base::iterator _BaseIte;
00068   typedef typename _Base::const_iterator _BaseConstIte;
00069   typedef _STLP_PRIV _CastTraits<_StorageType, _Tp> cast_traits;
00070   typedef list<_Tp, _Alloc> _Self;
00071 
00072 public:
00073   typedef _Tp value_type;
00074   typedef value_type* pointer;
00075   typedef const value_type* const_pointer;
00076   typedef value_type& reference;
00077   typedef const value_type& const_reference;
00078   typedef size_t size_type;
00079   typedef ptrdiff_t difference_type;
00080   _STLP_FORCE_ALLOCATORS(value_type, _Alloc)
00081   typedef typename _Alloc_traits<value_type, _Alloc>::allocator_type allocator_type;
00082   typedef bidirectional_iterator_tag _Iterator_category;
00083 
00084   typedef _STLP_PRIV _List_iterator<value_type, _Nonconst_traits<value_type> > iterator;
00085   typedef _STLP_PRIV _List_iterator<value_type, _Const_traits<value_type> >    const_iterator;
00086 
00087   _STLP_DECLARE_BIDIRECTIONAL_REVERSE_ITERATORS;
00088 
00089   allocator_type get_allocator() const
00090   { return _STLP_CONVERT_ALLOCATOR(_M_impl.get_allocator(), value_type); }
00091 
00092   explicit list(const allocator_type& __a = allocator_type())
00093     : _M_impl(_STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {}
00094 
00095 #if !defined(_STLP_DONT_SUP_DFLT_PARAM)
00096   explicit list(size_type __n, const value_type& __val = _STLP_DEFAULT_CONSTRUCTED(value_type),
00097 #else
00098   list(size_type __n, const value_type& __val,
00099 #endif /*_STLP_DONT_SUP_DFLT_PARAM*/
00100        const allocator_type& __a = allocator_type())
00101     : _M_impl(__n, cast_traits::to_storage_type_cref(__val),
00102               _STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {}
00103 
00104 #if defined(_STLP_DONT_SUP_DFLT_PARAM)
00105   explicit list(size_type __n)
00106     : _M_impl(__n) {}
00107 #endif /*_STLP_DONT_SUP_DFLT_PARAM*/
00108 
00109 #if defined (_STLP_MEMBER_TEMPLATES)
00110   template <class _InputIterator>
00111   list(_InputIterator __first, _InputIterator __last,
00112        const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL)
00113 #  if !defined (_STLP_USE_ITERATOR_WRAPPER)
00114     : _M_impl(__first, __last, _STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {}
00115 #  else
00116     : _M_impl(_STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {
00117     insert(begin(), __first, __last);
00118   }
00119 #  endif
00120 
00121 #  if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS)
00122   template <class _InputIterator>
00123   list(_InputIterator __first, _InputIterator __last)
00124 #    if !defined (_STLP_USE_WRAPPER_ITERATOR)
00125     : _M_impl(__first, __last) {}
00126 #    else
00127   { insert(begin(), __first, __last); }
00128 #    endif
00129 #  endif
00130 
00131 #else /* _STLP_MEMBER_TEMPLATES */
00132 
00133   list(const value_type *__first, const value_type *__last,
00134        const allocator_type& __a = allocator_type())
00135     : _M_impl(cast_traits::to_storage_type_cptr(__first),
00136               cast_traits::to_storage_type_cptr(__last),
00137                _STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {}
00138   list(const_iterator __first, const_iterator __last,
00139        const allocator_type& __a = allocator_type())
00140     : _M_impl(_BaseConstIte(__first._M_node), _BaseConstIte(__last._M_node),
00141               _STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {}
00142 
00143 #endif /* _STLP_MEMBER_TEMPLATES */
00144 
00145   list(const _Self& __x) : _M_impl(__x._M_impl) {}
00146 
00147 #if !defined (_STLP_NO_MOVE_SEMANTIC)
00148   list(__move_source<_Self> src)
00149     : _M_impl(__move_source<_Base>(src.get()._M_impl)) {}
00150 #endif
00151 
00152   iterator begin()             { return iterator(_M_impl.begin()._M_node); }
00153   const_iterator begin() const { return const_iterator(_M_impl.begin()._M_node); }
00154 
00155   iterator end()               { return iterator(_M_impl.end()._M_node); }
00156   const_iterator end() const   { return const_iterator(_M_impl.end()._M_node); }
00157 
00158   reverse_iterator rbegin()             { return reverse_iterator(end()); }
00159   const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); }
00160 
00161   reverse_iterator rend()               { return reverse_iterator(begin()); }
00162   const_reverse_iterator rend() const   { return const_reverse_iterator(begin()); }
00163 
00164   bool empty() const         { return _M_impl.empty(); }
00165   size_type size() const     { return _M_impl.size(); }
00166   size_type max_size() const { return _M_impl.max_size(); }
00167 
00168   reference front()             { return *begin(); }
00169   const_reference front() const { return *begin(); }
00170   reference back()              { return *(--end()); }
00171   const_reference back() const  { return *(--end()); }
00172 
00173   void swap(_Self &__x) { _M_impl.swap(__x._M_impl); }
00174 #if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
00175   void _M_swap_workaround(_Self& __x) { swap(__x); }
00176 #endif
00177   void clear() { _M_impl.clear(); }
00178 
00179 #if !defined(_STLP_DONT_SUP_DFLT_PARAM) && !defined(_STLP_NO_ANACHRONISMS)
00180   iterator insert(iterator __pos, const_reference __x = _STLP_DEFAULT_CONSTRUCTED(value_type))
00181 #else
00182   iterator insert(iterator __pos, const_reference __x)
00183 #endif 
00184   { return iterator(_M_impl.insert(_BaseIte(__pos._M_node),
00185                                    cast_traits::to_storage_type_cref(__x))._M_node); }
00186 
00187 #if defined (_STLP_MEMBER_TEMPLATES)
00188 #  if defined (_STLP_USE_ITERATOR_WRAPPER)
00189 private:
00190   template <class _Integer>
00191   void _M_insert_dispatch(iterator __pos, _Integer __n, _Integer __val,
00192                           const __true_type&)
00193   { _M_impl.insert(_BaseIte(__pos._M_node), __n, __val); }
00194 
00195   template <class _InputIterator>
00196   void _M_insert_dispatch(iterator __pos,
00197                           _InputIterator __first, _InputIterator __last,
00198                           const __false_type&) {
00199     _M_impl.insert(_BaseIte(__pos._M_node),
00200                    _STLP_TYPENAME _STLP_PRIV _IteWrapper<_StorageType, _Tp, _InputIterator>::_Ite(__first),
00201                    _STLP_TYPENAME _STLP_PRIV _IteWrapper<_StorageType, _Tp, _InputIterator>::_Ite(__last));
00202   }
00203 
00204 public:
00205 #  endif
00206 
00207   template <class _InputIterator>
00208   void insert(iterator __pos, _InputIterator __first, _InputIterator __last) {
00209 #  if defined (_STLP_USE_ITERATOR_WRAPPER)
00210     // Check whether it's an integral type.  If so, it's not an iterator.
00211     typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
00212     _M_insert_dispatch(__pos, __first, __last, _Integral());
00213 #  else
00214     _M_impl.insert(_BaseIte(__pos._M_node), __first, __last);
00215 #  endif
00216   }
00217 #else /* _STLP_MEMBER_TEMPLATES */
00218   void insert(iterator __pos, const value_type *__first, const value_type *__last)
00219   { _M_impl.insert(_BaseIte(__pos._M_node), cast_traits::to_storage_type_cptr(__first),
00220                                             cast_traits::to_storage_type_cptr(__last)); }
00221   void insert(iterator __pos, const_iterator __first, const_iterator __last)
00222   { _M_impl.insert(_BaseIte(__pos._M_node), _BaseConstIte(__first._M_node), _BaseConstIte(__last._M_node)); }
00223 #endif /* _STLP_MEMBER_TEMPLATES */
00224 
00225   void insert(iterator __pos, size_type __n, const value_type& __x)
00226   { _M_impl.insert(_BaseIte(__pos._M_node), __n, cast_traits::to_storage_type_cref(__x)); }
00227 
00228   void push_front(const value_type& __x) { _M_impl.push_front(cast_traits::to_storage_type_cref(__x)); }
00229   void push_back(const value_type& __x)  { _M_impl.push_back(cast_traits::to_storage_type_cref(__x)); }
00230 
00231 #if defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS)
00232   iterator insert(iterator __pos) { return iterator(_M_impl.insert(__pos._M_node)._M_node); }
00233   void push_front() { _M_impl.push_front();}
00234   void push_back()  { _M_impl.push_back();}
00235 # endif /*_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
00236 
00237   iterator erase(iterator __pos)
00238   { return iterator(_M_impl.erase(_BaseIte(__pos._M_node))._M_node); }
00239   iterator erase(iterator __first, iterator __last)
00240   { return iterator(_M_impl.erase(_BaseIte(__first._M_node), _BaseIte(__last._M_node))._M_node); }
00241 
00242 #if !defined(_STLP_DONT_SUP_DFLT_PARAM)
00243   void resize(size_type __new_size, const value_type& __x = _STLP_DEFAULT_CONSTRUCTED(value_type))
00244 #else
00245   void resize(size_type __new_size) { _M_impl.resize(__new_size); }
00246   void resize(size_type __new_size, const value_type& __x)
00247 #endif 
00248   {_M_impl.resize(__new_size, cast_traits::to_storage_type_cref(__x));}
00249 
00250   void pop_front() { _M_impl.pop_front(); }
00251   void pop_back()  { _M_impl.pop_back(); }
00252 
00253   _Self& operator=(const _Self& __x)
00254   { _M_impl = __x._M_impl; return *this; }
00255   void assign(size_type __n, const value_type& __val)
00256   { _M_impl.assign(__n, cast_traits::to_storage_type_cref(__val)); }
00257 
00258 #if defined (_STLP_MEMBER_TEMPLATES)
00259 #  if defined (_STLP_USE_ITERATOR_WRAPPER)
00260 private:
00261   template <class _Integer>
00262   void _M_assign_dispatch(_Integer __n, _Integer __val, const __true_type&)
00263   { _M_impl.assign(__n, __val); }
00264 
00265   template <class _InputIterator>
00266   void _M_assign_dispatch(_InputIterator __first, _InputIterator __last,
00267                           const __false_type&) {
00268     _M_impl.assign(_STLP_TYPENAME _STLP_PRIV _IteWrapper<_StorageType, _Tp, _InputIterator>::_Ite(__first),
00269                    _STLP_TYPENAME _STLP_PRIV _IteWrapper<_StorageType, _Tp, _InputIterator>::_Ite(__last));
00270   }
00271 
00272 public:
00273 #  endif
00274 
00275   template <class _InputIterator>
00276   void assign(_InputIterator __first, _InputIterator __last) {
00277 #  if defined (_STLP_USE_ITERATOR_WRAPPER)
00278     typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
00279     _M_assign_dispatch(__first, __last, _Integral());
00280 #  else
00281     _M_impl.assign(__first, __last);
00282 #  endif
00283   }
00284 #else
00285   void assign(const value_type *__first, const value_type *__last) {
00286     _M_impl.assign(cast_traits::to_storage_type_cptr(__first),
00287                    cast_traits::to_storage_type_cptr(__last));
00288   }
00289   void assign(const_iterator __first, const_iterator __last)
00290   { _M_impl.assign(_BaseConstIte(__first._M_node), _BaseConstIte(__last._M_node)); }
00291 #endif
00292 
00293   void splice(iterator __pos, _Self& __x)
00294   { _M_impl.splice(_BaseIte(__pos._M_node), __x._M_impl); }
00295   void splice(iterator __pos, _Self& __x, iterator __i)
00296   { _M_impl.splice(_BaseIte(__pos._M_node), __x._M_impl, _BaseIte(__i._M_node)); }
00297   void splice(iterator __pos, _Self& __x, iterator __first, iterator __last)
00298   { _M_impl.splice(_BaseIte(__pos._M_node), __x._M_impl,
00299                    _BaseIte(__first._M_node), _BaseIte(__last._M_node)); }
00300 
00301   void remove(const_reference __val)
00302   { _M_impl.remove(cast_traits::to_storage_type_cref(__val)); }
00303   void unique() { _M_impl.unique(); }
00304   void merge(_Self& __x) { _M_impl.merge(__x._M_impl); }
00305   void reverse() { _M_impl.reverse(); }
00306   void sort() { _M_impl.sort(); }
00307 
00308 #if defined (_STLP_MEMBER_TEMPLATES)
00309   template <class _Predicate>
00310   void remove_if(_Predicate __pred)
00311   { _M_impl.remove_if(_STLP_PRIV _UnaryPredWrapper<_StorageType, _Tp, _Predicate>(__pred)); }
00312   template <class _BinaryPredicate>
00313   void unique(_BinaryPredicate __bin_pred)
00314   { _M_impl.unique(_STLP_PRIV _BinaryPredWrapper<_StorageType, _Tp, _BinaryPredicate>(__bin_pred)); }
00315 
00316   template <class _StrictWeakOrdering>
00317   void merge(_Self &__x, _StrictWeakOrdering __comp)
00318   { _M_impl.merge(__x._M_impl, _STLP_PRIV _BinaryPredWrapper<_StorageType, _Tp, _StrictWeakOrdering>(__comp)); }
00319 
00320   template <class _StrictWeakOrdering>
00321   void sort(_StrictWeakOrdering __comp)
00322   { _M_impl.sort(_STLP_PRIV _BinaryPredWrapper<_StorageType, _Tp, _StrictWeakOrdering>(__comp)); }
00323 #endif /* _STLP_MEMBER_TEMPLATES */
00324 
00325 private:
00326   _Base _M_impl;
00327 };
00328 
00329 #if defined (list)
00330 #  undef list
00331 _STLP_MOVE_TO_STD_NAMESPACE
00332 #endif
00333 
00334 #undef LIST_IMPL
00335 #if defined (__BORLANDC__) || defined (__DMC__)
00336 #  undef typename
00337 #endif
00338 
00339 _STLP_END_NAMESPACE
00340 
00341 #endif /* _STLP_PTR_SPECIALIZED_LIST_H */
00342 
00343 // Local Variables:
00344 // mode:C++
00345 // End:

Generated on Sat May 26 2012 04:27:51 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.