Files
firestorm/Gameleap/code/mw4/Libraries/3dsmax4/Include/stack.h
T
Cyd 2b8ca921cb Initial full mirror of c:\VWE (source + assets + toolchain + outputs) via Git LFS
Complete disaster-recovery snapshot: engine/game source, game data assets,
VC6 toolchain + DX SDKs, build outputs, deployed game, and _UNUSED archive.
Large binaries in Git LFS; text preserved byte-for-byte (core.autocrlf=false,
no eol attributes). See RECOVERY.md for the one-clone rebuild procedure.
2026-06-24 21:28:16 -05:00

64 lines
1.1 KiB
C++

/**********************************************************************
*<
FILE: stack.h
DESCRIPTION: Simple stack using Tab.
CREATED BY: Rolf Berteig
HISTORY: Created 22 November 1994
*> Copyright (c) 1994, All Rights Reserved.
**********************************************************************/
#ifndef __STACK__
#define __STACK__
template<class T> class Stack {
private:
Tab<T> s;
public:
// access the stack indexing from the top down.
T& operator[](const int i) const {
assert(s.Count()-i>0);
return s[s.Count()-i-1];
}
void Push( T *el ) {
s.Append( 1, el );
}
void Pop( T *el ) {
assert( s.Count() );
*el = s[s.Count()-1];
s.Delete( s.Count()-1, 1 );
}
void Pop() {
assert( s.Count() );
s.Delete( s.Count()-1, 1 );
}
void GetTop( T *el ) {
assert( s.Count() );
*el = s[s.Count()-1];
}
void Clear() {
s.Delete(0,s.Count());
}
int Count() {
return s.Count();
}
int Remove( int i ) {
assert(i<s.Count());
return s.Delete(s.Count()-1-i,1);
}
};
#endif // __STACK__