hstack - A generic stack class.
C++
This C++ template class can be used to implement templated stacks. It resizes itself according to usage. This class implements several functions which will be described below. The class is a inherits from the STL stack class std::stack<T>. They are interchangable.
Classes that are used with this array class are required to implement the ''='' operator.
Classes that are used with this array class are required to implement the default constructor.
C++ exceptions are used to raise fatal errors. Thrown exceptions are of type std::string.
#include <hstack.h>
int main()
{
hstack<int> A;
int i,N;
for(i=0;i<100;i++) {
A.push(i);
}
for(i=0,N=A.len();i<N;i++) {
int e=A.pop();
printf("%d*%d=%d\\n",i,i,e);
}
return 0;
}
Initializes a new hstack<T> object.
Cleans up an hstack object and all of it''s members.
Clears the hstack object. All elements are flushed from memory.
Returns the current actual length of the stack.
Returns true if the stack is empty.
Pops an element of the stack and assigns it''s value to ''e''. Deletes the popped element.
Peeks the first element of the stack and assigns it''s value to ''e''.
Creates a new element, assigns it the value of ''e'' and pushes the newly created element on the stack.
Hans Oesterholt-Dijkema <hdnews -at- gawab.com>
(c) 2000 - 2004 Hans Oesterholt-Dijkema.
This header file has been release under LGPL.
$Id: hstack.h,v 1.6 2004/07/19 12:08:45 cvs Exp $
Latest releases of all packages can be found here. hstack is part of the rvector package.



