summaryrefslogtreecommitdiffstats
path: root/memory-classes.hpp
blob: 8d9b31db2869ea30641cd186bad141d49cde47da (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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;
};