aboutsummaryrefslogtreecommitdiff
path: root/src/app/stack.hpp
blob: aec6d5e47ad64d641a15dda9f0cd23c875a770fa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#pragma once

#include <cstdint>
#include <vector>

/**
 * A stack data structure.
 */
template <typename Item>
class Stack
{
public:
	/**
	 * Creates a stack.
	 *
	 * @param capacity The capacity of the stack
	 */
	explicit Stack(const uint64_t &capacity);

	/**
	 * Pushes a item onto the stack.
	 */
	void push(Item item);

	/**
	 * Pops the topmost item from the stack.
	 */
	void pop();

	/**
	 * Peeks into the stack.
	 *
	 * @returns The topmost stack item.
	 */
	Item peek();

private:
	std::vector<Item> _items;
};

#include "stack.tpp"