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>
14 template<class T
> class Stack
{
36 // could also free the memory
40 status_t
Push(T value
)
44 T
*newArray
= (T
*)realloc(fArray
, fMax
* sizeof(T
));
50 fArray
[fUsed
++] = value
;
59 *value
= fArray
[--fUsed
];
68 int32
CountItems() const
79 #endif /* KERNEL_UTIL_STACK_H */