summaryrefslogtreecommitdiff
path: root/algo1w4d1/Stack.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'algo1w4d1/Stack.cpp')
-rw-r--r--algo1w4d1/Stack.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/algo1w4d1/Stack.cpp b/algo1w4d1/Stack.cpp
new file mode 100644
index 0000000..a83dd50
--- /dev/null
+++ b/algo1w4d1/Stack.cpp
@@ -0,0 +1,23 @@
+#include "Stack.h"
+
+Stack::Stack() {}
+Stack::~Stack() {}
+
+void Stack::push(const std::string& s) {
+ _stack.push_back(std::string(s));
+}
+
+const std::string& Stack::pop() {
+ const std::string& s = _stack.back();
+ _stack.pop_back();
+ return s;
+}
+
+const std::string& Stack::peek() {
+ return _stack.back();
+}
+
+unsigned Stack::size() {
+ return _stack.size();
+}
+