aboutsummaryrefslogtreecommitdiff
path: root/src/stack.hpp
blob: 4da5f7666e8933708b7c1ad0e7862c45315eeca4 (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
#pragma once

#include <vector>

/**
 * A stack data structure.
 */
template <typename Item>
class Stack
{
public:
	/**
	 * Creates a stack.
	 *
	 * @param capacity The capacity of the stack
	 */
	Stack(unsigned long 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"