diff -r 666f914201fb -r 2fe1408b6811 epoc32/include/stdapis/stlport/stl/_iterator.h --- a/epoc32/include/stdapis/stlport/stl/_iterator.h Tue Nov 24 13:55:44 2009 +0000 +++ b/epoc32/include/stdapis/stlport/stl/_iterator.h Tue Mar 16 16:12:26 2010 +0000 @@ -1,1 +1,269 @@ -_iterator.h +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Copyright (c) 1996-1998 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1997 + * Moscow Center for SPARC Technology + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +/* NOTE: This is an internal header file, included by other STL headers. + * You should not attempt to use it directly. + */ + +#ifndef _STLP_INTERNAL_ITERATOR_H +#define _STLP_INTERNAL_ITERATOR_H + +#ifndef _STLP_INTERNAL_ITERATOR_BASE_H +# include +#endif + +_STLP_BEGIN_NAMESPACE + +#if defined ( _STLP_CLASS_PARTIAL_SPECIALIZATION ) +// This is the new version of reverse_iterator, as defined in the +// draft C++ standard. It relies on the iterator_traits template, +// which in turn relies on partial specialization. The class +// reverse_bidirectional_iterator is no longer part of the draft +// standard, but it is retained for backward compatibility. + +template +class reverse_iterator : + public iterator::iterator_category, + typename iterator_traits<_Iterator>::value_type, + typename iterator_traits<_Iterator>::difference_type, + typename iterator_traits<_Iterator>::pointer, + typename iterator_traits<_Iterator>::reference> +{ +protected: + _Iterator current; + typedef reverse_iterator<_Iterator> _Self; +public: + typedef typename iterator_traits<_Iterator>::iterator_category iterator_category; + typedef typename iterator_traits<_Iterator>::value_type value_type; + typedef typename iterator_traits<_Iterator>::difference_type difference_type; + typedef typename iterator_traits<_Iterator>::pointer pointer; + typedef typename iterator_traits<_Iterator>::reference reference; + typedef _Iterator iterator_type; +public: + reverse_iterator() {} + explicit reverse_iterator(iterator_type __x) : current(__x) {} + reverse_iterator(const _Self& __x) : current(__x.current) {} + _Self& operator = (const _Self& __x) { current = __x.base(); return *this; } +#ifdef _STLP_MEMBER_TEMPLATES + template + reverse_iterator(const reverse_iterator<_Iter>& __x) : current(__x.base()) {} + template + _Self& operator = (const reverse_iterator<_Iter>& __x) { current = __x.base(); return *this; } +#endif /* _STLP_MEMBER_TEMPLATES */ + + iterator_type base() const { return current; } + reference operator*() const { + _Iterator __tmp = current; + return *--__tmp; + } + _STLP_DEFINE_ARROW_OPERATOR + _Self& operator++() { + --current; + return *this; + } + _Self operator++(int) { + _Self __tmp = *this; + --current; + return __tmp; + } + _Self& operator--() { + ++current; + return *this; + } + _Self operator--(int) { + _Self __tmp = *this; + ++current; + return __tmp; + } + + _Self operator+(difference_type __n) const { + return _Self(current - __n); + } + _Self& operator+=(difference_type __n) { + current -= __n; + return *this; + } + _Self operator-(difference_type __n) const { + return _Self(current + __n); + } + _Self& operator-=(difference_type __n) { + current += __n; + return *this; + } + reference operator[](difference_type __n) const { return *(*this + __n); } +}; + +template +inline bool _STLP_CALL operator==(const reverse_iterator<_Iterator>& __x, + const reverse_iterator<_Iterator>& __y) { + return __x.base() == __y.base(); +} + +template +inline bool _STLP_CALL operator<(const reverse_iterator<_Iterator>& __x, + const reverse_iterator<_Iterator>& __y) { + return __y.base() < __x.base(); +} + +#ifdef _STLP_USE_SEPARATE_RELOPS_NAMESPACE + +template +inline bool _STLP_CALL operator!=(const reverse_iterator<_Iterator>& __x, + const reverse_iterator<_Iterator>& __y) { + return !(__x == __y); +} + +template +inline bool _STLP_CALL operator>(const reverse_iterator<_Iterator>& __x, + const reverse_iterator<_Iterator>& __y) { + return __y < __x; +} + +template +inline bool _STLP_CALL operator<=(const reverse_iterator<_Iterator>& __x, + const reverse_iterator<_Iterator>& __y) { + return !(__y < __x); +} + +template +inline bool _STLP_CALL operator>=(const reverse_iterator<_Iterator>& __x, + const reverse_iterator<_Iterator>& __y) { + return !(__x < __y); +} + +#endif /* _STLP_USE_SEPARATE_RELOPS_NAMESPACE */ + +template +# ifdef __SUNPRO_CC +inline ptrdiff_t _STLP_CALL +# else +inline typename reverse_iterator<_Iterator>::difference_type _STLP_CALL +# endif +operator-(const reverse_iterator<_Iterator>& __x, + const reverse_iterator<_Iterator>& __y) { + return __y.base() - __x.base(); +} + +template +inline reverse_iterator<_Iterator> _STLP_CALL +operator+(_DifferenceType n,const reverse_iterator<_Iterator>& x) { + return x.operator+(n); +} + +# endif + +template +class back_insert_iterator + : public iterator +{ +protected: + _Container* container; +public: + typedef _Container container_type; + typedef output_iterator_tag iterator_category; + + explicit back_insert_iterator(_Container& __x) : container(&__x) {} + back_insert_iterator<_Container>& + operator=(const typename _Container::value_type& __val) { + container->push_back(__val); + return *this; + } + back_insert_iterator<_Container>& operator*() { return *this; } + back_insert_iterator<_Container>& operator++() { return *this; } + back_insert_iterator<_Container> operator++(int) { return *this; } +}; + +template +inline back_insert_iterator<_Container> _STLP_CALL back_inserter(_Container& __x) { + return back_insert_iterator<_Container>(__x); +} + +template +class front_insert_iterator + : public iterator +{ +protected: + _Container* container; +public: + typedef _Container container_type; + typedef output_iterator_tag iterator_category; + explicit front_insert_iterator(_Container& __x) : container(&__x) {} + front_insert_iterator<_Container>& + operator=(const typename _Container::value_type& __val) { + container->push_front(__val); + return *this; + } + front_insert_iterator<_Container>& operator*() { return *this; } + front_insert_iterator<_Container>& operator++() { return *this; } + front_insert_iterator<_Container>& operator++(int) { return *this; } +}; + +template +inline front_insert_iterator<_Container> _STLP_CALL front_inserter(_Container& __x) { + return front_insert_iterator<_Container>(__x); +} + +template +class insert_iterator + : public iterator +{ +protected: + _Container* container; + typename _Container::iterator iter; +public: + typedef _Container container_type; + typedef output_iterator_tag iterator_category; + insert_iterator(_Container& __x, typename _Container::iterator __i) + : container(&__x), iter(__i) {} + insert_iterator<_Container>& + operator=(const typename _Container::value_type& __val) { + iter = container->insert(iter, __val); + ++iter; + return *this; + } + insert_iterator<_Container>& operator*() { return *this; } + insert_iterator<_Container>& operator++() { return *this; } + insert_iterator<_Container>& operator++(int) { return *this; } +}; + +template +inline insert_iterator<_Container> _STLP_CALL +inserter(_Container& __x, _Iterator __i) +{ + typedef typename _Container::iterator __iter; + return insert_iterator<_Container>(__x, __iter(__i)); +} + +_STLP_END_NAMESPACE + +#if ! defined ( _STLP_CLASS_PARTIAL_SPECIALIZATION ) || defined (_STLP_USE_OLD_HP_ITERATOR_QUERIES) +# include +#endif /* __NO_PARTIAL_SPEC || ANACHRONISMS */ + +#endif /* _STLP_INTERNAL_ITERATOR_H */ + +// Local Variables: +// mode:C++ +// End: