22 #ifndef COMMON_STACK_H 23 #define COMMON_STACK_H 25 #include "common/scummsys.h" 26 #include "common/array.h" 42 template<
class T, u
int MAX_SIZE = 10>
45 typedef uint size_type;
57 void push(
const T &x) {
58 assert(_size < MAX_SIZE);
62 const T &top()
const {
64 return _stack[_size - 1];
69 return _stack[_size - 1];
78 size_type size()
const {
82 T &operator[](size_type i) {
87 const T &operator[](size_type i)
const {
113 return _stack.
empty();
120 void push(
const T &x) {
125 return _stack.
back();
128 const T &top()
const {
129 return _stack.
back();
133 T tmp = _stack.
back();
138 size_type size()
const {
139 return _stack.
size();
142 T &operator[](size_type i) {
146 const T &operator[](size_type i)
const {
void clear()
Definition: array.h:280
bool empty() const
Definition: array.h:311
void push_back(const T &element)
Definition: array.h:142
Definition: algorithm.h:29
void pop_back()
Definition: array.h:159
size_type size() const
Definition: array.h:275
uint size_type
Definition: array.h:59
T & back()
Definition: array.h:189