epoc32/include/stdapis/stlport/stl/_iterator_base.h
branchSymbian3
changeset 4 837f303aceeb
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/epoc32/include/stdapis/stlport/stl/_iterator_base.h	Wed Mar 31 12:33:34 2010 +0100
     1.3 @@ -0,0 +1,463 @@
     1.4 +/*
     1.5 + *
     1.6 + * Copyright (c) 1994
     1.7 + * Hewlett-Packard Company
     1.8 + *
     1.9 + * Copyright (c) 1996-1998
    1.10 + * Silicon Graphics Computer Systems, Inc.
    1.11 + *
    1.12 + * Copyright (c) 1997
    1.13 + * Moscow Center for SPARC Technology
    1.14 + *
    1.15 + * Copyright (c) 1999 
    1.16 + * Boris Fomitchev
    1.17 + *
    1.18 + * This material is provided "as is", with absolutely no warranty expressed
    1.19 + * or implied. Any use is at your own risk.
    1.20 + *
    1.21 + * Permission to use or copy this software for any purpose is hereby granted 
    1.22 + * without fee, provided the above notices are retained on all copies.
    1.23 + * Permission to modify the code and to distribute modified code is granted,
    1.24 + * provided the above notices are retained, and a notice that the code was
    1.25 + * modified is included with the above copyright notice.
    1.26 + *
    1.27 + */
    1.28 +
    1.29 +/* NOTE: This is an internal header file, included by other STL headers.
    1.30 + *   You should not attempt to use it directly.
    1.31 + */
    1.32 +
    1.33 +#ifndef _STLP_INTERNAL_ITERATOR_BASE_H
    1.34 +#define _STLP_INTERNAL_ITERATOR_BASE_H
    1.35 +
    1.36 +#ifndef _STLP_CSTDDEF
    1.37 +# include <cstddef>
    1.38 +#endif
    1.39 +
    1.40 +# if defined  (_STLP_IMPORT_VENDOR_CSTD) && ! defined (_STLP_VENDOR_GLOBAL_CSTD)
    1.41 +_STLP_BEGIN_NAMESPACE  
    1.42 +using namespace _STLP_VENDOR_CSTD;
    1.43 +_STLP_END_NAMESPACE
    1.44 +#endif /* _STLP_IMPORT_VENDOR_CSTD */
    1.45 +
    1.46 +#ifndef __TYPE_TRAITS_H
    1.47 +# include <stl/type_traits.h>
    1.48 +#endif
    1.49 +
    1.50 +_STLP_BEGIN_NAMESPACE
    1.51 +
    1.52 +struct input_iterator_tag {};
    1.53 +struct output_iterator_tag {};
    1.54 +struct forward_iterator_tag : public input_iterator_tag {};
    1.55 +struct bidirectional_iterator_tag : public forward_iterator_tag {};
    1.56 +struct random_access_iterator_tag : public bidirectional_iterator_tag {};
    1.57 +
    1.58 +
    1.59 +template <class _Category, class _Tp, __DFL_TMPL_PARAM(_Distance,ptrdiff_t),
    1.60 +          __DFL_TMPL_PARAM(_Pointer,_Tp*), __DFL_TMPL_PARAM(_Reference,_Tp&) >
    1.61 +struct iterator {
    1.62 +  typedef _Category  iterator_category;
    1.63 +  typedef _Tp        value_type;
    1.64 +  typedef _Distance  difference_type;
    1.65 +  typedef _Pointer   pointer;
    1.66 +  typedef _Reference reference;
    1.67 +};
    1.68 +_STLP_TEMPLATE_NULL
    1.69 +struct iterator<output_iterator_tag, void, void, void, void> {
    1.70 +  typedef output_iterator_tag  iterator_category;
    1.71 +#ifdef _STLP_CLASS_PARTIAL_SPECIALIZATION
    1.72 +  typedef void                value_type;
    1.73 +  typedef void                difference_type;
    1.74 +  typedef void                pointer;
    1.75 +  typedef void                reference;
    1.76 +#endif
    1.77 +};
    1.78 +
    1.79 +# ifdef _STLP_USE_OLD_HP_ITERATOR_QUERIES
    1.80 +#  define _STLP_ITERATOR_CATEGORY(_It, _Tp) iterator_category(_It)
    1.81 +#  define _STLP_DISTANCE_TYPE(_It, _Tp)     distance_type(_It)
    1.82 +#  define _STLP_VALUE_TYPE(_It, _Tp)        value_type(_It)
    1.83 +# else
    1.84 +#  ifdef _STLP_CLASS_PARTIAL_SPECIALIZATION
    1.85 +#   define _STLP_VALUE_TYPE(_It, _Tp)        (typename iterator_traits< _Tp >::value_type*)0
    1.86 +#   define _STLP_DISTANCE_TYPE(_It, _Tp)     (typename iterator_traits< _Tp >::difference_type*)0
    1.87 +#   if defined (__BORLANDC__) || defined (__SUNPRO_CC) || ( defined (__MWERKS__) && (__MWERKS__ <= 0x2303)) || ( defined (__sgi) && defined (_COMPILER_VERSION)) || defined (__DMC__)
    1.88 +#    define _STLP_ITERATOR_CATEGORY(_It, _Tp) iterator_traits< _Tp >::iterator_category()
    1.89 +#   else
    1.90 +#    define _STLP_ITERATOR_CATEGORY(_It, _Tp) typename iterator_traits< _Tp >::iterator_category()
    1.91 +#   endif
    1.92 +#  else
    1.93 +#   define _STLP_ITERATOR_CATEGORY(_It, _Tp) __iterator_category(_It, _IsPtrType<_Tp>::_Ret())
    1.94 +#   define _STLP_DISTANCE_TYPE(_It, _Tp)     (ptrdiff_t*)0
    1.95 +#   define _STLP_VALUE_TYPE(_It, _Tp)        __value_type(_It, _IsPtrType<_Tp>::_Ret() )
    1.96 +#  endif
    1.97 +# endif
    1.98 +
    1.99 +template <class _Iterator>
   1.100 +struct iterator_traits {
   1.101 +  typedef typename _Iterator::iterator_category iterator_category;
   1.102 +  typedef typename _Iterator::value_type        value_type;
   1.103 +  typedef typename _Iterator::difference_type   difference_type;
   1.104 +  typedef typename _Iterator::pointer           pointer;
   1.105 +  typedef typename _Iterator::reference         reference;
   1.106 +};
   1.107 +
   1.108 +
   1.109 +# if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) && ! defined (__SUNPRO_CC)
   1.110 +#  define _STLP_DIFFERENCE_TYPE(_Iterator) typename iterator_traits<_Iterator>::difference_type
   1.111 +# else
   1.112 +#  define _STLP_DIFFERENCE_TYPE(_Iterator) ptrdiff_t
   1.113 +# endif
   1.114 +
   1.115 +# ifdef _STLP_CLASS_PARTIAL_SPECIALIZATION
   1.116 +
   1.117 +// fbp : this order keeps gcc happy
   1.118 +template <class _Tp>
   1.119 +struct iterator_traits<const _Tp*> {
   1.120 +  typedef random_access_iterator_tag iterator_category;
   1.121 +  typedef _Tp                         value_type;
   1.122 +  typedef ptrdiff_t                   difference_type;
   1.123 +  typedef const _Tp*                  pointer;
   1.124 +  typedef const _Tp&                  reference;
   1.125 +};
   1.126 +
   1.127 +template <class _Tp>
   1.128 +struct iterator_traits<_Tp*> {
   1.129 +  typedef random_access_iterator_tag iterator_category;
   1.130 +  typedef _Tp                         value_type;
   1.131 +  typedef ptrdiff_t                   difference_type;
   1.132 +  typedef _Tp*                        pointer;
   1.133 +  typedef _Tp&                        reference;
   1.134 +};
   1.135 +
   1.136 +#  if defined (__BORLANDC__)
   1.137 +template <class _Tp>
   1.138 +struct iterator_traits<_Tp* const> {
   1.139 +  typedef random_access_iterator_tag iterator_category;
   1.140 +  typedef _Tp                         value_type;
   1.141 +  typedef ptrdiff_t                   difference_type;
   1.142 +  typedef const _Tp*                  pointer;
   1.143 +  typedef const _Tp&                  reference;
   1.144 +};
   1.145 +#  endif
   1.146 +
   1.147 +# endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
   1.148 +
   1.149 +
   1.150 +# if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) \
   1.151 +  || (defined (_STLP_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS) && ! defined (_STLP_NO_ARROW_OPERATOR))
   1.152 +#  define _STLP_POINTERS_SPECIALIZE( _TpP )
   1.153 +#  define _STLP_DEFINE_ARROW_OPERATOR  pointer operator->() const { return &(operator*()); }
   1.154 +# else 
   1.155 +#  include <stl/_ptrs_specialize.h>
   1.156 +# endif
   1.157 +
   1.158 +# ifndef _STLP_USE_OLD_HP_ITERATOR_QUERIES
   1.159 +// The overloaded functions iterator_category, distance_type, and
   1.160 +// value_type are not part of the C++ standard.  (They have been
   1.161 +// replaced by struct iterator_traits.)  They are included for
   1.162 +// backward compatibility with the HP STL.
   1.163 +// We introduce internal names for these functions.
   1.164 +
   1.165 +#  ifdef  _STLP_CLASS_PARTIAL_SPECIALIZATION
   1.166 +
   1.167 +template <class _Iter>
   1.168 +inline typename iterator_traits<_Iter>::iterator_category __iterator_category(const _Iter&) {
   1.169 +  typedef typename iterator_traits<_Iter>::iterator_category _Category;
   1.170 +  return _Category();
   1.171 +}
   1.172 +
   1.173 +template <class _Iter>
   1.174 +inline typename iterator_traits<_Iter>::difference_type* __distance_type(const _Iter&) {
   1.175 +  typedef typename iterator_traits<_Iter>::difference_type _diff_type;
   1.176 +  return __STATIC_CAST(_diff_type*,0);
   1.177 +}
   1.178 +
   1.179 +template <class _Iter>
   1.180 +inline typename iterator_traits<_Iter>::value_type* __value_type(const _Iter&) {
   1.181 +  typedef typename iterator_traits<_Iter>::value_type _value_type;
   1.182 +  return __STATIC_CAST(_value_type*,0);
   1.183 +}
   1.184 +
   1.185 +# else
   1.186 +
   1.187 +template <class _Iter>
   1.188 +inline random_access_iterator_tag 
   1.189 +__iterator_category(const _Iter&, const __true_type&) {
   1.190 +  return random_access_iterator_tag();
   1.191 +}
   1.192 +
   1.193 +template <class _Iter>
   1.194 +inline _STLP_TYPENAME_ON_RETURN_TYPE iterator_traits<_Iter>::iterator_category
   1.195 +__iterator_category(const _Iter&, const __false_type&) {
   1.196 +  typedef typename iterator_traits<_Iter>::iterator_category _Category;
   1.197 +  return _Category();
   1.198 +}
   1.199 +
   1.200 +
   1.201 +template <class _Iter>
   1.202 +inline ptrdiff_t* _STLP_CALL __distance_type(const _Iter&) { return (ptrdiff_t*)(0); }
   1.203 +
   1.204 +template <class _Iter>
   1.205 +inline _STLP_TYPENAME_ON_RETURN_TYPE iterator_traits<_Iter>::value_type* 
   1.206 +__value_type(const _Iter&, const __false_type&) {
   1.207 +  typedef typename iterator_traits<_Iter>::value_type _value_type;
   1.208 +  return __STATIC_CAST(_value_type*,0);
   1.209 +}
   1.210 +
   1.211 +template <class _Tp>
   1.212 +inline _Tp*  
   1.213 +__value_type(const _Tp*, const __true_type&) {
   1.214 +  return __STATIC_CAST(_Tp*, 0);
   1.215 +}
   1.216 +
   1.217 +# endif
   1.218 +
   1.219 +#else /* old queries */
   1.220 +template <class _Category, class _Tp, class _Distance, class _Pointer, class _Reference>
   1.221 +inline _Category _STLP_CALL iterator_category(const iterator<_Category,_Tp,_Distance,_Pointer,_Reference>&) { return _Category(); }
   1.222 +template <class _Category, class _Tp, class _Distance, class _Pointer, class _Reference>
   1.223 +inline _Tp* _STLP_CALL value_type(const iterator<_Category,_Tp,_Distance,_Pointer,_Reference>&) { return (_Tp*)(0); }
   1.224 +template <class _Category, class _Tp, class _Distance, class _Pointer, class _Reference>
   1.225 +inline _Distance* _STLP_CALL distance_type(const iterator<_Category,_Tp,_Distance,_Pointer,_Reference>&) { return (_Distance*)(0); }
   1.226 +template <class _Tp>
   1.227 +inline random_access_iterator_tag _STLP_CALL iterator_category(const _Tp*) { return random_access_iterator_tag(); }
   1.228 +template <class _Tp>
   1.229 +inline _Tp* _STLP_CALL value_type(const _Tp*) { return (_Tp*)(0); }
   1.230 +template <class _Tp>
   1.231 +inline ptrdiff_t* _STLP_CALL distance_type(const _Tp*) { return (ptrdiff_t*)(0); }
   1.232 +#endif /* _STLP_USE_OLD_HP_ITERATOR_QUERIES */
   1.233 +
   1.234 +# if ! defined (_STLP_NO_ANACHRONISMS)
   1.235 +// The base classes input_iterator, output_iterator, forward_iterator,
   1.236 +// bidirectional_iterator, and random_access_iterator are not part of
   1.237 +// the C++ standard.  (They have been replaced by struct iterator.)
   1.238 +// They are included for backward compatibility with the HP STL.
   1.239 +template <class _Tp, class _Distance> struct input_iterator : 
   1.240 +  public iterator <input_iterator_tag, _Tp, _Distance, _Tp*, _Tp&> {};
   1.241 +struct output_iterator : public iterator <output_iterator_tag, void, void, void, void> {};
   1.242 +template <class _Tp, class _Distance> struct forward_iterator :
   1.243 +  public iterator<forward_iterator_tag, _Tp, _Distance, _Tp*, _Tp&> {};
   1.244 +template <class _Tp, class _Distance> struct bidirectional_iterator :
   1.245 +  public iterator<bidirectional_iterator_tag, _Tp, _Distance, _Tp*, _Tp&> {};
   1.246 +template <class _Tp, class _Distance> struct random_access_iterator :
   1.247 +  public iterator<random_access_iterator_tag, _Tp, _Distance, _Tp*, _Tp&> {};
   1.248 +
   1.249 +# if defined (_STLP_BASE_MATCH_BUG) && defined (_STLP_USE_OLD_HP_ITERATOR_QUERIES)
   1.250 +template <class _Tp, class _Distance> 
   1.251 +inline input_iterator_tag _STLP_CALL 
   1.252 +iterator_category(const input_iterator<_Tp, _Distance>&) { return input_iterator_tag(); }
   1.253 +inline output_iterator_tag _STLP_CALL
   1.254 +iterator_category(const output_iterator&) { return output_iterator_tag(); }
   1.255 +template <class _Tp, class _Distance> 
   1.256 +inline forward_iterator_tag _STLP_CALL
   1.257 +iterator_category(const forward_iterator<_Tp, _Distance>&) { return forward_iterator_tag(); }
   1.258 +template <class _Tp, class _Distance> 
   1.259 +inline bidirectional_iterator_tag _STLP_CALL 
   1.260 +iterator_category(const bidirectional_iterator<_Tp, _Distance>&) { return bidirectional_iterator_tag(); }
   1.261 +template <class _Tp, class _Distance> 
   1.262 +inline random_access_iterator_tag _STLP_CALL
   1.263 +iterator_category(const random_access_iterator<_Tp, _Distance>&) { return random_access_iterator_tag(); }
   1.264 +template <class _Tp, class _Distance> 
   1.265 +inline _Tp*  _STLP_CALL value_type(const input_iterator<_Tp, _Distance>&) { return (_Tp*)(0); }
   1.266 +template <class _Tp, class _Distance> 
   1.267 +inline _Tp* _STLP_CALL value_type(const forward_iterator<_Tp, _Distance>&) { return (_Tp*)(0); }
   1.268 +template <class _Tp, class _Distance> 
   1.269 +inline _Tp* _STLP_CALL value_type(const bidirectional_iterator<_Tp, _Distance>&) { return (_Tp*)(0); }
   1.270 +template <class _Tp, class _Distance> 
   1.271 +inline _Tp* _STLP_CALL value_type(const random_access_iterator<_Tp, _Distance>&) { return (_Tp*)(0); }
   1.272 +template <class _Tp, class _Distance> 
   1.273 +inline _Distance* _STLP_CALL distance_type(const input_iterator<_Tp, _Distance>&) { return (_Distance*)(0); }
   1.274 +template <class _Tp, class _Distance> 
   1.275 +inline _Distance* _STLP_CALL distance_type(const forward_iterator<_Tp, _Distance>&) { return (_Distance*)(0); }
   1.276 +template <class _Tp, class _Distance> 
   1.277 +inline _Distance* _STLP_CALL distance_type(const bidirectional_iterator<_Tp, _Distance>&) { return (_Distance*)(0);}
   1.278 +template <class _Tp, class _Distance> 
   1.279 +inline _Distance* _STLP_CALL distance_type(const random_access_iterator<_Tp, _Distance>&) { return (_Distance*)(0); }
   1.280 +# endif /* BASE_MATCH */
   1.281 +
   1.282 +#endif /* _STLP_NO_ANACHRONISMS */
   1.283 +
   1.284 +template <class _InputIterator, class _Distance>
   1.285 +inline void _STLP_CALL __distance(const _InputIterator& __first, const _InputIterator& __last,
   1.286 +				  _Distance& __n, const input_iterator_tag &) {
   1.287 +  _InputIterator __it(__first);
   1.288 +  while (__it != __last) { ++__it; ++__n; }
   1.289 +}
   1.290 +
   1.291 +# if defined (_STLP_NONTEMPL_BASE_MATCH_BUG) 
   1.292 +template <class _ForwardIterator, class _Distance>
   1.293 +inline void _STLP_CALL __distance(const _ForwardIterator& __first, const _ForwardIterator& __last,
   1.294 +				  _Distance& __n, const forward_iterator_tag &) {
   1.295 +  _ForwardIterator __it(__first);
   1.296 +  while (__it != __last) { ++__first; ++__n; }
   1.297 +}
   1.298 +
   1.299 +template <class _BidirectionalIterator, class _Distance>
   1.300 +_STLP_INLINE_LOOP void _STLP_CALL __distance(const _BidirectionalIterator& __first, 
   1.301 +					     const _BidirectionalIterator& __last,
   1.302 +					     _Distance& __n, const bidirectional_iterator_tag &) {
   1.303 +  _BidirectionalIterator __it(__first);
   1.304 +  while (__it != __last) { ++__it; ++__n; }
   1.305 +}
   1.306 +# endif
   1.307 +
   1.308 +template <class _RandomAccessIterator, class _Distance>
   1.309 +inline void _STLP_CALL __distance(const _RandomAccessIterator& __first, 
   1.310 +				  const _RandomAccessIterator& __last, 
   1.311 +				  _Distance& __n, const random_access_iterator_tag &) {
   1.312 +  __n += __last - __first;
   1.313 +}
   1.314 +
   1.315 +#ifndef _STLP_NO_ANACHRONISMS 
   1.316 +template <class _InputIterator, class _Distance>
   1.317 +inline void _STLP_CALL distance(const _InputIterator& __first, 
   1.318 +				const _InputIterator& __last, _Distance& __n) {
   1.319 +  __distance(__first, __last, __n, _STLP_ITERATOR_CATEGORY(__first, _InputIterator));
   1.320 +}
   1.321 +#endif
   1.322 +
   1.323 +template <class _InputIterator>
   1.324 +inline _STLP_DIFFERENCE_TYPE(_InputIterator) _STLP_CALL
   1.325 +__distance(const _InputIterator& __first, const _InputIterator& __last, const input_iterator_tag &) {
   1.326 +  _STLP_DIFFERENCE_TYPE(_InputIterator) __n = 0;
   1.327 +  _InputIterator __it(__first);  
   1.328 +  while (__it != __last) {
   1.329 +    ++__it; ++__n;
   1.330 +  }
   1.331 +  return __n;
   1.332 +}
   1.333 +
   1.334 +# if defined (_STLP_NONTEMPL_BASE_MATCH_BUG) 
   1.335 +template <class _ForwardIterator>
   1.336 +inline _STLP_DIFFERENCE_TYPE(_ForwardIterator) _STLP_CALL 
   1.337 +__distance(const _ForwardIterator& __first, const _ForwardIterator& __last,
   1.338 +           const forward_iterator_tag &)
   1.339 +{
   1.340 +  _STLP_DIFFERENCE_TYPE(_ForwardIterator) __n = 0;
   1.341 +  _ForwardIterator __it(__first);
   1.342 +  while (__it != __last) {
   1.343 +    ++__it; ++__n;
   1.344 +  }
   1.345 +  return __n;
   1.346 +}
   1.347 +
   1.348 +template <class _BidirectionalIterator>
   1.349 +_STLP_INLINE_LOOP _STLP_DIFFERENCE_TYPE(_BidirectionalIterator) _STLP_CALL 
   1.350 +__distance(const _BidirectionalIterator& __first, 
   1.351 +           const _BidirectionalIterator& __last,
   1.352 +           const bidirectional_iterator_tag &) {
   1.353 +  _STLP_DIFFERENCE_TYPE(_BidirectionalIterator) __n = 0;
   1.354 +  _BidirectionalIterator __it(__first);
   1.355 +  while (__it != __last) {
   1.356 +    ++__it; ++__n;
   1.357 +  }
   1.358 +  return __n;
   1.359 +}
   1.360 +# endif
   1.361 +
   1.362 +template <class _RandomAccessIterator>
   1.363 +inline _STLP_DIFFERENCE_TYPE(_RandomAccessIterator) _STLP_CALL
   1.364 +__distance(const _RandomAccessIterator& __first, const _RandomAccessIterator& __last,
   1.365 +           const random_access_iterator_tag &) {
   1.366 +  return __last - __first;
   1.367 +}
   1.368 +
   1.369 +template <class _InputIterator>
   1.370 +inline _STLP_DIFFERENCE_TYPE(_InputIterator) _STLP_CALL
   1.371 +distance(const _InputIterator& __first, const _InputIterator& __last) {
   1.372 +  return __distance(__first, __last, _STLP_ITERATOR_CATEGORY(__first, _InputIterator));  
   1.373 +}
   1.374 +
   1.375 +
   1.376 +// fbp: those are being used for iterator/const_iterator definitions everywhere
   1.377 +template <class _Tp>
   1.378 +struct _Nonconst_traits;
   1.379 +
   1.380 +template <class _Tp>
   1.381 +struct _Const_traits {
   1.382 +  typedef _Tp value_type;
   1.383 +  typedef const _Tp&  reference;
   1.384 +  typedef const _Tp*  pointer;
   1.385 +  typedef _Nonconst_traits<_Tp> _Non_const_traits;
   1.386 +};
   1.387 +
   1.388 +template <class _Tp>
   1.389 +struct _Nonconst_traits {
   1.390 +  typedef _Tp value_type;
   1.391 +  typedef _Tp& reference;
   1.392 +  typedef _Tp* pointer;
   1.393 +  typedef _Nonconst_traits<_Tp> _Non_const_traits;
   1.394 +};
   1.395 +
   1.396 +#  if defined (_STLP_BASE_TYPEDEF_BUG)
   1.397 +// this workaround is needed for SunPro 4.0.1
   1.398 +template <class _Traits>
   1.399 +struct __cnst_traits_aux : private _Traits
   1.400 +{
   1.401 +  typedef typename _Traits::value_type value_type;
   1.402 +};
   1.403 +#  define __TRAITS_VALUE_TYPE(_Traits) __cnst_traits_aux<_Traits>::value_type
   1.404 +#  else
   1.405 +#  define __TRAITS_VALUE_TYPE(_Traits) _Traits::value_type
   1.406 +#  endif
   1.407 +
   1.408 +# if defined (_STLP_MSVC)
   1.409 +// MSVC specific
   1.410 +template <class _InputIterator, class _Dist>
   1.411 +inline void  _STLP_CALL _Distance(_InputIterator __first, 
   1.412 +		      _InputIterator __last, _Dist& __n) {
   1.413 +  __distance(__first, __last, __n, _STLP_ITERATOR_CATEGORY(__first, _InputIterator));
   1.414 +}
   1.415 +# endif
   1.416 +
   1.417 +template <class _InputIter, class _Distance>
   1.418 +_STLP_INLINE_LOOP void  _STLP_CALL __advance(_InputIter& __i, _Distance __n, const input_iterator_tag &) {
   1.419 +  while (__n--) ++__i;
   1.420 +}
   1.421 +
   1.422 +// fbp : added output iterator tag variant
   1.423 +template <class _InputIter, class _Distance>
   1.424 +_STLP_INLINE_LOOP void  _STLP_CALL __advance(_InputIter& __i, _Distance __n, const output_iterator_tag &) {
   1.425 +  while (__n--) ++__i;
   1.426 +}
   1.427 +
   1.428 +# if defined (_STLP_NONTEMPL_BASE_MATCH_BUG)
   1.429 +template <class _ForwardIterator, class _Distance>
   1.430 +_STLP_INLINE_LOOP void _STLP_CALL __advance(_ForwardIterator& i, _Distance n, const forward_iterator_tag &) {
   1.431 +    while (n--) ++i;
   1.432 +}
   1.433 +# endif
   1.434 +
   1.435 +template <class _BidirectionalIterator, class _Distance>
   1.436 +_STLP_INLINE_LOOP void _STLP_CALL __advance(_BidirectionalIterator& __i, _Distance __n, 
   1.437 +                      const bidirectional_iterator_tag &) {
   1.438 +  if (__n > 0)
   1.439 +    while (__n--) ++__i;
   1.440 +  else
   1.441 +    while (__n++) --__i;
   1.442 +}
   1.443 +
   1.444 +template <class _RandomAccessIterator, class _Distance>
   1.445 +inline void _STLP_CALL __advance(_RandomAccessIterator& __i, _Distance __n, 
   1.446 +                      const random_access_iterator_tag &) {
   1.447 +  __i += __n;
   1.448 +}
   1.449 +
   1.450 +template <class _InputIterator, class _Distance>
   1.451 +inline void _STLP_CALL advance(_InputIterator& __i, _Distance __n) {
   1.452 +  __advance(__i, __n, _STLP_ITERATOR_CATEGORY(__i, _InputIterator));
   1.453 +}
   1.454 +
   1.455 +_STLP_END_NAMESPACE
   1.456 +
   1.457 +# if defined (_STLP_DEBUG) && ! defined (_STLP_DEBUG_H)
   1.458 +#  include <stl/debug/_debug.h>
   1.459 +# endif
   1.460 +
   1.461 +#endif /* _STLP_INTERNAL_ITERATOR_BASE_H */
   1.462 +
   1.463 +
   1.464 +// Local Variables:
   1.465 +// mode:C++
   1.466 +// End: