summaryrefslogtreecommitdiffstats
path: root/memory-classes.hpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--memory-classes.hpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/memory-classes.hpp b/memory-classes.hpp
new file mode 100644
index 0000000..8d9b31d
--- /dev/null
+++ b/memory-classes.hpp
@@ -0,0 +1,23 @@
+#pragma once
+
+#include <cstddef>
+
+// a very crappy lifo class
+class lifo {
+public:
+ const std::size_t max_size;
+
+ // no default constructor
+ lifo() = delete;
+
+ lifo(std::size_t max_size);
+ // this is a destructor
+ ~lifo();
+
+ void push(int v);
+ int pop();
+
+private:
+ unsigned m_top = 0;
+ int *m_storage = nullptr;
+};