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

_iterator_base.h
Go to the documentation of this file.
00001 /*
00002  *
00003  * Copyright (c) 1994
00004  * Hewlett-Packard Company
00005  *
00006  * Copyright (c) 1996-1998
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_ITERATOR_BASE_H
00031 #define _STLP_INTERNAL_ITERATOR_BASE_H
00032 
00033 #ifndef _STLP_INTERNAL_CSTDDEF
00034 #  include <stl/_cstddef.h>
00035 #endif
00036 
00037 //# if defined  (_STLP_IMPORT_VENDOR_CSTD) && ! defined (_STLP_VENDOR_GLOBAL_CSTD)
00038 //_STLP_BEGIN_NAMESPACE
00039 //using namespace _STLP_VENDOR_CSTD;
00040 //_STLP_END_NAMESPACE
00041 //#endif /* _STLP_IMPORT_VENDOR_CSTD */
00042 
00043 #if !defined(_STLP_USE_OLD_HP_ITERATOR_QUERIES) && !defined(_STLP_CLASS_PARTIAL_SPECIALIZATION)
00044 #  ifndef _STLP_TYPE_TRAITS_H
00045 #    include <stl/type_traits.h>
00046 #  endif
00047 #endif
00048 
00049 _STLP_BEGIN_NAMESPACE
00050 
00051 struct input_iterator_tag {};
00052 struct output_iterator_tag {};
00053 struct forward_iterator_tag : public input_iterator_tag {};
00054 struct bidirectional_iterator_tag : public forward_iterator_tag {};
00055 struct random_access_iterator_tag : public bidirectional_iterator_tag {};
00056 
00057 template <class _Category, class _Tp, _STLP_DFL_TMPL_PARAM(_Distance,ptrdiff_t),
00058           _STLP_DFL_TMPL_PARAM(_Pointer,_Tp*), _STLP_DFL_TMPL_PARAM(_Reference,_Tp&) >
00059 struct iterator {
00060   typedef _Category  iterator_category;
00061   typedef _Tp        value_type;
00062   typedef _Distance  difference_type;
00063   typedef _Pointer   pointer;
00064   typedef _Reference reference;
00065 };
00066 _STLP_TEMPLATE_NULL
00067 struct iterator<output_iterator_tag, void, void, void, void> {
00068   typedef output_iterator_tag  iterator_category;
00069 #ifdef _STLP_CLASS_PARTIAL_SPECIALIZATION
00070   typedef void                value_type;
00071   typedef void                difference_type;
00072   typedef void                pointer;
00073   typedef void                reference;
00074 #endif
00075 };
00076 
00077 #if defined (_STLP_USE_OLD_HP_ITERATOR_QUERIES)
00078 #  define _STLP_ITERATOR_CATEGORY(_It, _Tp) _STLP_STD::iterator_category(_It)
00079 #  define _STLP_DISTANCE_TYPE(_It, _Tp)     _STLP_STD::distance_type(_It)
00080 #  define _STLP_VALUE_TYPE(_It, _Tp)        _STLP_STD::value_type(_It)
00081 //Old HP iterator queries do not give information about the iterator
00082 //associated reference type so we consider that it is not a real reference.
00083 #  define _STLP_IS_REF_TYPE_REAL_REF(_It, _Tp) __false_type()
00084 #else
00085 #  if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
00086 #    define _STLP_VALUE_TYPE(_It, _Tp)        (_STLP_TYPENAME _STLP_STD::iterator_traits< _Tp >::value_type*)0
00087 #    define _STLP_DISTANCE_TYPE(_It, _Tp)     (_STLP_TYPENAME _STLP_STD::iterator_traits< _Tp >::difference_type*)0
00088 #    if defined (__BORLANDC__) || defined (__SUNPRO_CC) || ( defined (__MWERKS__) && (__MWERKS__ <= 0x2303)) || \
00089        (defined (__sgi) && defined (_COMPILER_VERSION)) || defined (__DMC__)
00090 #      define _STLP_ITERATOR_CATEGORY(_It, _Tp) _STLP_STD::iterator_traits< _Tp >::iterator_category()
00091 #    else
00092 #      define _STLP_ITERATOR_CATEGORY(_It, _Tp) _STLP_TYPENAME _STLP_STD::iterator_traits< _Tp >::iterator_category()
00093 #    endif
00094 #    define _STLP_IS_REF_TYPE_REAL_REF(_It, _Tp) _STLP_STD::_IsRefType< _STLP_TYPENAME _STLP_STD::iterator_traits< _Tp >::reference >::_Ret()
00095 #  else
00096 #    define _STLP_ITERATOR_CATEGORY(_It, _Tp)   _STLP_STD::__iterator_category(_It, _STLP_STD::_IsPtrType<_Tp>::_Ret())
00097 #    define _STLP_DISTANCE_TYPE(_It, _Tp)       _STLP_STD::__distance_type(_It, _STLP_STD::_IsPtrType<_Tp>::_Ret())
00098 #    define _STLP_VALUE_TYPE(_It, _Tp)          _STLP_STD::__value_type(_It, _STLP_STD::_IsPtrType<_Tp>::_Ret())
00099 #    define _STLP_IS_REF_TYPE_REAL_REF(_It, _Tp) __false_type()
00100 #  endif
00101 #endif
00102 
00103 #if defined (_STLP_DONT_REDEFINE_STD) && defined (_STLP_WHOLE_NATIVE_STD)
00104 /* In this mode we will see both STLport implementation and native
00105  * one. To allow some interaction between both implementations through
00106  * iterators we have to map std iterator categories to stlport ones. This
00107  * way we will be able to initialize STLport containers with native
00108  * iterators, the other side won't work except when STLport iterators are
00109  * simple pointers. */
00110 
00111 _STLP_END_NAMESPACE
00112 
00113 #  if defined (_STLP_HAS_INCLUDE_NEXT)
00114 #    include_next <iterator>
00115 #  else
00116 #    include _STLP_NATIVE_HEADER(iterator)
00117 #  endif
00118 
00119 _STLP_BEGIN_NAMESPACE
00120 
00121 template <class _IteCat>
00122 struct _CategoryMapping
00123 { typedef _IteCat _Tag; };
00124 
00125 _STLP_TEMPLATE_NULL
00126 struct _CategoryMapping<::std::input_iterator_tag>
00127 { typedef input_iterator_tag _Tag; };
00128 _STLP_TEMPLATE_NULL
00129 struct _CategoryMapping<::std::output_iterator_tag>
00130 { typedef output_iterator_tag _Tag; };
00131 _STLP_TEMPLATE_NULL
00132 struct _CategoryMapping<::std::forward_iterator_tag>
00133 { typedef forward_iterator_tag _Tag; };
00134 _STLP_TEMPLATE_NULL
00135 struct _CategoryMapping<::std::bidirectional_iterator_tag>
00136 { typedef bidirectional_iterator_tag _Tag; };
00137 _STLP_TEMPLATE_NULL
00138 struct _CategoryMapping<::std::random_access_iterator_tag>
00139 { typedef random_access_iterator_tag _Tag; };
00140 
00141 template <class _Iterator>
00142 struct iterator_traits {
00143   typedef typename _Iterator::iterator_category _OriginalTag;
00144   typedef typename _CategoryMapping<_OriginalTag>::_Tag iterator_category;
00145 #else
00146 template <class _Iterator>
00147 struct iterator_traits {
00148   typedef typename _Iterator::iterator_category iterator_category;
00149 #endif
00150   typedef typename _Iterator::value_type        value_type;
00151   typedef typename _Iterator::difference_type   difference_type;
00152   typedef typename _Iterator::pointer           pointer;
00153   typedef typename _Iterator::reference         reference;
00154 };
00155 
00156 #if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) && !defined (__SUNPRO_CC)
00157 #  define _STLP_DIFFERENCE_TYPE(_Iterator) typename iterator_traits<_Iterator>::difference_type
00158 #else
00159 #  define _STLP_DIFFERENCE_TYPE(_Iterator) ptrdiff_t
00160 #endif
00161 
00162 #ifdef _STLP_CLASS_PARTIAL_SPECIALIZATION
00163 
00164 // fbp : this order keeps gcc happy
00165 template <class _Tp>
00166 struct iterator_traits<const _Tp*> {
00167   typedef random_access_iterator_tag  iterator_category;
00168   typedef _Tp                         value_type;
00169   typedef ptrdiff_t                   difference_type;
00170   typedef const _Tp*                  pointer;
00171   typedef const _Tp&                  reference;
00172 };
00173 
00174 template <class _Tp>
00175 struct iterator_traits<_Tp*> {
00176   typedef random_access_iterator_tag  iterator_category;
00177   typedef _Tp                         value_type;
00178   typedef ptrdiff_t                   difference_type;
00179   typedef _Tp*                        pointer;
00180   typedef _Tp&                        reference;
00181 };
00182 
00183 #  if defined (__BORLANDC__)
00184 template <class _Tp>
00185 struct iterator_traits<_Tp* const> {
00186   typedef random_access_iterator_tag  iterator_category;
00187   typedef _Tp                         value_type;
00188   typedef ptrdiff_t                   difference_type;
00189   typedef const _Tp*                  pointer;
00190   typedef const _Tp&                  reference;
00191 };
00192 #  endif
00193 
00194 #endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
00195 
00196 _STLP_END_NAMESPACE
00197 #include <stl/_ptrs_specialize.h>
00198 _STLP_BEGIN_NAMESPACE
00199 
00200 #ifndef _STLP_USE_OLD_HP_ITERATOR_QUERIES
00201 // The overloaded functions iterator_category, distance_type, and
00202 // value_type are not part of the C++ standard.  (They have been
00203 // replaced by struct iterator_traits.)  They are included for
00204 // backward compatibility with the HP STL.
00205 // We introduce internal names for these functions.
00206 
00207 #  ifndef _STLP_CLASS_PARTIAL_SPECIALIZATION
00208 
00209 template <class _Tp>
00210 inline _STLP_STD::random_access_iterator_tag
00211 __iterator_category(const _Tp*, const __true_type&)
00212 { return _STLP_STD::random_access_iterator_tag(); }
00213 
00214 template <class _Iter>
00215 inline _STLP_TYPENAME_ON_RETURN_TYPE _STLP_STD::iterator_traits<_Iter>::iterator_category
00216 __iterator_category(const _Iter&, const __false_type&) {
00217   typedef _STLP_TYPENAME _STLP_STD::iterator_traits<_Iter>::iterator_category _Category;
00218   return _Category();
00219 }
00220 
00221 template <class _Tp>
00222 inline ptrdiff_t*
00223 __distance_type(const _Tp*, const __true_type&)
00224 { return __STATIC_CAST(ptrdiff_t*, 0); }
00225 
00226 template <class _Iter>
00227 inline _STLP_TYPENAME_ON_RETURN_TYPE _STLP_STD::iterator_traits<_Iter>::difference_type*
00228 __distance_type(const _Iter&, const __false_type&) {
00229   typedef _STLP_TYPENAME _STLP_STD::iterator_traits<_Iter>::difference_type _diff_type;
00230   return __STATIC_CAST(_diff_type*,0);
00231 }
00232 
00233 template <class _Tp>
00234 inline _Tp*
00235 __value_type(const _Tp*, const __true_type&)
00236 { return __STATIC_CAST(_Tp*, 0); }
00237 
00238 template <class _Iter>
00239 inline _STLP_TYPENAME_ON_RETURN_TYPE _STLP_STD::iterator_traits<_Iter>::value_type*
00240 __value_type(const _Iter&, const __false_type&) {
00241   typedef _STLP_TYPENAME _STLP_STD::iterator_traits<_Iter>::value_type _value_type;
00242   return __STATIC_CAST(_value_type*,0);
00243 }
00244 
00245 #  endif
00246 
00247 #else /* _STLP_USE_OLD_HP_ITERATOR_QUERIES */
00248 template <class _Category, class _Tp, class _Distance, class _Pointer, class _Reference>
00249 inline _Category _STLP_CALL iterator_category(const iterator<_Category,_Tp,_Distance,_Pointer,_Reference>&) { return _Category(); }
00250 template <class _Category, class _Tp, class _Distance, class _Pointer, class _Reference>
00251 inline _Tp* _STLP_CALL value_type(const iterator<_Category,_Tp,_Distance,_Pointer,_Reference>&) { return __STATIC_CAST(_Tp*, 0); }
00252 template <class _Category, class _Tp, class _Distance, class _Pointer, class _Reference>
00253 inline _Distance* _STLP_CALL distance_type(const iterator<_Category,_Tp,_Distance,_Pointer,_Reference>&) { return __STATIC_CAST(_Distance*, 0); }
00254 template <class _Tp>
00255 inline random_access_iterator_tag _STLP_CALL iterator_category(const _Tp*) { return random_access_iterator_tag(); }
00256 template <class _Tp>
00257 inline _Tp* _STLP_CALL value_type(const _Tp*) { return __STATIC_CAST(_Tp*, 0); }
00258 template <class _Tp>
00259 inline ptrdiff_t* _STLP_CALL distance_type(const _Tp*) { return __STATIC_CAST(ptrdiff_t*, 0); }
00260 #endif /* _STLP_USE_OLD_HP_ITERATOR_QUERIES */
00261 
00262 #if !defined (_STLP_NO_ANACHRONISMS)
00263 // The base classes input_iterator, output_iterator, forward_iterator,
00264 // bidirectional_iterator, and random_access_iterator are not part of
00265 // the C++ standard.  (They have been replaced by struct iterator.)
00266 // They are included for backward compatibility with the HP STL.
00267 template <class _Tp, class _Distance> struct input_iterator :
00268   public iterator <input_iterator_tag, _Tp, _Distance, _Tp*, _Tp&> {};
00269 struct output_iterator : public iterator <output_iterator_tag, void, void, void, void> {};
00270 template <class _Tp, class _Distance> struct forward_iterator :
00271   public iterator<forward_iterator_tag, _Tp, _Distance, _Tp*, _Tp&> {};
00272 template <class _Tp, class _Distance> struct bidirectional_iterator :
00273   public iterator<bidirectional_iterator_tag, _Tp, _Distance, _Tp*, _Tp&> {};
00274 template <class _Tp, class _Distance> struct random_access_iterator :
00275   public iterator<random_access_iterator_tag, _Tp, _Distance, _Tp*, _Tp&> {};
00276 
00277 #  if defined (_STLP_BASE_MATCH_BUG) && defined (_STLP_USE_OLD_HP_ITERATOR_QUERIES)
00278 template <class _Tp, class _Distance>
00279 inline input_iterator_tag _STLP_CALL
00280 iterator_category(const input_iterator<_Tp, _Distance>&) { return input_iterator_tag(); }
00281 inline output_iterator_tag _STLP_CALL
00282 iterator_category(const output_iterator&) { return output_iterator_tag(); }
00283 template <class _Tp, class _Distance>
00284 inline forward_iterator_tag _STLP_CALL
00285 iterator_category(const forward_iterator<_Tp, _Distance>&) { return forward_iterator_tag(); }
00286 template <class _Tp, class _Distance>
00287 inline bidirectional_iterator_tag _STLP_CALL
00288 iterator_category(const bidirectional_iterator<_Tp, _Distance>&) { return bidirectional_iterator_tag(); }
00289 template <class _Tp, class _Distance>
00290 inline random_access_iterator_tag _STLP_CALL
00291 iterator_category(const random_access_iterator<_Tp, _Distance>&) { return random_access_iterator_tag(); }
00292 template <class _Tp, class _Distance>
00293 inline _Tp*  _STLP_CALL value_type(const input_iterator<_Tp, _Distance>&) { return __STATIC_CAST(_Tp*, 0); }
00294 template <class _Tp, class _Distance>
00295 inline _Tp* _STLP_CALL value_type(const forward_iterator<_Tp, _Distance>&) { return __STATIC_CAST(_Tp*, 0); }
00296 template <class _Tp, class _Distance>
00297 inline _Tp* _STLP_CALL value_type(const bidirectional_iterator<_Tp, _Distance>&) { return __STATIC_CAST(_Tp*, 0); }
00298 template <class _Tp, class _Distance>
00299 inline _Tp* _STLP_CALL value_type(const random_access_iterator<_Tp, _Distance>&) { return __STATIC_CAST(_Tp*, 0); }
00300 template <class _Tp, class _Distance>
00301 inline _Distance* _STLP_CALL distance_type(const input_iterator<_Tp, _Distance>&) { return __STATIC_CAST(_Distance*, 0); }
00302 template <class _Tp, class _Distance>
00303 inline _Distance* _STLP_CALL distance_type(const forward_iterator<_Tp, _Distance>&) { return __STATIC_CAST(_Distance*, 0); }
00304 template <class _Tp, class _Distance>
00305 inline _Distance* _STLP_CALL distance_type(const bidirectional_iterator<_Tp, _Distance>&) { return __STATIC_CAST(_Distance*, 0);}
00306 template <class _Tp, class _Distance>
00307 inline _Distance* _STLP_CALL distance_type(const random_access_iterator<_Tp, _Distance>&) { return __STATIC_CAST(_Distance*, 0); }
00308 #  endif
00309 #endif
00310 
00311 _STLP_MOVE_TO_PRIV_NAMESPACE
00312 
00313 template <class _InputIterator>
00314 inline _STLP_DIFFERENCE_TYPE(_InputIterator) _STLP_CALL
00315 __distance(const _InputIterator& __first, const _InputIterator& __last,
00316            const input_iterator_tag &) {
00317   _STLP_DIFFERENCE_TYPE(_InputIterator) __n = 0;
00318   _InputIterator __it(__first);
00319   while (__it != __last) {
00320     ++__it; ++__n;
00321   }
00322   return __n;
00323 }
00324 
00325 #if defined (_STLP_NONTEMPL_BASE_MATCH_BUG)
00326 template <class _ForwardIterator>
00327 inline _STLP_DIFFERENCE_TYPE(_ForwardIterator) _STLP_CALL
00328 __distance(const _ForwardIterator& __first, const _ForwardIterator& __last,
00329            const forward_iterator_tag &) {
00330   _STLP_DIFFERENCE_TYPE(_ForwardIterator) __n = 0;
00331   _ForwardIterator __it(__first);
00332   while (__it != __last) {
00333     ++__it; ++__n;
00334   }
00335   return __n;
00336 }
00337 
00338 template <class _BidirectionalIterator>
00339 _STLP_INLINE_LOOP _STLP_DIFFERENCE_TYPE(_BidirectionalIterator) _STLP_CALL
00340 __distance(const _BidirectionalIterator& __first, const _BidirectionalIterator& __last,
00341            const bidirectional_iterator_tag &) {
00342   _STLP_DIFFERENCE_TYPE(_BidirectionalIterator) __n = 0;
00343   _BidirectionalIterator __it(__first);
00344   while (__it != __last) {
00345     ++__it; ++__n;
00346   }
00347   return __n;
00348 }
00349 #endif
00350 
00351 template <class _RandomAccessIterator>
00352 inline _STLP_DIFFERENCE_TYPE(_RandomAccessIterator) _STLP_CALL
00353 __distance(const _RandomAccessIterator& __first, const _RandomAccessIterator& __last,
00354            const random_access_iterator_tag &)
00355 { return __last - __first; }
00356 
00357 _STLP_MOVE_TO_STD_NAMESPACE
00358 
00359 template <class _InputIterator>
00360 inline _STLP_DIFFERENCE_TYPE(_InputIterator) _STLP_CALL
00361 distance(_InputIterator __first, _InputIterator __last)
00362 { return _STLP_PRIV __distance(__first, __last, _STLP_ITERATOR_CATEGORY(__first, _InputIterator)); }
00363 
00364 #if !defined (_STLP_NO_ANACHRONISMS)
00365 template <class _InputIterator, class _Distance>
00366 inline void _STLP_CALL distance(const _InputIterator& __first,
00367                                 const _InputIterator& __last, _Distance& __n)
00368 { __n += _STLP_STD::distance(__first, __last); }
00369 
00370 #  if defined (_STLP_MSVC)
00371 // MSVC specific
00372 template <class _InputIterator, class _Dist>
00373 inline void  _STLP_CALL _Distance(_InputIterator __first,
00374                                   _InputIterator __last, _Dist& __n)
00375 { __n += _STLP_STD::distance(__first, __last); }
00376 #  endif
00377 #endif
00378 
00379 // fbp: those are being used for iterator/const_iterator definitions everywhere
00380 template <class _Tp>
00381 struct _Nonconst_traits;
00382 
00383 template <class _Tp>
00384 struct _Const_traits {
00385   typedef _Tp value_type;
00386   typedef const _Tp&  reference;
00387   typedef const _Tp*  pointer;
00388   typedef _Const_traits<_Tp> _ConstTraits;
00389   typedef _Nonconst_traits<_Tp> _NonConstTraits;
00390 };
00391 
00392 template <class _Tp>
00393 struct _Nonconst_traits {
00394   typedef _Tp value_type;
00395   typedef _Tp& reference;
00396   typedef _Tp* pointer;
00397   typedef _Const_traits<_Tp> _ConstTraits;
00398   typedef _Nonconst_traits<_Tp> _NonConstTraits;
00399 };
00400 
00401 /*
00402  * dums: A special iterator/const_iterator traits for set and multiset for which even
00403  * the iterator is not mutable
00404  */
00405 template <class _Tp>
00406 struct _Nonconst_Const_traits;
00407 
00408 template <class _Tp>
00409 struct _Const_Const_traits {
00410   typedef _Tp value_type;
00411   typedef const _Tp&  reference;
00412   typedef const _Tp*  pointer;
00413   typedef _Const_Const_traits<_Tp> _ConstTraits;
00414   typedef _Nonconst_Const_traits<_Tp> _NonConstTraits;
00415 };
00416 
00417 template <class _Tp>
00418 struct _Nonconst_Const_traits {
00419   typedef _Tp value_type;
00420   typedef const _Tp& reference;
00421   typedef const _Tp* pointer;
00422   typedef _Const_Const_traits<_Tp> _ConstTraits;
00423   typedef _Nonconst_Const_traits<_Tp> _NonConstTraits;
00424 };
00425 
00426 /*
00427  * A macro to generate a new iterator traits from one of the
00428  * previous one. Changing the iterator traits type make iterators
00429  * from different containers not comparable.
00430  */
00431 #define _STLP_CREATE_ITERATOR_TRAITS_BASE(Motif, Traits)        \
00432 template <class _Tp>                                            \
00433 struct _##Motif;                                                \
00434 template <class _Tp>                                            \
00435 struct _Const##Motif : public _STLP_STD::_Const_##Traits<_Tp> {  \
00436   typedef _Const##Motif<_Tp> _ConstTraits;                      \
00437   typedef _##Motif<_Tp> _NonConstTraits;                        \
00438 };                                                              \
00439 template <class _Tp>                                            \
00440 struct _##Motif : public _STLP_STD::_Nonconst_##Traits<_Tp> {    \
00441   typedef _Const##Motif<_Tp> _ConstTraits;                      \
00442   typedef _##Motif<_Tp> _NonConstTraits;                        \
00443 };
00444 
00445 #define _STLP_CREATE_ITERATOR_TRAITS(Motif, Traits)             \
00446 _STLP_MOVE_TO_PRIV_NAMESPACE                                    \
00447 _STLP_CREATE_ITERATOR_TRAITS_BASE(Motif, Traits)                \
00448 _STLP_MOVE_TO_STD_NAMESPACE
00449 
00450 #define _STLP_CREATE_HASH_ITERATOR_TRAITS(Motif, Traits)        \
00451 _STLP_MOVE_TO_PRIV_NAMESPACE                                    \
00452 _STLP_CREATE_ITERATOR_TRAITS_BASE(NonLocal##Motif, Traits)      \
00453 _STLP_CREATE_ITERATOR_TRAITS_BASE(Local##Motif, Traits)         \
00454 template <class _Tp>                                            \
00455 struct _##Motif {                                               \
00456   typedef _ConstNonLocal##Motif<_Tp> _ConstTraits;              \
00457   typedef _NonLocal##Motif<_Tp> _NonConstTraits;                \
00458   typedef _ConstLocal##Motif<_Tp> _ConstLocalTraits;            \
00459   typedef _Local##Motif<_Tp> _NonConstLocalTraits;              \
00460 };                                                              \
00461 _STLP_MOVE_TO_STD_NAMESPACE
00462 
00463 /*
00464 #  if defined (_STLP_BASE_TYPEDEF_BUG)
00465 // this workaround is needed for SunPro 4.0.1
00466 template <class _Traits>
00467 struct __cnst_traits_aux : private _Traits {
00468   typedef typename _Traits::value_type value_type;
00469 };
00470 #  define __TRAITS_VALUE_TYPE(_Traits) __cnst_traits_aux<_Traits>::value_type
00471 #  else
00472 #  define __TRAITS_VALUE_TYPE(_Traits) _Traits::value_type
00473 #  endif
00474 */
00475 
00476 _STLP_MOVE_TO_PRIV_NAMESPACE
00477 
00478 template <class _InputIter, class _Distance>
00479 _STLP_INLINE_LOOP void _STLP_CALL
00480 __advance(_InputIter& __i, _Distance __n, const input_iterator_tag &)
00481 { while (__n--) ++__i; }
00482 
00483 // fbp : added output iterator tag variant
00484 template <class _InputIter, class _Distance>
00485 _STLP_INLINE_LOOP void _STLP_CALL
00486 __advance(_InputIter& __i, _Distance __n, const output_iterator_tag &)
00487 { while (__n--) ++__i; }
00488 
00489 #if defined (_STLP_NONTEMPL_BASE_MATCH_BUG)
00490 template <class _ForwardIterator, class _Distance>
00491 _STLP_INLINE_LOOP void _STLP_CALL
00492 __advance(_ForwardIterator& i, _Distance n, const forward_iterator_tag &)
00493 { while (n--) ++i; }
00494 #endif
00495 
00496 template <class _BidirectionalIterator, class _Distance>
00497 _STLP_INLINE_LOOP void _STLP_CALL
00498 __advance(_BidirectionalIterator& __i, _Distance __n,
00499           const bidirectional_iterator_tag &) {
00500   if (__n > 0)
00501     while (__n--) ++__i;
00502   else
00503     while (__n++) --__i;
00504 }
00505 
00506 template <class _RandomAccessIterator, class _Distance>
00507 inline void _STLP_CALL
00508 __advance(_RandomAccessIterator& __i, _Distance __n,
00509           const random_access_iterator_tag &)
00510 { __i += __n; }
00511 
00512 _STLP_MOVE_TO_STD_NAMESPACE
00513 
00514 template <class _InputIterator, class _Distance>
00515 inline void _STLP_CALL advance(_InputIterator& __i, _Distance __n)
00516 { _STLP_PRIV __advance(__i, __n, _STLP_ITERATOR_CATEGORY(__i, _InputIterator)); }
00517 
00518 _STLP_END_NAMESPACE
00519 
00520 #endif /* _STLP_INTERNAL_ITERATOR_BASE_H */
00521 
00522 
00523 // Local Variables:
00524 // mode:C++
00525 // End:

Generated on Sun May 27 2012 04:29:11 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.