Gobelijn API documentation  - generated for commit a0cbea7
 All Classes Namespaces Files Functions Variables Typedefs Friends Macros Pages
stack3.cpp
Go to the documentation of this file.
1 
7 // BEGIN_SNIPPET{FullSource}
8 #include "stack3.hpp"
9 #include <deque>
10 #include <iostream>
11 
12 int main()
13 {
14  try {
15  Stack<int> intStack;
17 
18  intStack.push(7);
19  std::cout << intStack.top() << std::endl;
20 
21  dblStack.push(42.42);
22  std::cout << dblStack.top() << std::endl;
23  dblStack.pop();
24  } catch (std::exception const& ex) {
25  std::cerr << "Exception: " << ex.what() << std::endl;
26  return EXIT_FAILURE;
27  }
28  return 0;
29 }
30 // END_SNIPPET{FullSource}
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 template.
Stack class using vector as element container.
Definition: stack1.hpp:15
int main()
Definition: stack3.cpp:12
T top() const
Return top element of the stack (but not pop-ing it).
Definition: stack1.hpp:58