Listing 1: Template class <stack>
// TEMPLATE CLASS stack
template<class Ty, class C = deque<Ty> >
class stack {
public:
typedef C container_type;
typedef typename C::value_type value_type;
typedef typename C::size_type size_type;
explicit stack(const C& Cont)
: c(Cont) {}
explicit stack()
: c() {}
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(); }
bool operator==(const stack<TY, C>& _X) const
{return (c == _X.c); }
bool operator!=(const stack<TY, C>& _X) const
{return (!(*this == _X)); }
bool operator<(const stack<TY, C>& _X) const
{return (c < _X.c); }
bool operator>(const stack<TY, C>& _X) const
{return (_X < *this); }
bool operator<=(const stack<TY, C>& _X) const
{return (!(_X < *this)); }
bool operator>=(const stack<TY, C>& _X) const
{return (!(*this < _X)); }
protected:
C c;
};
/* End of File */