The standard class stack prefers speed over convenience and safety. This is not what I usually
prefer, so I have written my own stack class, which has the following two advantages:
1. pop() returns the next element.
2. pop() and top() throw exceptions when the stack is empty.
In addition, I have skipped the members that are not necessary for the ordinary stack user, such as
the comparison operations. My stack class is defined as follows: