1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/epoc32/include/stdapis/stlport/stl/_iterator_old.h Wed Mar 31 12:33:34 2010 +0100
1.3 @@ -0,0 +1,351 @@
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_OLD_H
1.34 +#define _STLP_INTERNAL_ITERATOR_OLD_H
1.35 +
1.36 +#ifndef _STLP_INTERNAL_ITERATOR_BASE_H
1.37 +# include <stl/_iterator_base.h>
1.38 +#endif
1.39 +
1.40 +_STLP_BEGIN_NAMESPACE
1.41 +
1.42 +# ifdef _STLP_USE_OLD_HP_ITERATOR_QUERIES
1.43 +
1.44 +template <class _Container>
1.45 +inline output_iterator_tag _STLP_CALL
1.46 +iterator_category(const back_insert_iterator<_Container>&) { return output_iterator_tag(); }
1.47 +template <class _Container>
1.48 +inline output_iterator_tag _STLP_CALL
1.49 +iterator_category(const front_insert_iterator<_Container>&) { return output_iterator_tag(); }
1.50 +template <class _Container>
1.51 +inline output_iterator_tag _STLP_CALL
1.52 +iterator_category(const insert_iterator<_Container>&) { return output_iterator_tag(); }
1.53 +
1.54 +# endif
1.55 +
1.56 +# if defined (_STLP_MSVC50_COMPATIBILITY)
1.57 +# define __Reference _Reference, class _Pointer
1.58 +# define Reference__ _Reference, _Pointer
1.59 +template <class _BidirectionalIterator, class _Tp,
1.60 + __DFL_TMPL_PARAM(_Reference, _Tp& ),
1.61 + __DFL_TMPL_PARAM(_Pointer, _Tp*),
1.62 + __DFL_TYPE_PARAM(_Distance, ptrdiff_t)>
1.63 +# else
1.64 +# define __Reference _Reference
1.65 +# define Reference__ _Reference
1.66 +template <class _BidirectionalIterator, class _Tp, __DFL_TMPL_PARAM(_Reference, _Tp& ),
1.67 + __DFL_TYPE_PARAM(_Distance, ptrdiff_t)>
1.68 +# endif
1.69 +class reverse_bidirectional_iterator {
1.70 + typedef reverse_bidirectional_iterator<_BidirectionalIterator, _Tp,
1.71 + Reference__, _Distance> _Self;
1.72 + // friend inline bool operator== _STLP_NULL_TMPL_ARGS (const _Self& x, const _Self& y);
1.73 +protected:
1.74 + _BidirectionalIterator current;
1.75 +public:
1.76 + typedef bidirectional_iterator_tag iterator_category;
1.77 + typedef _Tp value_type;
1.78 + typedef _Distance difference_type;
1.79 +# if defined (_STLP_MSVC50_COMPATIBILITY)
1.80 + typedef _Pointer pointer;
1.81 +# else
1.82 + typedef _Tp* pointer;
1.83 +# endif
1.84 + typedef _Reference reference;
1.85 +
1.86 + reverse_bidirectional_iterator() {}
1.87 + explicit reverse_bidirectional_iterator(_BidirectionalIterator __x)
1.88 + : current(__x) {}
1.89 + _BidirectionalIterator base() const { return current; }
1.90 + _Reference operator*() const {
1.91 + _BidirectionalIterator __tmp = current;
1.92 + return *--__tmp;
1.93 + }
1.94 +# if !(defined _STLP_NO_ARROW_OPERATOR)
1.95 + _STLP_DEFINE_ARROW_OPERATOR
1.96 +# endif
1.97 + _Self& operator++() {
1.98 + --current;
1.99 + return *this;
1.100 + }
1.101 + _Self operator++(int) {
1.102 + _Self __tmp = *this;
1.103 + --current;
1.104 + return __tmp;
1.105 + }
1.106 + _Self& operator--() {
1.107 + ++current;
1.108 + return *this;
1.109 + }
1.110 + _Self operator--(int) {
1.111 + _Self __tmp = *this;
1.112 + ++current;
1.113 + return __tmp;
1.114 + }
1.115 +};
1.116 +
1.117 +# ifdef _STLP_USE_OLD_HP_ITERATOR_QUERIES
1.118 +template <class _BidirectionalIterator, class _Tp, class __Reference,
1.119 + class _Distance>
1.120 +inline bidirectional_iterator_tag _STLP_CALL
1.121 +iterator_category(const reverse_bidirectional_iterator<_BidirectionalIterator, _Tp, Reference__, _Distance>&)
1.122 +{ return bidirectional_iterator_tag(); }
1.123 +template <class _BidirectionalIterator, class _Tp, class __Reference,
1.124 + class _Distance>
1.125 +inline _Tp* _STLP_CALL
1.126 +value_type(const reverse_bidirectional_iterator<_BidirectionalIterator, _Tp, Reference__, _Distance>&)
1.127 +{ return (_Tp*) 0; }
1.128 +template <class _BidirectionalIterator, class _Tp, class __Reference,
1.129 + class _Distance>
1.130 +inline _Distance* _STLP_CALL
1.131 +distance_type(const reverse_bidirectional_iterator<_BidirectionalIterator, _Tp, Reference__, _Distance>&)
1.132 +{ return (_Distance*) 0; }
1.133 +#endif
1.134 +
1.135 +template <class _BidirectionalIterator, class _Tp, class __Reference,
1.136 + class _Distance>
1.137 +inline bool _STLP_CALL operator==(
1.138 + const reverse_bidirectional_iterator<_BidirectionalIterator, _Tp,
1.139 + Reference__, _Distance>& __x,
1.140 + const reverse_bidirectional_iterator<_BidirectionalIterator, _Tp,
1.141 + Reference__, _Distance>& __y)
1.142 +{
1.143 + return __x.base() == __y.base();
1.144 +}
1.145 +
1.146 +#ifdef _STLP_USE_SEPARATE_RELOPS_NAMESPACE
1.147 +
1.148 +template <class _BiIter, class _Tp, class __Reference, class _Distance>
1.149 +inline bool _STLP_CALL operator!=(
1.150 + const reverse_bidirectional_iterator<_BiIter, _Tp, Reference__, _Distance>& __x,
1.151 + const reverse_bidirectional_iterator<_BiIter, _Tp, Reference__, _Distance>& __y)
1.152 +{
1.153 + return !(__x == __y);
1.154 +}
1.155 +
1.156 +#endif /* _STLP_USE_SEPARATE_RELOPS_NAMESPACE */
1.157 +
1.158 +#if ! defined ( _STLP_CLASS_PARTIAL_SPECIALIZATION )
1.159 +
1.160 +// This is the old version of reverse_iterator, as found in the original
1.161 +// HP STL. It does not use partial specialization.
1.162 +
1.163 +template <class _RandomAccessIterator,
1.164 +# if defined (__MSL__) && (__MSL__ >= 0x2405) \
1.165 + || defined(__MRC__) || (defined(__SC__) && !defined(__DMC__)) //*ty 03/22/2001 - give the default to the secont param under MPW.
1.166 + // I believe giving the default will cause any harm even though the 2nd type parameter
1.167 + // still have to be provided for T* type iterators.
1.168 + __DFL_TMPL_PARAM(_Tp,iterator_traits<_RandomAccessIterator>::value_type),
1.169 +# else
1.170 + class _Tp,
1.171 +#endif
1.172 + __DFL_TMPL_PARAM(_Reference,_Tp&),
1.173 +# if defined (_STLP_MSVC50_COMPATIBILITY)
1.174 + __DFL_TMPL_PARAM(_Pointer, _Tp*),
1.175 +# endif
1.176 + __DFL_TYPE_PARAM(_Distance,ptrdiff_t)>
1.177 +class reverse_iterator {
1.178 + typedef reverse_iterator<_RandomAccessIterator, _Tp, Reference__, _Distance>
1.179 + _Self;
1.180 +protected:
1.181 + _RandomAccessIterator __current;
1.182 +public:
1.183 + typedef random_access_iterator_tag iterator_category;
1.184 + typedef _Tp value_type;
1.185 + typedef _Distance difference_type;
1.186 +# if defined (_STLP_MSVC50_COMPATIBILITY)
1.187 + typedef _Pointer pointer;
1.188 +# else
1.189 + typedef _Tp* pointer;
1.190 +# endif
1.191 + typedef _Reference reference;
1.192 +
1.193 + reverse_iterator() {}
1.194 + reverse_iterator(const _Self& __x) : __current(__x.base()) {}
1.195 + explicit reverse_iterator(_RandomAccessIterator __x) : __current(__x) {}
1.196 + _Self& operator=(const _Self& __x) {__current = __x.base(); return *this; }
1.197 +
1.198 + _RandomAccessIterator base() const { return __current; }
1.199 + _Reference operator*() const { return *(__current - (difference_type)1); }
1.200 +
1.201 +# if !(defined _STLP_NO_ARROW_OPERATOR)
1.202 + _STLP_DEFINE_ARROW_OPERATOR
1.203 +# endif
1.204 +
1.205 + _Self& operator++() {
1.206 + --__current;
1.207 + return *this;
1.208 + }
1.209 + _Self operator++(int) {
1.210 + _Self __tmp = *this;
1.211 + --__current;
1.212 + return __tmp;
1.213 + }
1.214 + _Self& operator--() {
1.215 + ++__current;
1.216 + return *this;
1.217 + }
1.218 + _Self operator--(int) {
1.219 + _Self __tmp = *this;
1.220 + ++__current;
1.221 + return __tmp;
1.222 + }
1.223 + _Self operator+(_Distance __n) const {
1.224 + return _Self(__current - __n);
1.225 + }
1.226 + _Self& operator+=(_Distance __n) {
1.227 + __current -= __n;
1.228 + return *this;
1.229 + }
1.230 + _Self operator-(_Distance __n) const {
1.231 + return _Self(__current + __n);
1.232 + }
1.233 + _Self& operator-=(_Distance __n) {
1.234 + __current += __n;
1.235 + return *this;
1.236 + }
1.237 + _Reference operator[](_Distance __n) const { return *(*this + __n); }
1.238 +};
1.239 +
1.240 +# ifdef _STLP_USE_OLD_HP_ITERATOR_QUERIES
1.241 +template <class _RandomAccessIterator, class _Tp,
1.242 + class __Reference, class _Distance>
1.243 +inline random_access_iterator_tag _STLP_CALL
1.244 +iterator_category(const reverse_iterator<_RandomAccessIterator, _Tp, Reference__, _Distance>&)
1.245 +{ return random_access_iterator_tag(); }
1.246 +template <class _RandomAccessIterator, class _Tp,
1.247 + class __Reference, class _Distance>
1.248 +inline _Tp* _STLP_CALL value_type(const reverse_iterator<_RandomAccessIterator, _Tp, Reference__, _Distance>&)
1.249 +{ return (_Tp*) 0; }
1.250 +template <class _RandomAccessIterator, class _Tp,
1.251 + class __Reference, class _Distance>
1.252 +inline _Distance* _STLP_CALL
1.253 +distance_type(const reverse_iterator<_RandomAccessIterator, _Tp, Reference__, _Distance>&)
1.254 +{ return (_Distance*) 0; }
1.255 +#endif
1.256 +
1.257 +template <class _RandomAccessIterator, class _Tp,
1.258 + class __Reference, class _Distance>
1.259 +inline bool _STLP_CALL
1.260 +operator==(const reverse_iterator<_RandomAccessIterator, _Tp,
1.261 + Reference__, _Distance>& __x,
1.262 + const reverse_iterator<_RandomAccessIterator, _Tp,
1.263 + Reference__, _Distance>& __y)
1.264 +{
1.265 + return __x.base() == __y.base();
1.266 +}
1.267 +
1.268 +template <class _RandomAccessIterator, class _Tp,
1.269 + class __Reference, class _Distance>
1.270 +inline bool _STLP_CALL
1.271 +operator<(const reverse_iterator<_RandomAccessIterator, _Tp,
1.272 + Reference__, _Distance>& __x,
1.273 + const reverse_iterator<_RandomAccessIterator, _Tp,
1.274 + Reference__, _Distance>& __y)
1.275 +{
1.276 + return __y.base() < __x.base();
1.277 +}
1.278 +
1.279 +#ifdef _STLP_USE_SEPARATE_RELOPS_NAMESPACE
1.280 +
1.281 +template <class _RandomAccessIterator, class _Tp,
1.282 + class __Reference, class _Distance>
1.283 +inline bool _STLP_CALL
1.284 +operator!=(const reverse_iterator<_RandomAccessIterator, _Tp,
1.285 + Reference__, _Distance>& __x,
1.286 + const reverse_iterator<_RandomAccessIterator, _Tp,
1.287 + Reference__, _Distance>& __y) {
1.288 + return !(__x == __y);
1.289 +}
1.290 +
1.291 +template <class _RandomAccessIterator, class _Tp,
1.292 + class __Reference, class _Distance>
1.293 +inline bool _STLP_CALL
1.294 +operator>(const reverse_iterator<_RandomAccessIterator, _Tp,
1.295 + Reference__, _Distance>& __x,
1.296 + const reverse_iterator<_RandomAccessIterator, _Tp,
1.297 + Reference__, _Distance>& __y) {
1.298 + return __y < __x;
1.299 +}
1.300 +
1.301 +template <class _RandomAccessIterator, class _Tp,
1.302 + class __Reference, class _Distance>
1.303 +inline bool _STLP_CALL
1.304 +operator<=(const reverse_iterator<_RandomAccessIterator, _Tp,
1.305 + Reference__, _Distance>& __x,
1.306 + const reverse_iterator<_RandomAccessIterator, _Tp,
1.307 + Reference__, _Distance>& __y) {
1.308 + return !(__y < __x);
1.309 +}
1.310 +
1.311 +template <class _RandomAccessIterator, class _Tp,
1.312 + class __Reference, class _Distance>
1.313 +inline bool _STLP_CALL
1.314 +operator>=(const reverse_iterator<_RandomAccessIterator, _Tp,
1.315 + Reference__, _Distance>& __x,
1.316 + const reverse_iterator<_RandomAccessIterator, _Tp,
1.317 + Reference__, _Distance>& __y) {
1.318 + return !(__x < __y);
1.319 +}
1.320 +
1.321 +#endif /* _STLP_USE_SEPARATE_RELOPS_NAMESPACE */
1.322 +
1.323 +template <class _RandomAccessIterator, class _Tp,
1.324 + class __Reference, class _Distance>
1.325 +inline _Distance _STLP_CALL
1.326 +operator-(const reverse_iterator<_RandomAccessIterator, _Tp,
1.327 + Reference__, _Distance>& __x,
1.328 + const reverse_iterator<_RandomAccessIterator, _Tp,
1.329 + Reference__, _Distance>& __y)
1.330 +{
1.331 + return __y.base() - __x.base();
1.332 +}
1.333 +
1.334 +template <class _RandomAccessIterator, class _Tp,
1.335 + class __Reference, class _Distance>
1.336 +inline reverse_iterator<_RandomAccessIterator, _Tp,
1.337 + Reference__, _Distance> _STLP_CALL
1.338 +operator+(_Distance __n,
1.339 + const reverse_iterator<_RandomAccessIterator, _Tp,
1.340 + Reference__, _Distance>& __x)
1.341 +{
1.342 + return reverse_iterator<_RandomAccessIterator, _Tp,
1.343 + Reference__, _Distance>(__x.base() - __n);
1.344 +}
1.345 +
1.346 +#endif /* ! defined ( _STLP_CLASS_PARTIAL_SPECIALIZATION ) */
1.347 +
1.348 +_STLP_END_NAMESPACE
1.349 +
1.350 +#endif /* _STLP_INTERNAL_ITERATOR_H */
1.351 +
1.352 +// Local Variables:
1.353 +// mode:C++
1.354 +// End: