Gobelijn API documentation  - generated for commit a0cbea7
 All Classes Namespaces Files Functions Variables Typedefs Friends Macros Pages
stack2.cpp
Go to the documentation of this file.
1 
7 // BEGIN_SNIPPET{FullSource}
8 #include "stack2.hpp"
9 #include <iostream>
10 
11 int main()
12 {
13  try {
14  Stack<std::string> stringStack;
15  stringStack.push("hello");
16  std::cout << stringStack.top() << std::endl;
17  stringStack.pop();
18  } catch (std::exception const& ex) {
19  std::cerr << "Exception: " << ex.what() << std::endl;
20  return EXIT_FAILURE; // exit program with ERROR status
21  }
22  return 0;
23 }
24 // END_SNIPPET{FullSource}
void pop()
Pop element off the stack.
Definition: stack2.hpp:43
int main()
Definition: stack2.cpp:11
Full specialisation of stack class template.
void push(const std::string &s)
Pushes element onto stack.
Definition: stack2.hpp:51
std::string top() const
Return top element of the stack (but not pop-ing it).
Definition: stack2.hpp:53
Specialisation for string as element type.
Definition: stack2.hpp:16