Class hierarchy Compound list Compound Members

# Stack Class Reference

A classic LIFO data structure. More...

Inherited by Queue.

List of all members.

## Public Members

- Stack (const unsigned flags=0)
    Default Constructor: Construct an empty stack.

- Stack (const Stack& s)
    Copy Constructor: Construct a copy of a stack.

- Stack (const Container& c)
    Construct a stack from any container.

- Stack (const Enumeration& e)
    Construct a stack from an enumeration.

- Stack (const Vector& v)
    Construct a stack from a vector.

- ~Stack ()
    Destructor.

- Stack& operator= (const Stack& s)
    Assignment: Copy a stack.

- DS_BOOL empty ()
    Returns non-zero if the stack is empty.

- Data peek ()
    Returns the top element in the stack.

- Data top ()
    Returns the top element in the stack.

- Data pop ()
    Returns the top element in the stack and removes it.

- void push (Data item)
    Push an item to the top of the stack.

- Data search (Data item)
    Search for an item by utilizing the equality function of Containable.

- Data peek (const int index)
    Dip into the stack and retrieve an item.

## Detailed Description

A classic LIFO data structure.

## Member Function Documentation

### Stack::Stack(const unsigned flags=0)

Default Constructor: Construct an empty stack.

### Stack::Stack(const Stack& s)

Copy Constructor: Construct a copy of a stack.

### Stack::Stack(const Container& c)

Construct a stack from any container.

The elements are pushed in the index order of the container.

### Stack::Stack(const Enumeration& e)

Construct a stack from an enumeration.

The elements are pushed in the order they are enumerated.

### Stack::Stack(const Vector& v)

Construct a stack from a vector.

The elements are pushed in index order.

### Stack::~Stack()

Destructor.

### Stack& Stack::operator=(const Stack& s)

Assignment: Copy a stack.

### DS_BOOL Stack::empty()

Returns non-zero if the stack is empty.

### Data Stack::peek()

Returns the top element in the stack.

### Data Stack::top()

Returns the top element in the stack.

### Data Stack::pop()

Returns the top element in the stack and removes it.

Note: pop() returns garbage in a destructive stack.

Reimplemented in Queue.

### void Stack::push(Data item)

Push an item to the top of the stack.

### Data Stack::search(Data item)

Search for an item by utilizing the equality function of Containable.

### Data Stack::peek(const int index)

Dip into the stack and retrieve an item.

Reimplemented in Queue.

The documentation for this class was generated from the following file:

- DS_MemMgr.h