diff -r e1b950c65cb4 -r 837f303aceeb epoc32/include/stdapis/stlportv5/stl/_queue.h --- a/epoc32/include/stdapis/stlportv5/stl/_queue.h Wed Mar 31 12:27:01 2010 +0100 +++ b/epoc32/include/stdapis/stlportv5/stl/_queue.h Wed Mar 31 12:33:34 2010 +0100 @@ -9,13 +9,13 @@ * Copyright (c) 1997 * Moscow Center for SPARC Technology * - * Copyright (c) 1999 + * 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 + * 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 @@ -31,7 +31,7 @@ #define _STLP_INTERNAL_QUEUE_H #ifndef _STLP_INTERNAL_DEQUE_H -# include +# include #endif #ifndef _STLP_INTERNAL_VECTOR_H @@ -39,15 +39,15 @@ #endif #ifndef _STLP_INTERNAL_HEAP_H -# include +# include #endif -#ifndef _STLP_INTERNAL_FUNCTION_H -# include +#ifndef _STLP_INTERNAL_FUNCTION_BASE_H +# include #endif -#if defined(__SC__) && !defined(__DMC__) //*ty 12/07/2001 - since "comp" is a built-in type and reserved under SCpp -#define comp _Comp +#if defined(__SC__) && !defined(__DMC__) //*ty 12/07/2001 - since "comp" is a built-in type and reserved under SCpp +# define comp _Comp #endif _STLP_BEGIN_NAMESPACE @@ -60,10 +60,20 @@ # else template # endif - -class queue { +class queue +#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) +# if defined (_STLP_QUEUE_ARGS) + : public __stlport_class > +# else + : public __stlport_class > +# endif +#endif +{ # if defined ( _STLP_QUEUE_ARGS ) typedef deque<_Tp> _Sequence; + typedef queue<_Tp> _Self; +# else + typedef queue<_Tp, _Sequence> _Self; # endif public: typedef typename _Sequence::value_type value_type; @@ -74,11 +84,15 @@ typedef typename _Sequence::const_reference const_reference; protected: + //c is a Standard name (23.2.3.1), do no make it STLport naming convention compliant. _Sequence c; public: queue() : c() {} explicit queue(const _Sequence& __c) : c(__c) {} + queue(__move_source<_Self> src) + : c(_STLP_PRIV _AsMoveSource(src.get().c)) {} + bool empty() const { return c.empty(); } size_type size() const { return c.size(); } reference front() { return c.front(); } @@ -87,44 +101,53 @@ const_reference back() const { return c.back(); } void push(const value_type& __x) { c.push_back(__x); } void pop() { c.pop_front(); } - const _Sequence& _Get_c() const { return c; } + const _Sequence& _Get_s() const { return c; } }; -# ifndef _STLP_QUEUE_ARGS +#ifndef _STLP_QUEUE_ARGS # define _STLP_QUEUE_ARGS _Tp, _Sequence # define _STLP_QUEUE_HEADER_ARGS class _Tp, class _Sequence -# else +#else # define _STLP_QUEUE_HEADER_ARGS class _Tp -# endif +#endif template < _STLP_QUEUE_HEADER_ARGS > -inline bool _STLP_CALL -operator==(const queue<_STLP_QUEUE_ARGS >& __x, const queue<_STLP_QUEUE_ARGS >& __y) -{ - return __x._Get_c() == __y._Get_c(); +inline bool _STLP_CALL +operator==(const queue<_STLP_QUEUE_ARGS >& __x, const queue<_STLP_QUEUE_ARGS >& __y) { + return __x._Get_s() == __y._Get_s(); } template < _STLP_QUEUE_HEADER_ARGS > inline bool _STLP_CALL -operator<(const queue<_STLP_QUEUE_ARGS >& __x, const queue<_STLP_QUEUE_ARGS >& __y) -{ - return __x._Get_c() < __y._Get_c(); +operator<(const queue<_STLP_QUEUE_ARGS >& __x, const queue<_STLP_QUEUE_ARGS >& __y) { + return __x._Get_s() < __y._Get_s(); } _STLP_RELOPS_OPERATORS( template < _STLP_QUEUE_HEADER_ARGS >, queue<_STLP_QUEUE_ARGS > ) # if !(defined ( _STLP_LIMITED_DEFAULT_TEMPLATES ) || defined ( _STLP_TEMPLATE_PARAM_SUBTYPE_BUG )) -template , +template , class _Compare = less<_STLP_HEADER_TYPENAME _Sequence::value_type> > # elif defined ( _STLP_MINIMUM_DEFAULT_TEMPLATE_PARAMS ) template # else template # endif -class priority_queue { +class priority_queue +#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) +# if defined (_STLP_MINIMUM_DEFAULT_TEMPLATE_PARAMS) + : public __stlport_class > +# else + : public __stlport_class > +# endif +#endif +{ # ifdef _STLP_MINIMUM_DEFAULT_TEMPLATE_PARAMS typedef vector<_Tp> _Sequence; - typedef less< typename vector<_Tp>::value_type> _Compare; + typedef less< typename vector<_Tp>::value_type> _Compare; + typedef priority_queue<_Tp> _Self; +# else + typedef priority_queue<_Tp, _Sequence, _Compare> _Self; # endif public: typedef typename _Sequence::value_type value_type; @@ -134,22 +157,27 @@ typedef typename _Sequence::reference reference; typedef typename _Sequence::const_reference const_reference; protected: + //c is a Standard name (23.2.3.2), do no make it STLport naming convention compliant. _Sequence c; _Compare comp; public: priority_queue() : c() {} explicit priority_queue(const _Compare& __x) : c(), comp(__x) {} - explicit priority_queue(const _Compare& __x, const _Sequence& __s) + priority_queue(const _Compare& __x, const _Sequence& __s) : c(__s), comp(__x) { make_heap(c.begin(), c.end(), comp); } + priority_queue(__move_source<_Self> src) + : c(_STLP_PRIV _AsMoveSource(src.get().c)), + comp(_STLP_PRIV _AsMoveSource(src.get().comp)) {} + #ifdef _STLP_MEMBER_TEMPLATES template - priority_queue(_InputIterator __first, _InputIterator __last) + priority_queue(_InputIterator __first, _InputIterator __last) : c(__first, __last) { make_heap(c.begin(), c.end(), comp); } template - priority_queue(_InputIterator __first, + priority_queue(_InputIterator __first, _InputIterator __last, const _Compare& __x) : c(__first, __last), comp(__x) { make_heap(c.begin(), c.end(), comp); } @@ -158,24 +186,24 @@ priority_queue(_InputIterator __first, _InputIterator __last, const _Compare& __x, const _Sequence& __s) : c(__s), comp(__x) - { + { c.insert(c.end(), __first, __last); make_heap(c.begin(), c.end(), comp); } #else /* _STLP_MEMBER_TEMPLATES */ - priority_queue(const value_type* __first, const value_type* __last) + priority_queue(const value_type* __first, const value_type* __last) : c(__first, __last) { make_heap(c.begin(), c.end(), comp); } - priority_queue(const value_type* __first, const value_type* __last, - const _Compare& __x) + priority_queue(const value_type* __first, const value_type* __last, + const _Compare& __x) : c(__first, __last), comp(__x) { make_heap(c.begin(), c.end(), comp); } - priority_queue(const value_type* __first, const value_type* __last, + priority_queue(const value_type* __first, const value_type* __last, const _Compare& __x, const _Sequence& __c) : c(__c), comp(__x) - { + { c.insert(c.end(), __first, __last); make_heap(c.begin(), c.end(), comp); } @@ -186,24 +214,37 @@ const_reference top() const { return c.front(); } void push(const value_type& __x) { _STLP_TRY { - c.push_back(__x); + c.push_back(__x); push_heap(c.begin(), c.end(), comp); } - _STLP_UNWIND(c.clear()); + _STLP_UNWIND(c.clear()) } void pop() { _STLP_TRY { pop_heap(c.begin(), c.end(), comp); c.pop_back(); } - _STLP_UNWIND(c.clear()); + _STLP_UNWIND(c.clear()) } }; +#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) +template +struct __move_traits > : + _STLP_PRIV __move_traits_aux<_Sequence> +{}; + +template +struct __move_traits > : + _STLP_PRIV __move_traits_aux2<_Sequence, _Compare> +{}; +#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */ + _STLP_END_NAMESPACE -# undef _STLP_QUEUE_ARGS -# undef _STLP_QUEUE_HEADER_ARGS +#undef _STLP_QUEUE_ARGS +#undef _STLP_QUEUE_HEADER_ARGS +#undef comp #endif /* _STLP_INTERNAL_QUEUE_H */