diff options
author | Nao Pross <naopross@thearcway.org> | 2018-12-08 12:58:04 +0100 |
---|---|---|
committer | Nao Pross <naopross@thearcway.org> | 2018-12-08 12:58:04 +0100 |
commit | 05f2df34290af477b0fee49b75e5f56e1d6c83f9 (patch) | |
tree | 66a7214321c874be02d1a4a9b4fd3f489dc09ad8 /memory-classes.hpp | |
download | cplusplus-05f2df34290af477b0fee49b75e5f56e1d6c83f9.tar.gz cplusplus-05f2df34290af477b0fee49b75e5f56e1d6c83f9.zip |
Initial commit with kinda crappy unnumbered examples
Diffstat (limited to '')
-rw-r--r-- | memory-classes.hpp | 23 |
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; +}; |