1.1 --- a/epoc32/include/stdapis/stlport/stl/_iterator_old.h Tue Nov 24 13:55:44 2009 +0000
1.2 +++ b/epoc32/include/stdapis/stlport/stl/_iterator_old.h Tue Mar 16 16:12:26 2010 +0000
1.3 @@ -1,1 +1,351 @@
1.4 -_iterator_old.h
1.5 +/*
1.6 + *
1.7 + * Copyright (c) 1994
1.8 + * Hewlett-Packard Company
1.9 + *
1.10 + * Copyright (c) 1996-1998
1.11 + * Silicon Graphics Computer Systems, Inc.
1.12 + *
1.13 + * Copyright (c) 1997
1.14 + * Moscow Center for SPARC Technology
1.15 + *
1.16 + * Copyright (c) 1999
1.17 + * Boris Fomitchev
1.18 + *
1.19 + * This material is provided "as is", with absolutely no warranty expressed
1.20 + * or implied. Any use is at your own risk.
1.21 + *
1.22 + * Permission to use or copy this software for any purpose is hereby granted
1.23 + * without fee, provided the above notices are retained on all copies.
1.24 + * Permission to modify the code and to distribute modified code is granted,
1.25 + * provided the above notices are retained, and a notice that the code was
1.26 + * modified is included with the above copyright notice.
1.27 + *
1.28 + */
1.29 +
1.30 +/* NOTE: This is an internal header file, included by other STL headers.
1.31 + * You should not attempt to use it directly.
1.32 + */
1.33 +
1.34 +#ifndef _STLP_INTERNAL_ITERATOR_OLD_H
1.35 +#define _STLP_INTERNAL_ITERATOR_OLD_H
1.36 +
1.37 +#ifndef _STLP_INTERNAL_ITERATOR_BASE_H
1.38 +# include <stl/_iterator_base.h>
1.39 +#endif
1.40 +
1.41 +_STLP_BEGIN_NAMESPACE
1.42 +
1.43 +# ifdef _STLP_USE_OLD_HP_ITERATOR_QUERIES
1.44 +
1.45 +template <class _Container>
1.46 +inline output_iterator_tag _STLP_CALL
1.47 +iterator_category(const back_insert_iterator<_Container>&) { return output_iterator_tag(); }
1.48 +template <class _Container>
1.49 +inline output_iterator_tag _STLP_CALL
1.50 +iterator_category(const front_insert_iterator<_Container>&) { return output_iterator_tag(); }
1.51 +template <class _Container>
1.52 +inline output_iterator_tag _STLP_CALL
1.53 +iterator_category(const insert_iterator<_Container>&) { return output_iterator_tag(); }
1.54 +
1.55 +# endif
1.56 +
1.57 +# if defined (_STLP_MSVC50_COMPATIBILITY)
1.58 +# define __Reference _Reference, class _Pointer
1.59 +# define Reference__ _Reference, _Pointer
1.60 +template <class _BidirectionalIterator, class _Tp,
1.61 + __DFL_TMPL_PARAM(_Reference, _Tp& ),
1.62 + __DFL_TMPL_PARAM(_Pointer, _Tp*),
1.63 + __DFL_TYPE_PARAM(_Distance, ptrdiff_t)>
1.64 +# else
1.65 +# define __Reference _Reference
1.66 +# define Reference__ _Reference
1.67 +template <class _BidirectionalIterator, class _Tp, __DFL_TMPL_PARAM(_Reference, _Tp& ),
1.68 + __DFL_TYPE_PARAM(_Distance, ptrdiff_t)>
1.69 +# endif
1.70 +class reverse_bidirectional_iterator {
1.71 + typedef reverse_bidirectional_iterator<_BidirectionalIterator, _Tp,
1.72 + Reference__, _Distance> _Self;
1.73 + // friend inline bool operator== _STLP_NULL_TMPL_ARGS (const _Self& x, const _Self& y);
1.74 +protected:
1.75 + _BidirectionalIterator current;
1.76 +public:
1.77 + typedef bidirectional_iterator_tag iterator_category;
1.78 + typedef _Tp value_type;
1.79 + typedef _Distance difference_type;
1.80 +# if defined (_STLP_MSVC50_COMPATIBILITY)
1.81 + typedef _Pointer pointer;
1.82 +# else
1.83 + typedef _Tp* pointer;
1.84 +# endif
1.85 + typedef _Reference reference;
1.86 +
1.87 + reverse_bidirectional_iterator() {}
1.88 + explicit reverse_bidirectional_iterator(_BidirectionalIterator __x)
1.89 + : current(__x) {}
1.90 + _BidirectionalIterator base() const { return current; }
1.91 + _Reference operator*() const {
1.92 + _BidirectionalIterator __tmp = current;
1.93 + return *--__tmp;
1.94 + }
1.95 +# if !(defined _STLP_NO_ARROW_OPERATOR)
1.96 + _STLP_DEFINE_ARROW_OPERATOR
1.97 +# endif
1.98 + _Self& operator++() {
1.99 + --current;
1.100 + return *this;
1.101 + }
1.102 + _Self operator++(int) {
1.103 + _Self __tmp = *this;
1.104 + --current;
1.105 + return __tmp;
1.106 + }
1.107 + _Self& operator--() {
1.108 + ++current;
1.109 + return *this;
1.110 + }
1.111 + _Self operator--(int) {
1.112 + _Self __tmp = *this;
1.113 + ++current;
1.114 + return __tmp;
1.115 + }
1.116 +};
1.117 +
1.118 +# ifdef _STLP_USE_OLD_HP_ITERATOR_QUERIES
1.119 +template <class _BidirectionalIterator, class _Tp, class __Reference,
1.120 + class _Distance>
1.121 +inline bidirectional_iterator_tag _STLP_CALL
1.122 +iterator_category(const reverse_bidirectional_iterator<_BidirectionalIterator, _Tp, Reference__, _Distance>&)
1.123 +{ return bidirectional_iterator_tag(); }
1.124 +template <class _BidirectionalIterator, class _Tp, class __Reference,
1.125 + class _Distance>
1.126 +inline _Tp* _STLP_CALL
1.127 +value_type(const reverse_bidirectional_iterator<_BidirectionalIterator, _Tp, Reference__, _Distance>&)
1.128 +{ return (_Tp*) 0; }
1.129 +template <class _BidirectionalIterator, class _Tp, class __Reference,
1.130 + class _Distance>
1.131 +inline _Distance* _STLP_CALL
1.132 +distance_type(const reverse_bidirectional_iterator<_BidirectionalIterator, _Tp, Reference__, _Distance>&)
1.133 +{ return (_Distance*) 0; }
1.134 +#endif
1.135 +
1.136 +template <class _BidirectionalIterator, class _Tp, class __Reference,
1.137 + class _Distance>
1.138 +inline bool _STLP_CALL operator==(
1.139 + const reverse_bidirectional_iterator<_BidirectionalIterator, _Tp,
1.140 + Reference__, _Distance>& __x,
1.141 + const reverse_bidirectional_iterator<_BidirectionalIterator, _Tp,
1.142 + Reference__, _Distance>& __y)
1.143 +{
1.144 + return __x.base() == __y.base();
1.145 +}
1.146 +
1.147 +#ifdef _STLP_USE_SEPARATE_RELOPS_NAMESPACE
1.148 +
1.149 +template <class _BiIter, class _Tp, class __Reference, class _Distance>
1.150 +inline bool _STLP_CALL operator!=(
1.151 + const reverse_bidirectional_iterator<_BiIter, _Tp, Reference__, _Distance>& __x,
1.152 + const reverse_bidirectional_iterator<_BiIter, _Tp, Reference__, _Distance>& __y)
1.153 +{
1.154 + return !(__x == __y);
1.155 +}
1.156 +
1.157 +#endif /* _STLP_USE_SEPARATE_RELOPS_NAMESPACE */
1.158 +
1.159 +#if ! defined ( _STLP_CLASS_PARTIAL_SPECIALIZATION )
1.160 +
1.161 +// This is the old version of reverse_iterator, as found in the original
1.162 +// HP STL. It does not use partial specialization.
1.163 +
1.164 +template <class _RandomAccessIterator,
1.165 +# if defined (__MSL__) && (__MSL__ >= 0x2405) \
1.166 + || defined(__MRC__) || (defined(__SC__) && !defined(__DMC__)) //*ty 03/22/2001 - give the default to the secont param under MPW.
1.167 + // I believe giving the default will cause any harm even though the 2nd type parameter
1.168 + // still have to be provided for T* type iterators.
1.169 + __DFL_TMPL_PARAM(_Tp,iterator_traits<_RandomAccessIterator>::value_type),
1.170 +# else
1.171 + class _Tp,
1.172 +#endif
1.173 + __DFL_TMPL_PARAM(_Reference,_Tp&),
1.174 +# if defined (_STLP_MSVC50_COMPATIBILITY)
1.175 + __DFL_TMPL_PARAM(_Pointer, _Tp*),
1.176 +# endif
1.177 + __DFL_TYPE_PARAM(_Distance,ptrdiff_t)>
1.178 +class reverse_iterator {
1.179 + typedef reverse_iterator<_RandomAccessIterator, _Tp, Reference__, _Distance>
1.180 + _Self;
1.181 +protected:
1.182 + _RandomAccessIterator __current;
1.183 +public:
1.184 + typedef random_access_iterator_tag iterator_category;
1.185 + typedef _Tp value_type;
1.186 + typedef _Distance difference_type;
1.187 +# if defined (_STLP_MSVC50_COMPATIBILITY)
1.188 + typedef _Pointer pointer;
1.189 +# else
1.190 + typedef _Tp* pointer;
1.191 +# endif
1.192 + typedef _Reference reference;
1.193 +
1.194 + reverse_iterator() {}
1.195 + reverse_iterator(const _Self& __x) : __current(__x.base()) {}
1.196 + explicit reverse_iterator(_RandomAccessIterator __x) : __current(__x) {}
1.197 + _Self& operator=(const _Self& __x) {__current = __x.base(); return *this; }
1.198 +
1.199 + _RandomAccessIterator base() const { return __current; }
1.200 + _Reference operator*() const { return *(__current - (difference_type)1); }
1.201 +
1.202 +# if !(defined _STLP_NO_ARROW_OPERATOR)
1.203 + _STLP_DEFINE_ARROW_OPERATOR
1.204 +# endif
1.205 +
1.206 + _Self& operator++() {
1.207 + --__current;
1.208 + return *this;
1.209 + }
1.210 + _Self operator++(int) {
1.211 + _Self __tmp = *this;
1.212 + --__current;
1.213 + return __tmp;
1.214 + }
1.215 + _Self& operator--() {
1.216 + ++__current;
1.217 + return *this;
1.218 + }
1.219 + _Self operator--(int) {
1.220 + _Self __tmp = *this;
1.221 + ++__current;
1.222 + return __tmp;
1.223 + }
1.224 + _Self operator+(_Distance __n) const {
1.225 + return _Self(__current - __n);
1.226 + }
1.227 + _Self& operator+=(_Distance __n) {
1.228 + __current -= __n;
1.229 + return *this;
1.230 + }
1.231 + _Self operator-(_Distance __n) const {
1.232 + return _Self(__current + __n);
1.233 + }
1.234 + _Self& operator-=(_Distance __n) {
1.235 + __current += __n;
1.236 + return *this;
1.237 + }
1.238 + _Reference operator[](_Distance __n) const { return *(*this + __n); }
1.239 +};
1.240 +
1.241 +# ifdef _STLP_USE_OLD_HP_ITERATOR_QUERIES
1.242 +template <class _RandomAccessIterator, class _Tp,
1.243 + class __Reference, class _Distance>
1.244 +inline random_access_iterator_tag _STLP_CALL
1.245 +iterator_category(const reverse_iterator<_RandomAccessIterator, _Tp, Reference__, _Distance>&)
1.246 +{ return random_access_iterator_tag(); }
1.247 +template <class _RandomAccessIterator, class _Tp,
1.248 + class __Reference, class _Distance>
1.249 +inline _Tp* _STLP_CALL value_type(const reverse_iterator<_RandomAccessIterator, _Tp, Reference__, _Distance>&)
1.250 +{ return (_Tp*) 0; }
1.251 +template <class _RandomAccessIterator, class _Tp,
1.252 + class __Reference, class _Distance>
1.253 +inline _Distance* _STLP_CALL
1.254 +distance_type(const reverse_iterator<_RandomAccessIterator, _Tp, Reference__, _Distance>&)
1.255 +{ return (_Distance*) 0; }
1.256 +#endif
1.257 +
1.258 +template <class _RandomAccessIterator, class _Tp,
1.259 + class __Reference, class _Distance>
1.260 +inline bool _STLP_CALL
1.261 +operator==(const reverse_iterator<_RandomAccessIterator, _Tp,
1.262 + Reference__, _Distance>& __x,
1.263 + const reverse_iterator<_RandomAccessIterator, _Tp,
1.264 + Reference__, _Distance>& __y)
1.265 +{
1.266 + return __x.base() == __y.base();
1.267 +}
1.268 +
1.269 +template <class _RandomAccessIterator, class _Tp,
1.270 + class __Reference, class _Distance>
1.271 +inline bool _STLP_CALL
1.272 +operator<(const reverse_iterator<_RandomAccessIterator, _Tp,
1.273 + Reference__, _Distance>& __x,
1.274 + const reverse_iterator<_RandomAccessIterator, _Tp,
1.275 + Reference__, _Distance>& __y)
1.276 +{
1.277 + return __y.base() < __x.base();
1.278 +}
1.279 +
1.280 +#ifdef _STLP_USE_SEPARATE_RELOPS_NAMESPACE
1.281 +
1.282 +template <class _RandomAccessIterator, class _Tp,
1.283 + class __Reference, class _Distance>
1.284 +inline bool _STLP_CALL
1.285 +operator!=(const reverse_iterator<_RandomAccessIterator, _Tp,
1.286 + Reference__, _Distance>& __x,
1.287 + const reverse_iterator<_RandomAccessIterator, _Tp,
1.288 + Reference__, _Distance>& __y) {
1.289 + return !(__x == __y);
1.290 +}
1.291 +
1.292 +template <class _RandomAccessIterator, class _Tp,
1.293 + class __Reference, class _Distance>
1.294 +inline bool _STLP_CALL
1.295 +operator>(const reverse_iterator<_RandomAccessIterator, _Tp,
1.296 + Reference__, _Distance>& __x,
1.297 + const reverse_iterator<_RandomAccessIterator, _Tp,
1.298 + Reference__, _Distance>& __y) {
1.299 + return __y < __x;
1.300 +}
1.301 +
1.302 +template <class _RandomAccessIterator, class _Tp,
1.303 + class __Reference, class _Distance>
1.304 +inline bool _STLP_CALL
1.305 +operator<=(const reverse_iterator<_RandomAccessIterator, _Tp,
1.306 + Reference__, _Distance>& __x,
1.307 + const reverse_iterator<_RandomAccessIterator, _Tp,
1.308 + Reference__, _Distance>& __y) {
1.309 + return !(__y < __x);
1.310 +}
1.311 +
1.312 +template <class _RandomAccessIterator, class _Tp,
1.313 + class __Reference, class _Distance>
1.314 +inline bool _STLP_CALL
1.315 +operator>=(const reverse_iterator<_RandomAccessIterator, _Tp,
1.316 + Reference__, _Distance>& __x,
1.317 + const reverse_iterator<_RandomAccessIterator, _Tp,
1.318 + Reference__, _Distance>& __y) {
1.319 + return !(__x < __y);
1.320 +}
1.321 +
1.322 +#endif /* _STLP_USE_SEPARATE_RELOPS_NAMESPACE */
1.323 +
1.324 +template <class _RandomAccessIterator, class _Tp,
1.325 + class __Reference, class _Distance>
1.326 +inline _Distance _STLP_CALL
1.327 +operator-(const reverse_iterator<_RandomAccessIterator, _Tp,
1.328 + Reference__, _Distance>& __x,
1.329 + const reverse_iterator<_RandomAccessIterator, _Tp,
1.330 + Reference__, _Distance>& __y)
1.331 +{
1.332 + return __y.base() - __x.base();
1.333 +}
1.334 +
1.335 +template <class _RandomAccessIterator, class _Tp,
1.336 + class __Reference, class _Distance>
1.337 +inline reverse_iterator<_RandomAccessIterator, _Tp,
1.338 + Reference__, _Distance> _STLP_CALL
1.339 +operator+(_Distance __n,
1.340 + const reverse_iterator<_RandomAccessIterator, _Tp,
1.341 + Reference__, _Distance>& __x)
1.342 +{
1.343 + return reverse_iterator<_RandomAccessIterator, _Tp,
1.344 + Reference__, _Distance>(__x.base() - __n);
1.345 +}
1.346 +
1.347 +#endif /* ! defined ( _STLP_CLASS_PARTIAL_SPECIALIZATION ) */
1.348 +
1.349 +_STLP_END_NAMESPACE
1.350 +
1.351 +#endif /* _STLP_INTERNAL_ITERATOR_H */
1.352 +
1.353 +// Local Variables:
1.354 +// mode:C++
1.355 +// End: