Gobelijn API documentation  - generated for commit a0cbea7
 All Classes Namespaces Files Functions Variables Typedefs Friends Macros Pages
stack4.cpp
Go to the documentation of this file.
1 
7 #include "stack4.hpp"
8 #include <iostream>
9 
10 int main()
11 {
12  try {
13  Stack<int, 20> int20Stack;
14  Stack<std::string, 40> stringStack;
15  int20Stack.push(7);
16  std::cout << int20Stack.top() << std::endl;
17  int20Stack.pop();
18  stringStack.push("hello");
19  std::cout << stringStack.top() << std::endl;
20  stringStack.pop();
21  } catch (std::exception const& ex) {
22  std::cerr << "Exception: " << ex.what() << std::endl;
23  return EXIT_FAILURE;
24  }
25  return 0;
26 }
void pop()
Pop element off the stack.
Definition: stack1.hpp:43
void push(const T &e)
Pushes element onto stack.
Definition: stack1.hpp:52
Stack class using vector as element container.
Definition: stack1.hpp:15
T top() const
Return top element of the stack (but not pop-ing it).
Definition: stack1.hpp:58
Template function returns maximum.
int main()
Definition: stack4.cpp:10