#ifndef STK_H #define STK_H_ 1 // DO NOT DISTRIBUTE. // Massingill, Berna L. // Sometime // CS1321 // Stack Implementation // This template class implements a stack. #include #include // has assert() #include template class stack { public: typedef T value_type; typedef typename vector::size_type size_type; // need "typename" bool empty(void) const { return v.empty(); } size_type size(void) const { return v.size(); } void push(const value_type & x) { v.push_back(x); } void pop(void) { assert(!v.empty()); v.pop_back(); } value_type top(void) const { assert (!v.empty()); return v.back(); } private: vector v; }; // end of DO NOT DISTRIBUTE. #endif // STK_H_