/** -*- C++ -*- ** ** KAI C++ Compiler ** ** Copyright (C) 1996-2001 Intel Corp. All rights reserved. **/ /** ** Lib++ : The Modena C++ Standard Library, ** Version 2.4, October 1997 ** ** Copyright (c) 1995-1997 Modena Software Inc. **/ #ifndef __KAI_STACK #define __KAI_STACK #include #include namespace std { // Subclause 23.2.3.3 -- class stack template > class stack { template friend bool operator==(const stack& x, const stack& y); template friend bool operator<(const stack& x, const stack& y); template friend bool operator!=(const stack& x, const stack& y); template friend bool operator>(const stack& x, const stack& y); template friend bool operator>=(const stack& x, const stack& y); template friend bool operator<=(const stack& x, const stack& y); public: typedef typename Container::value_type value_type; typedef typename Container::size_type size_type; typedef Container container_type; protected: Container c; public: explicit stack(const Container& container = Container()) : c (container){} bool empty() const { return c.empty(); } size_type size() const { return c.size(); } value_type& top() { return c.back(); } const value_type& top() const { return c.back(); } void push(const value_type& x) { c.push_back(x); } void pop() { c.pop_back(); } }; template bool operator==(const stack& x, const stack& y) { return x.c == y.c; } template bool operator<(const stack& x, const stack& y) { return x.c < y.c; } template bool operator!=(const stack& x, const stack& y) { return x.c != y.c; } template bool operator>(const stack& x, const stack& y) { return x.c > y.c; } template bool operator>=(const stack& x, const stack& y) { return x.c >= y.c; } template bool operator<=(const stack& x, const stack& y) { return x.c <= y.c; } } // namespace std #endif /* __KAI_STACK */