4 * Hewlett-Packard Company
6 * Permission to use, copy, modify, distribute and sell this software
7 * and its documentation for any purpose is hereby granted without fee,
8 * provided that the above copyright notice appear in all copies and
9 * that both that copyright notice and this permission notice appear
10 * in supporting documentation. Hewlett-Packard Company makes no
11 * representations about the suitability of this software for any
12 * purpose. It is provided "as is" without express or implied warranty.
15 * Copyright (c) 1996,1997
16 * Silicon Graphics Computer Systems, Inc.
18 * Permission to use, copy, modify, distribute and sell this software
19 * and its documentation for any purpose is hereby granted without fee,
20 * provided that the above copyright notice appear in all copies and
21 * that both that copyright notice and this permission notice appear
22 * in supporting documentation. Silicon Graphics makes no
23 * representations about the suitability of this software for any
24 * purpose. It is provided "as is" without express or implied warranty.
27 /* NOTE: This is an internal header file, included by other STL headers.
28 * You should not attempt to use it directly.
31 #ifndef __SGI_STL_INTERNAL_STACK_H
32 #define __SGI_STL_INTERNAL_STACK_H
36 #ifndef __STL_LIMITED_DEFAULT_TEMPLATES
37 template <class _Tp
, class _Sequence
= deque
<_Tp
> >
39 template <class _Tp
, class _Sequence
>
42 friend bool operator== __STL_NULL_TMPL_ARGS (const stack
&, const stack
&);
43 friend bool operator< __STL_NULL_TMPL_ARGS (const stack
&, const stack
&);
45 typedef typename
_Sequence::value_type value_type
;
46 typedef typename
_Sequence::size_type size_type
;
47 typedef _Sequence container_type
;
49 typedef typename
_Sequence::reference reference
;
50 typedef typename
_Sequence::const_reference const_reference
;
55 explicit stack(const _Sequence
& __s
) : _M_c(__s
) {}
57 bool empty() const { return _M_c
.empty(); }
58 size_type
size() const { return _M_c
.size(); }
59 reference
top() { return _M_c
.back(); }
60 const_reference
top() const { return _M_c
.back(); }
61 void push(const value_type
& __x
) { _M_c
.push_back(__x
); }
62 void pop() { _M_c
.pop_back(); }
65 template <class _Tp
, class _Seq
>
66 bool operator==(const stack
<_Tp
,_Seq
>& __x
, const stack
<_Tp
,_Seq
>& __y
)
68 return __x
._M_c
== __y
._M_c
;
71 template <class _Tp
, class _Seq
>
72 bool operator<(const stack
<_Tp
,_Seq
>& __x
, const stack
<_Tp
,_Seq
>& __y
)
74 return __x
._M_c
< __y
._M_c
;
77 #ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER
79 template <class _Tp
, class _Seq
>
80 bool operator!=(const stack
<_Tp
,_Seq
>& __x
, const stack
<_Tp
,_Seq
>& __y
)
85 template <class _Tp
, class _Seq
>
86 bool operator>(const stack
<_Tp
,_Seq
>& __x
, const stack
<_Tp
,_Seq
>& __y
)
91 template <class _Tp
, class _Seq
>
92 bool operator<=(const stack
<_Tp
,_Seq
>& __x
, const stack
<_Tp
,_Seq
>& __y
)
97 template <class _Tp
, class _Seq
>
98 bool operator>=(const stack
<_Tp
,_Seq
>& __x
, const stack
<_Tp
,_Seq
>& __y
)
103 #endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */
107 #endif /* __SGI_STL_INTERNAL_STACK_H */