blob: 91fdb65a6a216a1d2a39558c0f94aaa94b499c85 (
plain) (
blame)
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
|
#ifndef STACK_STATIC
#define STACK_STATIC
#define STACK_SIZE 1024
template <class T>
class Stack {
T vals[STACK_SIZE];
unsigned topPos = 0;
public:
void push(const T& v);
void pop();
T& top();
};
template <class T>
void Stack<T>::push(const T& v) {
vals[topPos++] = v;
}
template <class T>
void Stack<T>::pop() {
topPos--;
}
template <class T>
T& Stack<T>::top() {
return vals[topPos - 1];
}
#endif
|