Stack

template<class T, int size = 10> class Stack

Basic stack templete class

Example

void
main()
{
    Stack<int, 100> s1;

    cout << "\nPush: ";
    for (int i = 1; !s1.full(); i++) {
        cout << i << ", ";
        s1.push( i );
    }
    cout << "\nPop: ";
    for (i = 1; i <= 101; i++)
        cout << s1.pop() << ", ";
}
Summary
StackBasic stack templete class
Constructors
~StackPublic destructor
emptyDetermine whether the stack is empty.
fullDetermine whether the stack is full.
StackPublic constructor
Functions
popPop a stack element
pushPush a stack element
Signal handlers
overflowStack overflow signal
underflowStack underflow signal

Constructors

~Stack

~Stack()

Public destructor

empty

int empty() const

Determine whether the stack is empty.

full

int full() const

Determine whether the stack is full.

Stack

Stack()

Public constructor

Functions

pop

template<class T, int size> T Stack<T, size> ::pop()

Pop a stack element

push

template<class T, int size> void Stack<T, size> ::push(item)

Push a stack element

Signal handlers

overflow

template<class T, int size> void Stack<T, size> ::overflow()

Stack overflow signal

underflow

template<class T, int size> void Stack<T, size> ::underflow()

Stack underflow signal

To send feedback on this topic email: natural.nosp@m.docsplus@gmai.nosp@m.l.com

© Some Rights Reserved. see <License>

template<class T, int size = 10> class Stack
Basic stack templete class
~Stack()
Public destructor
int empty() const
Determine whether the stack is empty.
int full() const
Determine whether the stack is full.
Stack()
Public constructor
template<class T, int size> T Stack<T, size> ::pop()
Pop a stack element
template<class T, int size> void Stack<T, size> ::push(item)
Push a stack element
template<class T, int size> void Stack<T, size> ::overflow()
Stack overflow signal
template<class T, int size> void Stack<T, size> ::underflow()
Stack underflow signal