1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/epoc32/include/stdapis/stlport/stl/_stack.h Wed Mar 31 12:33:34 2010 +0100
1.3 @@ -0,0 +1,105 @@
1.4 +/*
1.5 + *
1.6 + * Copyright (c) 1994
1.7 + * Hewlett-Packard Company
1.8 + *
1.9 + * Copyright (c) 1996,1997
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_STACK_H
1.34 +#define _STLP_INTERNAL_STACK_H
1.35 +
1.36 +#ifndef _STLP_INTERNAL_DEQUE_H
1.37 +# include <stl/_deque.h>
1.38 +#endif
1.39 +
1.40 +_STLP_BEGIN_NAMESPACE
1.41 +
1.42 +# if !defined ( _STLP_LIMITED_DEFAULT_TEMPLATES )
1.43 +template <class _Tp, class _Sequence = deque<_Tp> >
1.44 +# elif defined ( _STLP_MINIMUM_DEFAULT_TEMPLATE_PARAMS )
1.45 +# define _STLP_STACK_ARGS _Tp
1.46 +template <class _Tp>
1.47 +# else
1.48 +template <class _Tp, class _Sequence>
1.49 +# endif
1.50 +class stack {
1.51 +
1.52 +# ifdef _STLP_STACK_ARGS
1.53 + typedef deque<_Tp> _Sequence;
1.54 +# endif
1.55 +
1.56 +public:
1.57 + typedef typename _Sequence::value_type value_type;
1.58 + typedef typename _Sequence::size_type size_type;
1.59 + typedef _Sequence container_type;
1.60 +
1.61 + typedef typename _Sequence::reference reference;
1.62 + typedef typename _Sequence::const_reference const_reference;
1.63 +protected:
1.64 + _Sequence c;
1.65 +public:
1.66 + stack() : c() {}
1.67 + explicit stack(const _Sequence& __s) : c(__s) {}
1.68 +
1.69 + bool empty() const { return c.empty(); }
1.70 + size_type size() const { return c.size(); }
1.71 + reference top() { return c.back(); }
1.72 + const_reference top() const { return c.back(); }
1.73 + void push(const value_type& __x) { c.push_back(__x); }
1.74 + void pop() { c.pop_back(); }
1.75 + const _Sequence& _Get_c() const { return c; }
1.76 +};
1.77 +
1.78 +# ifndef _STLP_STACK_ARGS
1.79 +# define _STLP_STACK_ARGS _Tp, _Sequence
1.80 +# define _STLP_STACK_HEADER_ARGS class _Tp, class _Sequence
1.81 +# else
1.82 +# define _STLP_STACK_HEADER_ARGS class _Tp
1.83 +# endif
1.84 +
1.85 +template < _STLP_STACK_HEADER_ARGS >
1.86 +inline bool _STLP_CALL operator==(const stack< _STLP_STACK_ARGS >& __x, const stack< _STLP_STACK_ARGS >& __y)
1.87 +{
1.88 + return __x._Get_c() == __y._Get_c();
1.89 +}
1.90 +
1.91 +template < _STLP_STACK_HEADER_ARGS >
1.92 +inline bool _STLP_CALL operator<(const stack< _STLP_STACK_ARGS >& __x, const stack< _STLP_STACK_ARGS >& __y)
1.93 +{
1.94 + return __x._Get_c() < __y._Get_c();
1.95 +}
1.96 +
1.97 +_STLP_RELOPS_OPERATORS(template < _STLP_STACK_HEADER_ARGS >, stack< _STLP_STACK_ARGS >)
1.98 +
1.99 +_STLP_END_NAMESPACE
1.100 +
1.101 +# undef _STLP_STACK_ARGS
1.102 +# undef _STLP_STACK_HEADER_ARGS
1.103 +
1.104 +#endif /* _STLP_INTERNAL_STACK_H */
1.105 +
1.106 +// Local Variables:
1.107 +// mode:C++
1.108 +// End: