epoc32/include/stdapis/stlportv5/stl/_queue.h
branchSymbian3
changeset 4 837f303aceeb
parent 3 e1b950c65cb4
     1.1 --- a/epoc32/include/stdapis/stlportv5/stl/_queue.h	Wed Mar 31 12:27:01 2010 +0100
     1.2 +++ b/epoc32/include/stdapis/stlportv5/stl/_queue.h	Wed Mar 31 12:33:34 2010 +0100
     1.3 @@ -9,13 +9,13 @@
     1.4   * Copyright (c) 1997
     1.5   * Moscow Center for SPARC Technology
     1.6   *
     1.7 - * Copyright (c) 1999 
     1.8 + * Copyright (c) 1999
     1.9   * Boris Fomitchev
    1.10   *
    1.11   * This material is provided "as is", with absolutely no warranty expressed
    1.12   * or implied. Any use is at your own risk.
    1.13   *
    1.14 - * Permission to use or copy this software for any purpose is hereby granted 
    1.15 + * Permission to use or copy this software for any purpose is hereby granted
    1.16   * without fee, provided the above notices are retained on all copies.
    1.17   * Permission to modify the code and to distribute modified code is granted,
    1.18   * provided the above notices are retained, and a notice that the code was
    1.19 @@ -31,7 +31,7 @@
    1.20  #define _STLP_INTERNAL_QUEUE_H
    1.21  
    1.22  #ifndef _STLP_INTERNAL_DEQUE_H
    1.23 -# include <stl/_deque.h>
    1.24 +#  include <stl/_deque.h>
    1.25  #endif
    1.26  
    1.27  #ifndef _STLP_INTERNAL_VECTOR_H
    1.28 @@ -39,15 +39,15 @@
    1.29  #endif
    1.30  
    1.31  #ifndef _STLP_INTERNAL_HEAP_H
    1.32 -# include <stl/_heap.h>
    1.33 +#  include <stl/_heap.h>
    1.34  #endif
    1.35  
    1.36 -#ifndef _STLP_INTERNAL_FUNCTION_H
    1.37 -# include <stl/_function.h>
    1.38 +#ifndef _STLP_INTERNAL_FUNCTION_BASE_H
    1.39 +#  include <stl/_function_base.h>
    1.40  #endif
    1.41  
    1.42 -#if defined(__SC__) && !defined(__DMC__)		//*ty 12/07/2001 - since "comp" is a built-in type and reserved under SCpp
    1.43 -#define comp _Comp
    1.44 +#if defined(__SC__) && !defined(__DMC__)    //*ty 12/07/2001 - since "comp" is a built-in type and reserved under SCpp
    1.45 +#  define comp _Comp
    1.46  #endif
    1.47  
    1.48  _STLP_BEGIN_NAMESPACE
    1.49 @@ -60,10 +60,20 @@
    1.50  # else
    1.51  template <class _Tp, class _Sequence>
    1.52  # endif
    1.53 -
    1.54 -class queue {
    1.55 +class queue
    1.56 +#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND)
    1.57 +#  if defined (_STLP_QUEUE_ARGS)
    1.58 +            : public __stlport_class<queue<_Tp> >
    1.59 +#  else
    1.60 +            : public __stlport_class<queue<_Tp, _Sequence> >
    1.61 +#  endif
    1.62 +#endif
    1.63 +{
    1.64  # if defined ( _STLP_QUEUE_ARGS )
    1.65    typedef deque<_Tp> _Sequence;
    1.66 +  typedef queue<_Tp> _Self;
    1.67 +# else
    1.68 +  typedef queue<_Tp, _Sequence> _Self;
    1.69  # endif
    1.70  public:
    1.71    typedef typename _Sequence::value_type      value_type;
    1.72 @@ -74,11 +84,15 @@
    1.73    typedef typename _Sequence::const_reference const_reference;
    1.74  
    1.75  protected:
    1.76 +  //c is a Standard name (23.2.3.1), do no make it STLport naming convention compliant.
    1.77    _Sequence c;
    1.78  public:
    1.79    queue() : c() {}
    1.80    explicit queue(const _Sequence& __c) : c(__c) {}
    1.81  
    1.82 +  queue(__move_source<_Self> src)
    1.83 +    : c(_STLP_PRIV _AsMoveSource(src.get().c)) {}
    1.84 +
    1.85    bool empty() const { return c.empty(); }
    1.86    size_type size() const { return c.size(); }
    1.87    reference front() { return c.front(); }
    1.88 @@ -87,44 +101,53 @@
    1.89    const_reference back() const { return c.back(); }
    1.90    void push(const value_type& __x) { c.push_back(__x); }
    1.91    void pop() { c.pop_front(); }
    1.92 -  const _Sequence& _Get_c() const { return c; }
    1.93 +  const _Sequence& _Get_s() const { return c; }
    1.94  };
    1.95  
    1.96 -# ifndef _STLP_QUEUE_ARGS
    1.97 +#ifndef _STLP_QUEUE_ARGS
    1.98  #  define _STLP_QUEUE_ARGS _Tp, _Sequence
    1.99  #  define _STLP_QUEUE_HEADER_ARGS class _Tp, class _Sequence
   1.100 -# else
   1.101 +#else
   1.102  #  define _STLP_QUEUE_HEADER_ARGS class _Tp
   1.103 -# endif
   1.104 +#endif
   1.105  
   1.106  template < _STLP_QUEUE_HEADER_ARGS >
   1.107 -inline bool _STLP_CALL 
   1.108 -operator==(const queue<_STLP_QUEUE_ARGS >& __x, const queue<_STLP_QUEUE_ARGS >& __y)
   1.109 -{
   1.110 -  return __x._Get_c() == __y._Get_c();
   1.111 +inline bool _STLP_CALL
   1.112 +operator==(const queue<_STLP_QUEUE_ARGS >& __x, const queue<_STLP_QUEUE_ARGS >& __y) {
   1.113 +  return __x._Get_s() == __y._Get_s();
   1.114  }
   1.115  
   1.116  template < _STLP_QUEUE_HEADER_ARGS >
   1.117  inline bool _STLP_CALL
   1.118 -operator<(const queue<_STLP_QUEUE_ARGS >& __x, const queue<_STLP_QUEUE_ARGS >& __y)
   1.119 -{
   1.120 -  return __x._Get_c() < __y._Get_c();
   1.121 +operator<(const queue<_STLP_QUEUE_ARGS >& __x, const queue<_STLP_QUEUE_ARGS >& __y) {
   1.122 +  return __x._Get_s() < __y._Get_s();
   1.123  }
   1.124  
   1.125  _STLP_RELOPS_OPERATORS( template < _STLP_QUEUE_HEADER_ARGS >, queue<_STLP_QUEUE_ARGS > )
   1.126  
   1.127  # if !(defined ( _STLP_LIMITED_DEFAULT_TEMPLATES ) || defined ( _STLP_TEMPLATE_PARAM_SUBTYPE_BUG ))
   1.128 -template <class _Tp, class _Sequence = vector<_Tp>, 
   1.129 +template <class _Tp, class _Sequence = vector<_Tp>,
   1.130            class _Compare = less<_STLP_HEADER_TYPENAME _Sequence::value_type> >
   1.131  # elif defined ( _STLP_MINIMUM_DEFAULT_TEMPLATE_PARAMS )
   1.132  template <class _Tp>
   1.133  # else
   1.134  template <class _Tp, class _Sequence, class _Compare>
   1.135  # endif
   1.136 -class  priority_queue {
   1.137 +class priority_queue
   1.138 +#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND)
   1.139 +#  if defined (_STLP_MINIMUM_DEFAULT_TEMPLATE_PARAMS)
   1.140 +            : public __stlport_class<priority_queue<_Tp> >
   1.141 +#  else
   1.142 +            : public __stlport_class<priority_queue<_Tp, _Sequence> >
   1.143 +#  endif
   1.144 +#endif
   1.145 +{
   1.146  # ifdef _STLP_MINIMUM_DEFAULT_TEMPLATE_PARAMS
   1.147    typedef vector<_Tp> _Sequence;
   1.148 -  typedef less< typename vector<_Tp>::value_type> _Compare; 
   1.149 +  typedef less< typename vector<_Tp>::value_type> _Compare;
   1.150 +  typedef priority_queue<_Tp> _Self;
   1.151 +# else
   1.152 +  typedef priority_queue<_Tp, _Sequence, _Compare> _Self;
   1.153  # endif
   1.154  public:
   1.155    typedef typename _Sequence::value_type      value_type;
   1.156 @@ -134,22 +157,27 @@
   1.157    typedef typename _Sequence::reference       reference;
   1.158    typedef typename _Sequence::const_reference const_reference;
   1.159  protected:
   1.160 +  //c is a Standard name (23.2.3.2), do no make it STLport naming convention compliant.
   1.161    _Sequence c;
   1.162    _Compare comp;
   1.163  public:
   1.164    priority_queue() : c() {}
   1.165    explicit priority_queue(const _Compare& __x) :  c(), comp(__x) {}
   1.166 -  explicit  priority_queue(const _Compare& __x, const _Sequence& __s) 
   1.167 +  priority_queue(const _Compare& __x, const _Sequence& __s)
   1.168      : c(__s), comp(__x)
   1.169      { make_heap(c.begin(), c.end(), comp); }
   1.170  
   1.171 +  priority_queue(__move_source<_Self> src)
   1.172 +    : c(_STLP_PRIV _AsMoveSource(src.get().c)),
   1.173 +      comp(_STLP_PRIV _AsMoveSource(src.get().comp)) {}
   1.174 +
   1.175  #ifdef _STLP_MEMBER_TEMPLATES
   1.176    template <class _InputIterator>
   1.177 -  priority_queue(_InputIterator __first, _InputIterator __last) 
   1.178 +  priority_queue(_InputIterator __first, _InputIterator __last)
   1.179      : c(__first, __last) { make_heap(c.begin(), c.end(), comp); }
   1.180  
   1.181    template <class _InputIterator>
   1.182 -  priority_queue(_InputIterator __first, 
   1.183 +  priority_queue(_InputIterator __first,
   1.184                   _InputIterator __last, const _Compare& __x)
   1.185      : c(__first, __last), comp(__x)
   1.186      { make_heap(c.begin(), c.end(), comp); }
   1.187 @@ -158,24 +186,24 @@
   1.188    priority_queue(_InputIterator __first, _InputIterator __last,
   1.189                   const _Compare& __x, const _Sequence& __s)
   1.190    : c(__s), comp(__x)
   1.191 -  { 
   1.192 +  {
   1.193      c.insert(c.end(), __first, __last);
   1.194      make_heap(c.begin(), c.end(), comp);
   1.195    }
   1.196  
   1.197  #else /* _STLP_MEMBER_TEMPLATES */
   1.198 -  priority_queue(const value_type* __first, const value_type* __last) 
   1.199 +  priority_queue(const value_type* __first, const value_type* __last)
   1.200      : c(__first, __last) { make_heap(c.begin(), c.end(), comp); }
   1.201  
   1.202 -  priority_queue(const value_type* __first, const value_type* __last, 
   1.203 -                 const _Compare& __x) 
   1.204 +  priority_queue(const value_type* __first, const value_type* __last,
   1.205 +                 const _Compare& __x)
   1.206      : c(__first, __last), comp(__x)
   1.207      { make_heap(c.begin(), c.end(), comp); }
   1.208  
   1.209 -  priority_queue(const value_type* __first, const value_type* __last, 
   1.210 +  priority_queue(const value_type* __first, const value_type* __last,
   1.211                   const _Compare& __x, const _Sequence& __c)
   1.212      : c(__c), comp(__x)
   1.213 -  { 
   1.214 +  {
   1.215      c.insert(c.end(), __first, __last);
   1.216      make_heap(c.begin(), c.end(), comp);
   1.217    }
   1.218 @@ -186,24 +214,37 @@
   1.219    const_reference top() const { return c.front(); }
   1.220    void push(const value_type& __x) {
   1.221      _STLP_TRY {
   1.222 -      c.push_back(__x); 
   1.223 +      c.push_back(__x);
   1.224        push_heap(c.begin(), c.end(), comp);
   1.225      }
   1.226 -    _STLP_UNWIND(c.clear());
   1.227 +    _STLP_UNWIND(c.clear())
   1.228    }
   1.229    void pop() {
   1.230      _STLP_TRY {
   1.231        pop_heap(c.begin(), c.end(), comp);
   1.232        c.pop_back();
   1.233      }
   1.234 -    _STLP_UNWIND(c.clear());
   1.235 +    _STLP_UNWIND(c.clear())
   1.236    }
   1.237  };
   1.238  
   1.239 +#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
   1.240 +template <class _Tp, class _Sequence>
   1.241 +struct __move_traits<queue<_Tp, _Sequence> > :
   1.242 +  _STLP_PRIV __move_traits_aux<_Sequence>
   1.243 +{};
   1.244 +
   1.245 +template <class _Tp, class _Sequence, class _Compare>
   1.246 +struct __move_traits<priority_queue<_Tp, _Sequence, _Compare> > :
   1.247 +  _STLP_PRIV __move_traits_aux2<_Sequence, _Compare>
   1.248 +{};
   1.249 +#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
   1.250 +
   1.251  _STLP_END_NAMESPACE
   1.252  
   1.253 -#  undef _STLP_QUEUE_ARGS
   1.254 -#  undef _STLP_QUEUE_HEADER_ARGS
   1.255 +#undef _STLP_QUEUE_ARGS
   1.256 +#undef _STLP_QUEUE_HEADER_ARGS
   1.257 +#undef comp
   1.258  
   1.259  #endif /* _STLP_INTERNAL_QUEUE_H */
   1.260