1 /* Stack - a template stack class (plus some handy methods)
3 * Copyright 2001-2005, Axel Dörfler, axeld@pinc-software.de.
4 * This file may be used under the terms of the MIT License.
6 #ifndef KERNEL_UTIL_STACK_H
7 #define KERNEL_UTIL_STACK_H
10 #include <SupportDefs.h>
13 template<class T
> class Stack
{
35 // could also free the memory
39 status_t
Push(T value
)
43 T
*newArray
= (T
*)realloc(fArray
, fMax
* sizeof(T
));
49 fArray
[fUsed
++] = value
;
58 *value
= fArray
[--fUsed
];
67 int32
CountItems() const
78 #endif /* KERNEL_UTIL_STACK_H */