18 std::cout << intStack.
top() << std::endl;
20 stringStack.
push(
"hello");
21 std::cout << stringStack.
top() << std::endl;
23 }
catch (std::exception
const& ex) {
24 std::cerr <<
"Exception: " << ex.what() << std::endl;
void pop()
Pop element off the stack.
void push(const T &e)
Pushes element onto stack.
Stack class using vector as element container.
T top() const
Return top element of the stack (but not pop-ing it).
void push(const std::string &s)
Pushes element onto stack.
std::string top() const
Return top element of the stack (but not pop-ing it).
Specialisation for string as element type.