epoc32/include/tools/stlport/stl/_iterator_base.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
     1 /*
     2  *
     3  * Copyright (c) 1994
     4  * Hewlett-Packard Company
     5  *
     6  * Copyright (c) 1996-1998
     7  * Silicon Graphics Computer Systems, Inc.
     8  *
     9  * Copyright (c) 1997
    10  * Moscow Center for SPARC Technology
    11  *
    12  * Copyright (c) 1999
    13  * Boris Fomitchev
    14  *
    15  * This material is provided "as is", with absolutely no warranty expressed
    16  * or implied. Any use is at your own risk.
    17  *
    18  * Permission to use or copy this software for any purpose is hereby granted
    19  * without fee, provided the above notices are retained on all copies.
    20  * Permission to modify the code and to distribute modified code is granted,
    21  * provided the above notices are retained, and a notice that the code was
    22  * modified is included with the above copyright notice.
    23  *
    24  */
    25 
    26 /* NOTE: This is an internal header file, included by other STL headers.
    27  *   You should not attempt to use it directly.
    28  */
    29 
    30 #ifndef _STLP_INTERNAL_ITERATOR_BASE_H
    31 #define _STLP_INTERNAL_ITERATOR_BASE_H
    32 
    33 #ifndef _STLP_INTERNAL_CSTDDEF
    34 #  include <stl/_cstddef.h>
    35 #endif
    36 
    37 //# if defined  (_STLP_IMPORT_VENDOR_CSTD) && ! defined (_STLP_VENDOR_GLOBAL_CSTD)
    38 //_STLP_BEGIN_NAMESPACE
    39 //using namespace _STLP_VENDOR_CSTD;
    40 //_STLP_END_NAMESPACE
    41 //#endif /* _STLP_IMPORT_VENDOR_CSTD */
    42 
    43 #if !defined(_STLP_USE_OLD_HP_ITERATOR_QUERIES) && !defined(_STLP_CLASS_PARTIAL_SPECIALIZATION)
    44 #  ifndef _STLP_TYPE_TRAITS_H
    45 #    include <stl/type_traits.h>
    46 #  endif
    47 #endif
    48 
    49 _STLP_BEGIN_NAMESPACE
    50 
    51 struct input_iterator_tag {};
    52 struct output_iterator_tag {};
    53 struct forward_iterator_tag : public input_iterator_tag {};
    54 struct bidirectional_iterator_tag : public forward_iterator_tag {};
    55 struct random_access_iterator_tag : public bidirectional_iterator_tag {};
    56 
    57 
    58 template <class _Category, class _Tp, _STLP_DFL_TMPL_PARAM(_Distance,ptrdiff_t),
    59           _STLP_DFL_TMPL_PARAM(_Pointer,_Tp*), _STLP_DFL_TMPL_PARAM(_Reference,_Tp&) >
    60 struct iterator {
    61   typedef _Category  iterator_category;
    62   typedef _Tp        value_type;
    63   typedef _Distance  difference_type;
    64   typedef _Pointer   pointer;
    65   typedef _Reference reference;
    66 };
    67 _STLP_TEMPLATE_NULL
    68 struct iterator<output_iterator_tag, void, void, void, void> {
    69   typedef output_iterator_tag  iterator_category;
    70 #ifdef _STLP_CLASS_PARTIAL_SPECIALIZATION
    71   typedef void                value_type;
    72   typedef void                difference_type;
    73   typedef void                pointer;
    74   typedef void                reference;
    75 #endif
    76 };
    77 
    78 #if defined (_STLP_USE_OLD_HP_ITERATOR_QUERIES)
    79 #  define _STLP_ITERATOR_CATEGORY(_It, _Tp) iterator_category(_It)
    80 #  define _STLP_DISTANCE_TYPE(_It, _Tp)     distance_type(_It)
    81 #  define _STLP_VALUE_TYPE(_It, _Tp)        value_type(_It)
    82 //Old HP iterator queries do not give information about the iterator
    83 //associated reference type so we consider that it is not a real reference.
    84 #  define _STLP_IS_REF_TYPE_REAL_REF(_It, _Tp) __false_type()
    85 #else
    86 #  if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
    87 #    define _STLP_VALUE_TYPE(_It, _Tp)        (typename iterator_traits< _Tp >::value_type*)0
    88 #    define _STLP_DISTANCE_TYPE(_It, _Tp)     (typename iterator_traits< _Tp >::difference_type*)0
    89 #    if defined (__BORLANDC__) || defined (__SUNPRO_CC) || ( defined (__MWERKS__) && (__MWERKS__ <= 0x2303)) || ( defined (__sgi) && defined (_COMPILER_VERSION)) || defined (__DMC__)
    90 #      define _STLP_ITERATOR_CATEGORY(_It, _Tp) iterator_traits< _Tp >::iterator_category()
    91 #    else
    92 #      define _STLP_ITERATOR_CATEGORY(_It, _Tp) typename iterator_traits< _Tp >::iterator_category()
    93 #    endif
    94 #    define _STLP_IS_REF_TYPE_REAL_REF(_It, _Tp) _IsRefType< typename iterator_traits< _Tp >::reference >::_Ret()
    95 #  else
    96 #    define _STLP_ITERATOR_CATEGORY(_It, _Tp)   __iterator_category(_It, _IsPtrType<_Tp>::_Ret())
    97 #    define _STLP_DISTANCE_TYPE(_It, _Tp)       (ptrdiff_t*)0
    98 #    define _STLP_VALUE_TYPE(_It, _Tp)          __value_type(_It, _IsPtrType<_Tp>::_Ret() )
    99 #    define _STLP_IS_REF_TYPE_REAL_REF(_It, _Tp) __false_type()
   100 #  endif
   101 #endif
   102 
   103 template <class _Iterator>
   104 struct iterator_traits {
   105   typedef typename _Iterator::iterator_category iterator_category;
   106   typedef typename _Iterator::value_type        value_type;
   107   typedef typename _Iterator::difference_type   difference_type;
   108   typedef typename _Iterator::pointer           pointer;
   109   typedef typename _Iterator::reference         reference;
   110 };
   111 
   112 
   113 #if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) && ! defined (__SUNPRO_CC)
   114 #  define _STLP_DIFFERENCE_TYPE(_Iterator) typename iterator_traits<_Iterator>::difference_type
   115 #else
   116 #  define _STLP_DIFFERENCE_TYPE(_Iterator) ptrdiff_t
   117 #endif
   118 
   119 #ifdef _STLP_CLASS_PARTIAL_SPECIALIZATION
   120 
   121 // fbp : this order keeps gcc happy
   122 template <class _Tp>
   123 struct iterator_traits<const _Tp*> {
   124   typedef random_access_iterator_tag  iterator_category;
   125   typedef _Tp                         value_type;
   126   typedef ptrdiff_t                   difference_type;
   127   typedef const _Tp*                  pointer;
   128   typedef const _Tp&                  reference;
   129 };
   130 
   131 template <class _Tp>
   132 struct iterator_traits<_Tp*> {
   133   typedef random_access_iterator_tag  iterator_category;
   134   typedef _Tp                         value_type;
   135   typedef ptrdiff_t                   difference_type;
   136   typedef _Tp*                        pointer;
   137   typedef _Tp&                        reference;
   138 };
   139 
   140 #  if defined (__BORLANDC__)
   141 template <class _Tp>
   142 struct iterator_traits<_Tp* const> {
   143   typedef random_access_iterator_tag  iterator_category;
   144   typedef _Tp                         value_type;
   145   typedef ptrdiff_t                   difference_type;
   146   typedef const _Tp*                  pointer;
   147   typedef const _Tp&                  reference;
   148 };
   149 #  endif
   150 
   151 #endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
   152 
   153 
   154 #if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) || \
   155    (defined (_STLP_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS) && ! defined (_STLP_NO_ARROW_OPERATOR))
   156 #  define _STLP_POINTERS_SPECIALIZE( _TpP )
   157 #  define _STLP_DEFINE_ARROW_OPERATOR  pointer operator->() const { return &(operator*()); }
   158 #else
   159 #  include <stl/_ptrs_specialize.h>
   160 #endif
   161 
   162 #ifndef _STLP_USE_OLD_HP_ITERATOR_QUERIES
   163 // The overloaded functions iterator_category, distance_type, and
   164 // value_type are not part of the C++ standard.  (They have been
   165 // replaced by struct iterator_traits.)  They are included for
   166 // backward compatibility with the HP STL.
   167 // We introduce internal names for these functions.
   168 
   169 #  ifdef _STLP_CLASS_PARTIAL_SPECIALIZATION
   170 
   171 template <class _Iter>
   172 inline typename iterator_traits<_Iter>::iterator_category __iterator_category(const _Iter&) {
   173   typedef typename iterator_traits<_Iter>::iterator_category _Category;
   174   return _Category();
   175 }
   176 
   177 template <class _Iter>
   178 inline typename iterator_traits<_Iter>::difference_type* __distance_type(const _Iter&) {
   179   typedef typename iterator_traits<_Iter>::difference_type _diff_type;
   180   return __STATIC_CAST(_diff_type*,0);
   181 }
   182 
   183 template <class _Iter>
   184 inline typename iterator_traits<_Iter>::value_type* __value_type(const _Iter&) {
   185   typedef typename iterator_traits<_Iter>::value_type _value_type;
   186   return __STATIC_CAST(_value_type*,0);
   187 }
   188 
   189 #  else /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
   190 
   191 template <class _Iter>
   192 inline random_access_iterator_tag
   193 __iterator_category(const _Iter&, const __true_type&) {
   194   return random_access_iterator_tag();
   195 }
   196 
   197 template <class _Iter>
   198 inline _STLP_TYPENAME_ON_RETURN_TYPE iterator_traits<_Iter>::iterator_category
   199 __iterator_category(const _Iter&, const __false_type&) {
   200   typedef typename iterator_traits<_Iter>::iterator_category _Category;
   201   return _Category();
   202 }
   203 
   204 
   205 template <class _Iter>
   206 inline ptrdiff_t* _STLP_CALL __distance_type(const _Iter&) { return __STATIC_CAST(ptrdiff_t*, 0); }
   207 
   208 template <class _Iter>
   209 inline _STLP_TYPENAME_ON_RETURN_TYPE iterator_traits<_Iter>::value_type*
   210 __value_type(const _Iter&, const __false_type&) {
   211   typedef typename iterator_traits<_Iter>::value_type _value_type;
   212   return __STATIC_CAST(_value_type*,0);
   213 }
   214 
   215 template <class _Tp>
   216 inline _Tp*
   217 __value_type(const _Tp*, const __true_type&) {
   218   return __STATIC_CAST(_Tp*, 0);
   219 }
   220 
   221 #  endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
   222 
   223 #else /* _STLP_USE_OLD_HP_ITERATOR_QUERIES */
   224 template <class _Category, class _Tp, class _Distance, class _Pointer, class _Reference>
   225 inline _Category _STLP_CALL iterator_category(const iterator<_Category,_Tp,_Distance,_Pointer,_Reference>&) { return _Category(); }
   226 template <class _Category, class _Tp, class _Distance, class _Pointer, class _Reference>
   227 inline _Tp* _STLP_CALL value_type(const iterator<_Category,_Tp,_Distance,_Pointer,_Reference>&) { return __STATIC_CAST(_Tp*, 0); }
   228 template <class _Category, class _Tp, class _Distance, class _Pointer, class _Reference>
   229 inline _Distance* _STLP_CALL distance_type(const iterator<_Category,_Tp,_Distance,_Pointer,_Reference>&) { return __STATIC_CAST(_Distance*, 0); }
   230 template <class _Tp>
   231 inline random_access_iterator_tag _STLP_CALL iterator_category(const _Tp*) { return random_access_iterator_tag(); }
   232 template <class _Tp>
   233 inline _Tp* _STLP_CALL value_type(const _Tp*) { return __STATIC_CAST(_Tp*, 0); }
   234 template <class _Tp>
   235 inline ptrdiff_t* _STLP_CALL distance_type(const _Tp*) { return __STATIC_CAST(ptrdiff_t*, 0); }
   236 #endif /* _STLP_USE_OLD_HP_ITERATOR_QUERIES */
   237 
   238 # if ! defined (_STLP_NO_ANACHRONISMS)
   239 // The base classes input_iterator, output_iterator, forward_iterator,
   240 // bidirectional_iterator, and random_access_iterator are not part of
   241 // the C++ standard.  (They have been replaced by struct iterator.)
   242 // They are included for backward compatibility with the HP STL.
   243 template <class _Tp, class _Distance> struct input_iterator :
   244   public iterator <input_iterator_tag, _Tp, _Distance, _Tp*, _Tp&> {};
   245 struct output_iterator : public iterator <output_iterator_tag, void, void, void, void> {};
   246 template <class _Tp, class _Distance> struct forward_iterator :
   247   public iterator<forward_iterator_tag, _Tp, _Distance, _Tp*, _Tp&> {};
   248 template <class _Tp, class _Distance> struct bidirectional_iterator :
   249   public iterator<bidirectional_iterator_tag, _Tp, _Distance, _Tp*, _Tp&> {};
   250 template <class _Tp, class _Distance> struct random_access_iterator :
   251   public iterator<random_access_iterator_tag, _Tp, _Distance, _Tp*, _Tp&> {};
   252 
   253 # if defined (_STLP_BASE_MATCH_BUG) && defined (_STLP_USE_OLD_HP_ITERATOR_QUERIES)
   254 template <class _Tp, class _Distance>
   255 inline input_iterator_tag _STLP_CALL
   256 iterator_category(const input_iterator<_Tp, _Distance>&) { return input_iterator_tag(); }
   257 inline output_iterator_tag _STLP_CALL
   258 iterator_category(const output_iterator&) { return output_iterator_tag(); }
   259 template <class _Tp, class _Distance>
   260 inline forward_iterator_tag _STLP_CALL
   261 iterator_category(const forward_iterator<_Tp, _Distance>&) { return forward_iterator_tag(); }
   262 template <class _Tp, class _Distance>
   263 inline bidirectional_iterator_tag _STLP_CALL
   264 iterator_category(const bidirectional_iterator<_Tp, _Distance>&) { return bidirectional_iterator_tag(); }
   265 template <class _Tp, class _Distance>
   266 inline random_access_iterator_tag _STLP_CALL
   267 iterator_category(const random_access_iterator<_Tp, _Distance>&) { return random_access_iterator_tag(); }
   268 template <class _Tp, class _Distance>
   269 inline _Tp*  _STLP_CALL value_type(const input_iterator<_Tp, _Distance>&) { return __STATIC_CAST(_Tp*, 0); }
   270 template <class _Tp, class _Distance>
   271 inline _Tp* _STLP_CALL value_type(const forward_iterator<_Tp, _Distance>&) { return __STATIC_CAST(_Tp*, 0); }
   272 template <class _Tp, class _Distance>
   273 inline _Tp* _STLP_CALL value_type(const bidirectional_iterator<_Tp, _Distance>&) { return __STATIC_CAST(_Tp*, 0); }
   274 template <class _Tp, class _Distance>
   275 inline _Tp* _STLP_CALL value_type(const random_access_iterator<_Tp, _Distance>&) { return __STATIC_CAST(_Tp*, 0); }
   276 template <class _Tp, class _Distance>
   277 inline _Distance* _STLP_CALL distance_type(const input_iterator<_Tp, _Distance>&) { return __STATIC_CAST(_Distance*, 0); }
   278 template <class _Tp, class _Distance>
   279 inline _Distance* _STLP_CALL distance_type(const forward_iterator<_Tp, _Distance>&) { return __STATIC_CAST(_Distance*, 0); }
   280 template <class _Tp, class _Distance>
   281 inline _Distance* _STLP_CALL distance_type(const bidirectional_iterator<_Tp, _Distance>&) { return __STATIC_CAST(_Distance*, 0);}
   282 template <class _Tp, class _Distance>
   283 inline _Distance* _STLP_CALL distance_type(const random_access_iterator<_Tp, _Distance>&) { return __STATIC_CAST(_Distance*, 0); }
   284 # endif /* BASE_MATCH */
   285 
   286 #endif /* _STLP_NO_ANACHRONISMS */
   287 
   288 template <class _InputIterator, class _Distance>
   289 inline void _STLP_CALL __distance(const _InputIterator& __first, const _InputIterator& __last,
   290                                   _Distance& __n, const input_iterator_tag &) {
   291   _InputIterator __it(__first);
   292   while (__it != __last) { ++__it; ++__n; }
   293 }
   294 
   295 
   296 # if defined (_STLP_NONTEMPL_BASE_MATCH_BUG)
   297 template <class _ForwardIterator, class _Distance>
   298 inline void _STLP_CALL __distance(const _ForwardIterator& __first, const _ForwardIterator& __last,
   299                                   _Distance& __n, const forward_iterator_tag &) {
   300   _ForwardIterator __it(__first);
   301   while (__it != __last) { ++__first; ++__n; }
   302 }
   303 
   304 template <class _BidirectionalIterator, class _Distance>
   305 _STLP_INLINE_LOOP void _STLP_CALL __distance(const _BidirectionalIterator& __first,
   306                                              const _BidirectionalIterator& __last,
   307                                              _Distance& __n, const bidirectional_iterator_tag &) {
   308   _BidirectionalIterator __it(__first);
   309   while (__it != __last) { ++__it; ++__n; }
   310 }
   311 # endif
   312 
   313 template <class _RandomAccessIterator, class _Distance>
   314 inline void _STLP_CALL __distance(const _RandomAccessIterator& __first,
   315                                   const _RandomAccessIterator& __last,
   316                                   _Distance& __n, const random_access_iterator_tag &) {
   317   __n += __last - __first;
   318 }
   319 
   320 #ifndef _STLP_NO_ANACHRONISMS
   321 template <class _InputIterator, class _Distance>
   322 inline void _STLP_CALL distance(const _InputIterator& __first,
   323         const _InputIterator& __last, _Distance& __n) {
   324   __distance(__first, __last, __n, _STLP_ITERATOR_CATEGORY(__first, _InputIterator));
   325 }
   326 #endif
   327 
   328 template <class _InputIterator>
   329 inline _STLP_DIFFERENCE_TYPE(_InputIterator) _STLP_CALL
   330 __distance(const _InputIterator& __first, const _InputIterator& __last, const input_iterator_tag &) {
   331   _STLP_DIFFERENCE_TYPE(_InputIterator) __n = 0;
   332   _InputIterator __it(__first);
   333   while (__it != __last) {
   334     ++__it; ++__n;
   335   }
   336   return __n;
   337 }
   338 
   339 # if defined (_STLP_NONTEMPL_BASE_MATCH_BUG)
   340 template <class _ForwardIterator>
   341 inline _STLP_DIFFERENCE_TYPE(_ForwardIterator) _STLP_CALL
   342 __distance(const _ForwardIterator& __first, const _ForwardIterator& __last,
   343            const forward_iterator_tag &)
   344 {
   345   _STLP_DIFFERENCE_TYPE(_ForwardIterator) __n = 0;
   346   _ForwardIterator __it(__first);
   347   while (__it != __last) {
   348     ++__it; ++__n;
   349   }
   350   return __n;
   351 
   352 }
   353 
   354 template <class _BidirectionalIterator>
   355 _STLP_INLINE_LOOP _STLP_DIFFERENCE_TYPE(_BidirectionalIterator) _STLP_CALL
   356 __distance(const _BidirectionalIterator& __first,
   357            const _BidirectionalIterator& __last,
   358            const bidirectional_iterator_tag &) {
   359   _STLP_DIFFERENCE_TYPE(_BidirectionalIterator) __n = 0;
   360   _BidirectionalIterator __it(__first);
   361   while (__it != __last) {
   362     ++__it; ++__n;
   363   }
   364   return __n;
   365 }
   366 # endif
   367 
   368 template <class _RandomAccessIterator>
   369 inline _STLP_DIFFERENCE_TYPE(_RandomAccessIterator) _STLP_CALL
   370 __distance(const _RandomAccessIterator& __first, const _RandomAccessIterator& __last,
   371            const random_access_iterator_tag &) {
   372   return __last - __first;
   373 }
   374 
   375 template <class _InputIterator>
   376 inline _STLP_DIFFERENCE_TYPE(_InputIterator) _STLP_CALL
   377 distance(_InputIterator __first, _InputIterator __last) {
   378   return __distance(__first, __last, _STLP_ITERATOR_CATEGORY(__first, _InputIterator));
   379 }
   380 
   381 // fbp: those are being used for iterator/const_iterator definitions everywhere
   382 template <class _Tp>
   383 struct _Nonconst_traits;
   384 
   385 template <class _Tp>
   386 struct _Const_traits {
   387   typedef _Tp value_type;
   388   typedef const _Tp&  reference;
   389   typedef const _Tp*  pointer;
   390   typedef _Const_traits<_Tp> _ConstTraits;
   391   typedef _Nonconst_traits<_Tp> _NonConstTraits;
   392 };
   393 
   394 template <class _Tp>
   395 struct _Nonconst_traits {
   396   typedef _Tp value_type;
   397   typedef _Tp& reference;
   398   typedef _Tp* pointer;
   399   typedef _Const_traits<_Tp> _ConstTraits;
   400   typedef _Nonconst_traits<_Tp> _NonConstTraits;
   401 };
   402 
   403 /*
   404  * dums: A special iterator/const_iterator traits for set and multiset for which even
   405  * the iterator is not mutable
   406  */
   407 template <class _Tp>
   408 struct _Nonconst_Const_traits;
   409 
   410 template <class _Tp>
   411 struct _Const_Const_traits {
   412   typedef _Tp value_type;
   413   typedef const _Tp&  reference;
   414   typedef const _Tp*  pointer;
   415   typedef _Const_Const_traits<_Tp> _ConstTraits;
   416   typedef _Nonconst_Const_traits<_Tp> _NonConstTraits;
   417 };
   418 
   419 template <class _Tp>
   420 struct _Nonconst_Const_traits {
   421   typedef _Tp value_type;
   422   typedef const _Tp& reference;
   423   typedef const _Tp* pointer;
   424   typedef _Const_Const_traits<_Tp> _ConstTraits;
   425   typedef _Nonconst_Const_traits<_Tp> _NonConstTraits;
   426 };
   427 
   428 /*
   429  * A macro to generate a new iterator traits from one of the
   430  * previous one. Changing the iterator traits type make iterators
   431  * from different containers not comparable.
   432  */
   433 #define _STLP_CREATE_ITERATOR_TRAITS_BASE(Motif, Traits)        \
   434 template <class _Tp>                                            \
   435 struct _##Motif;                                                \
   436 template <class _Tp>                                            \
   437 struct _Const##Motif : public _STLP_STD::_Const_##Traits<_Tp> {  \
   438   typedef _Const##Motif<_Tp> _ConstTraits;                      \
   439   typedef _##Motif<_Tp> _NonConstTraits;                        \
   440 };                                                              \
   441 template <class _Tp>                                            \
   442 struct _##Motif : public _STLP_STD::_Nonconst_##Traits<_Tp> {    \
   443   typedef _Const##Motif<_Tp> _ConstTraits;                      \
   444   typedef _##Motif<_Tp> _NonConstTraits;                        \
   445 };
   446 
   447 #define _STLP_CREATE_ITERATOR_TRAITS(Motif, Traits)             \
   448 _STLP_MOVE_TO_PRIV_NAMESPACE                                    \
   449 _STLP_CREATE_ITERATOR_TRAITS_BASE(Motif, Traits)                \
   450 _STLP_MOVE_TO_STD_NAMESPACE
   451 
   452 #define _STLP_CREATE_HASH_ITERATOR_TRAITS(Motif, Traits)        \
   453 _STLP_MOVE_TO_PRIV_NAMESPACE                                    \
   454 _STLP_CREATE_ITERATOR_TRAITS_BASE(NonLocal##Motif, Traits)      \
   455 _STLP_CREATE_ITERATOR_TRAITS_BASE(Local##Motif, Traits)         \
   456 template <class _Tp>                                            \
   457 struct _##Motif {                                               \
   458   typedef _ConstNonLocal##Motif<_Tp> _ConstTraits;              \
   459   typedef _NonLocal##Motif<_Tp> _NonConstTraits;                \
   460   typedef _ConstLocal##Motif<_Tp> _ConstLocalTraits;            \
   461   typedef _Local##Motif<_Tp> _NonConstLocalTraits;              \
   462 };                                                              \
   463 _STLP_MOVE_TO_STD_NAMESPACE
   464 
   465 /*
   466 #  if defined (_STLP_BASE_TYPEDEF_BUG)
   467 // this workaround is needed for SunPro 4.0.1
   468 template <class _Traits>
   469 struct __cnst_traits_aux : private _Traits {
   470   typedef typename _Traits::value_type value_type;
   471 };
   472 #  define __TRAITS_VALUE_TYPE(_Traits) __cnst_traits_aux<_Traits>::value_type
   473 #  else
   474 #  define __TRAITS_VALUE_TYPE(_Traits) _Traits::value_type
   475 #  endif
   476 */
   477 
   478 #if defined (_STLP_MSVC)
   479 // MSVC specific
   480 template <class _InputIterator, class _Dist>
   481 inline void  _STLP_CALL _Distance(_InputIterator __first,
   482                                   _InputIterator __last, _Dist& __n) {
   483   __distance(__first, __last, __n, _STLP_ITERATOR_CATEGORY(__first, _InputIterator));
   484 }
   485 #endif
   486 
   487 template <class _InputIter, class _Distance>
   488 _STLP_INLINE_LOOP void  _STLP_CALL
   489 __advance(_InputIter& __i, _Distance __n, const input_iterator_tag &) {
   490   while (__n--) ++__i;
   491 }
   492 
   493 // fbp : added output iterator tag variant
   494 template <class _InputIter, class _Distance>
   495 _STLP_INLINE_LOOP void  _STLP_CALL
   496 __advance(_InputIter& __i, _Distance __n, const output_iterator_tag &) {
   497   while (__n--) ++__i;
   498 }
   499 
   500 #if defined (_STLP_NONTEMPL_BASE_MATCH_BUG)
   501 template <class _ForwardIterator, class _Distance>
   502 _STLP_INLINE_LOOP void _STLP_CALL
   503 __advance(_ForwardIterator& i, _Distance n, const forward_iterator_tag &) {
   504   while (n--) ++i;
   505 }
   506 #endif
   507 
   508 template <class _BidirectionalIterator, class _Distance>
   509 _STLP_INLINE_LOOP void _STLP_CALL
   510 __advance(_BidirectionalIterator& __i, _Distance __n,
   511           const bidirectional_iterator_tag &) {
   512   if (__n > 0)
   513     while (__n--) ++__i;
   514   else
   515     while (__n++) --__i;
   516 }
   517 
   518 template <class _RandomAccessIterator, class _Distance>
   519 inline void _STLP_CALL
   520 __advance(_RandomAccessIterator& __i, _Distance __n,
   521           const random_access_iterator_tag &) {
   522   __i += __n;
   523 }
   524 
   525 template <class _InputIterator, class _Distance>
   526 inline void _STLP_CALL advance(_InputIterator& __i, _Distance __n) {
   527   __advance(__i, __n, _STLP_ITERATOR_CATEGORY(__i, _InputIterator));
   528 }
   529 
   530 _STLP_END_NAMESPACE
   531 
   532 #if defined (_STLP_DEBUG) && !defined (_STLP_DEBUG_H)
   533 #  include <stl/debug/_debug.h>
   534 #endif
   535 
   536 #endif /* _STLP_INTERNAL_ITERATOR_BASE_H */
   537 
   538 
   539 // Local Variables:
   540 // mode:C++
   541 // End: