A simple stack implementation.
#include <stack.h>
Public Member Functions |
|
const T & | operator[] (const int i) const |
T & | operator[] (const int i) |
void | Push (T *el) |
void | Pop (T *el) |
void | Pop () |
void | GetTop (T *el) |
void | Clear () |
int | Count () const |
int | Remove (int i) |
const T& operator[] | ( | const int | i | ) | const [inline] |
{ DbgAssert(s.Count()-i>0); return s[s.Count()-i-1]; }
T& operator[] | ( | const int | i | ) | [inline] |
{ DbgAssert(s.Count()-i>0); return s[s.Count()-i-1]; }
void Push | ( | T * | el | ) | [inline] |
{ s.Append( 1, el ); }
void Pop | ( | T * | el | ) | [inline] |
{ DbgAssert( s.Count() ); *el = s[s.Count()-1]; s.Delete( s.Count()-1, 1 ); }
void Pop | ( | ) | [inline] |
{ DbgAssert( s.Count() ); s.Delete( s.Count()-1, 1 ); }
void GetTop | ( | T * | el | ) | [inline] |
{ DbgAssert( s.Count() ); *el = s[s.Count()-1]; }
void Clear | ( | ) | [inline] |
{ s.Delete(0,s.Count()); }
int Count | ( | ) | const [inline] |
{
return s.Count();
}
int Remove | ( | int | i | ) | [inline] |
{ assert(i<s.Count()); return s.Delete(s.Count()-1-i,1); }