stack class is used for the operations on a stack. A stack class is declared as:
template <class T, class Container = deque<T>> class stack
Constructor of stack class:
explicit stack(const Container &a = Container( ));
Types of stack operators: ==, <, <=, !=, >, >=
Member functions of stack:
1) size() function: It is used to return the number of elements of the stack.
2) empty( ) function: It returns true if stack is empty, otherwise false.
3) push( ) function: It is used to add an element at end of stack.
4) pop( ) function: It is used to remove first element from top of stack.
5) top( ) function: It is used to return a reference to the top of stack.