epoc32/include/stdapis/stlportv5/stl/_stack.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:27:01 +0100
branchSymbian2
changeset 3 e1b950c65cb4
parent 2 epoc32/include/stdapis/stlport/stl/_stack.h@2fe1408b6811
child 4 837f303aceeb
permissions -rw-r--r--
Attempt to represent the S^2->S^3 header reorganisation as a series of "hg rename" operations
williamr@2
     1
/*
williamr@2
     2
 *
williamr@2
     3
 * Copyright (c) 1994
williamr@2
     4
 * Hewlett-Packard Company
williamr@2
     5
 *
williamr@2
     6
 * Copyright (c) 1996,1997
williamr@2
     7
 * Silicon Graphics Computer Systems, Inc.
williamr@2
     8
 *
williamr@2
     9
 * Copyright (c) 1997
williamr@2
    10
 * Moscow Center for SPARC Technology
williamr@2
    11
 *
williamr@2
    12
 * Copyright (c) 1999 
williamr@2
    13
 * Boris Fomitchev
williamr@2
    14
 *
williamr@2
    15
 * This material is provided "as is", with absolutely no warranty expressed
williamr@2
    16
 * or implied. Any use is at your own risk.
williamr@2
    17
 *
williamr@2
    18
 * Permission to use or copy this software for any purpose is hereby granted 
williamr@2
    19
 * without fee, provided the above notices are retained on all copies.
williamr@2
    20
 * Permission to modify the code and to distribute modified code is granted,
williamr@2
    21
 * provided the above notices are retained, and a notice that the code was
williamr@2
    22
 * modified is included with the above copyright notice.
williamr@2
    23
 *
williamr@2
    24
 */
williamr@2
    25
williamr@2
    26
/* NOTE: This is an internal header file, included by other STL headers.
williamr@2
    27
 *   You should not attempt to use it directly.
williamr@2
    28
 */
williamr@2
    29
williamr@2
    30
#ifndef _STLP_INTERNAL_STACK_H
williamr@2
    31
#define _STLP_INTERNAL_STACK_H
williamr@2
    32
williamr@2
    33
#ifndef _STLP_INTERNAL_DEQUE_H
williamr@2
    34
# include <stl/_deque.h>
williamr@2
    35
#endif
williamr@2
    36
williamr@2
    37
_STLP_BEGIN_NAMESPACE
williamr@2
    38
williamr@2
    39
# if !defined ( _STLP_LIMITED_DEFAULT_TEMPLATES )
williamr@2
    40
template <class _Tp, class _Sequence = deque<_Tp> >
williamr@2
    41
# elif defined ( _STLP_MINIMUM_DEFAULT_TEMPLATE_PARAMS )
williamr@2
    42
# define _STLP_STACK_ARGS _Tp
williamr@2
    43
template <class _Tp>
williamr@2
    44
# else
williamr@2
    45
template <class _Tp, class _Sequence>
williamr@2
    46
# endif
williamr@2
    47
class stack {
williamr@2
    48
williamr@2
    49
# ifdef _STLP_STACK_ARGS 
williamr@2
    50
  typedef deque<_Tp> _Sequence;
williamr@2
    51
# endif
williamr@2
    52
williamr@2
    53
public:
williamr@2
    54
  typedef typename _Sequence::value_type      value_type;
williamr@2
    55
  typedef typename _Sequence::size_type       size_type;
williamr@2
    56
  typedef          _Sequence                  container_type;
williamr@2
    57
williamr@2
    58
  typedef typename _Sequence::reference       reference;
williamr@2
    59
  typedef typename _Sequence::const_reference const_reference;
williamr@2
    60
protected:
williamr@2
    61
  _Sequence c;
williamr@2
    62
public:
williamr@2
    63
  stack() : c() {}
williamr@2
    64
  explicit stack(const _Sequence& __s) : c(__s) {}
williamr@2
    65
williamr@2
    66
  bool empty() const { return c.empty(); }
williamr@2
    67
  size_type size() const { return c.size(); }
williamr@2
    68
  reference top() { return c.back(); }
williamr@2
    69
  const_reference top() const { return c.back(); }
williamr@2
    70
  void push(const value_type& __x) { c.push_back(__x); }
williamr@2
    71
  void pop() { c.pop_back(); }
williamr@2
    72
  const _Sequence& _Get_c() const { return c; }
williamr@2
    73
};
williamr@2
    74
williamr@2
    75
# ifndef _STLP_STACK_ARGS
williamr@2
    76
#  define _STLP_STACK_ARGS _Tp, _Sequence
williamr@2
    77
#  define _STLP_STACK_HEADER_ARGS class _Tp, class _Sequence
williamr@2
    78
# else
williamr@2
    79
#  define _STLP_STACK_HEADER_ARGS class _Tp
williamr@2
    80
# endif
williamr@2
    81
williamr@2
    82
template < _STLP_STACK_HEADER_ARGS >
williamr@2
    83
inline bool _STLP_CALL  operator==(const stack< _STLP_STACK_ARGS >& __x, const stack< _STLP_STACK_ARGS >& __y)
williamr@2
    84
{
williamr@2
    85
  return __x._Get_c() == __y._Get_c();
williamr@2
    86
}
williamr@2
    87
williamr@2
    88
template < _STLP_STACK_HEADER_ARGS >
williamr@2
    89
inline bool _STLP_CALL  operator<(const stack< _STLP_STACK_ARGS >& __x, const stack< _STLP_STACK_ARGS >& __y)
williamr@2
    90
{
williamr@2
    91
  return __x._Get_c() < __y._Get_c();
williamr@2
    92
}
williamr@2
    93
williamr@2
    94
_STLP_RELOPS_OPERATORS(template < _STLP_STACK_HEADER_ARGS >, stack< _STLP_STACK_ARGS >)
williamr@2
    95
    
williamr@2
    96
_STLP_END_NAMESPACE
williamr@2
    97
williamr@2
    98
#  undef _STLP_STACK_ARGS
williamr@2
    99
#  undef _STLP_STACK_HEADER_ARGS
williamr@2
   100
williamr@2
   101
#endif /* _STLP_INTERNAL_STACK_H */
williamr@2
   102
williamr@2
   103
// Local Variables:
williamr@2
   104
// mode:C++
williamr@2
   105
// End: