blob: b156242db5e7fc61333589b9e6ac313bd9a66ecc (
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
42
43
|
#ifndef STACK_HPP
#define STACK_HPP
#include <vector>
/**
* A stack data structure.
*/
template <typename Item>
class Stack
{
public:
/**
* Creates a stack.
*
* @param capacity The capacity of the stack
*/
Stack(int 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"
#endif
|