source: trunk/src/emx/include/Attic/cpp/stl_stac.h@ 18

Last change on this file since 18 was 18, checked in by bird, 23 years ago

Initial revision

  • Property cvs2svn:cvs-rev set to 1.1
  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 2.5 KB
Line 
1/*
2 *
3 * Copyright (c) 1994
4 * Hewlett-Packard Company
5 *
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.
13 *
14 *
15 * Copyright (c) 1996,1997
16 * Silicon Graphics Computer Systems, Inc.
17 *
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.
25 */
26
27/* NOTE: This is an internal header file, included by other STL headers.
28 * You should not attempt to use it directly.
29 */
30
31#ifndef __SGI_STL_INTERNAL_STACK_H
32#define __SGI_STL_INTERNAL_STACK_H
33
34__STL_BEGIN_NAMESPACE
35
36#ifndef __STL_LIMITED_DEFAULT_TEMPLATES
37template <class T, class Sequence = deque<T> >
38#else
39template <class T, class Sequence>
40#endif
41class 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&);
44public:
45 typedef typename Sequence::value_type value_type;
46 typedef typename Sequence::size_type size_type;
47 typedef typename Sequence::reference reference;
48 typedef typename Sequence::const_reference const_reference;
49protected:
50 Sequence c;
51public:
52 bool empty() const { return c.empty(); }
53 size_type size() const { return c.size(); }
54 reference top() { return c.back(); }
55 const_reference top() const { return c.back(); }
56 void push(const value_type& x) { c.push_back(x); }
57 void pop() { c.pop_back(); }
58};
59
60template <class T, class Sequence>
61bool operator==(const stack<T, Sequence>& x, const stack<T, Sequence>& y) {
62 return x.c == y.c;
63}
64
65template <class T, class Sequence>
66bool operator<(const stack<T, Sequence>& x, const stack<T, Sequence>& y) {
67 return x.c < y.c;
68}
69
70__STL_END_NAMESPACE
71
72#endif /* __SGI_STL_INTERNAL_STACK_H */
73
74// Local Variables:
75// mode:C++
76// End:
Note: See TracBrowser for help on using the repository browser.