91 int size()
const {
return ndata; }
144 it_error_if(valptr == 0,
"Stack<T>::pop: Empty stack");
152 it_error_if(valptr == 0,
"Stack<T>::peek: Empty stack");
153 return data[valptr-1];
void alloc(int n)
Allocate storage for an array of length n.
void free()
Free the storage space allocated by the array.
int ndata
The current number of elements in the Array.
T * data
A pointer to the data area.
void set_size(int n, bool copy=false)
Resizing an Array<T>.
virtual ~Stack()
Default destructor.
int size() const
Returns the maximum number of data elements the stack can store.
Stack()
Default constructor.
void set_size(int n, bool copy=false)
Resizing a Stack<T>.
void push(T v)
Push an element at top of stack.
T peek() const
Peek at the topmost element of the stack, without removing it.
void operator=(const Stack< T > &s)
Assignment operator.
int no_elements() const
Returns the number of data elements currently in the stack.
T pop()
Pop the topmost element of the stack.
void clear()
Empty the stack.
#define it_error_if(t, s)
Abort if t is true.
#define it_assert_debug(t, s)
Abort if t is not true and NDEBUG is not defined.
T min(const Vec< T > &in)
Minimum value of vector.
Error handling functions - header file.