Install msysDVLPR-1.0.0-alpha-1
[msysgit.git] / include / g++-3 / stl_stack.h
blob2a04b21e5070d3f1a9166b660eb25465cd821eb4
1 /*
3 * Copyright (c) 1994
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
34 __STL_BEGIN_NAMESPACE
36 #ifndef __STL_LIMITED_DEFAULT_TEMPLATES
37 template <class _Tp, class _Sequence = deque<_Tp> >
38 #else
39 template <class _Tp, class _Sequence>
40 #endif
41 class stack {
42 friend bool operator== __STL_NULL_TMPL_ARGS (const stack&, const stack&);
43 friend bool operator< __STL_NULL_TMPL_ARGS (const stack&, const stack&);
44 public:
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;
51 protected:
52 _Sequence _M_c;
53 public:
54 stack() : _M_c() {}
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)
82 return !(__x == __y);
85 template <class _Tp, class _Seq>
86 bool operator>(const stack<_Tp,_Seq>& __x, const stack<_Tp,_Seq>& __y)
88 return __y < __x;
91 template <class _Tp, class _Seq>
92 bool operator<=(const stack<_Tp,_Seq>& __x, const stack<_Tp,_Seq>& __y)
94 return !(__y < __x);
97 template <class _Tp, class _Seq>
98 bool operator>=(const stack<_Tp,_Seq>& __x, const stack<_Tp,_Seq>& __y)
100 return !(__x < __y);
103 #endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */
105 __STL_END_NAMESPACE
107 #endif /* __SGI_STL_INTERNAL_STACK_H */
109 // Local Variables:
110 // mode:C++
111 // End: