Class Template Stack<T>’s Member Functions
The member-function definitions of a class template are function templates, but are not preceded with the
template keyword and template parameters in angle brackets (
>) when they’re defined within the class template’s body. As you can see, however, they do use the class template’s template parameter
T to represent the element type. Our
Stack class template does not define it’s own constructors—the default constructor provided by the compiler will invoke the
deque’s default constructor. We also provide the following member functions in Fig. 18.1:
top (lines 12–15) returns a reference to the
Stack’s top element.
push (lines 18–21) places a new element on the top of the
pop (lines 24–27) ...