Added a MakeEmpty() method.

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10402 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2004-12-12 20:48:40 +00:00
parent 805cd92d90
commit 62986df7c4

View File

@ -1,10 +1,10 @@
/* Stack - a template stack class
*
* Copyright 2001-2004, Axel Dörfler, axeld@pinc-software.de.
* This file may be used under the terms of the MIT License.
*/
#ifndef STACK_H
#define STACK_H
/* Stack - a template stack class
**
** Copyright 2001 pinc Software. All Rights Reserved.
** This file may be used under the terms of the OpenBeOS License.
*/
#include <SupportDefs.h>
@ -22,10 +22,15 @@ template<class T> class Stack {
~Stack()
{
if (fArray)
free(fArray);
}
void MakeEmpty()
{
// could also free the memory
fUsed = 0;
}
status_t Push(T value)
{
if (fUsed >= fMax) {