Member |
Description |
value_type |
The type of object stored in the stack. This is the same as T and Sequence::value_type. |
size_type |
An unsigned integral type. This is the same as Sequence::size_type. |
bool empty() const |
Returns true if the stack contains no elements, and false otherwise. S.empty() is equivalent to S.size() == 0. |
size_type size() const |
Returns the number of elements contained in the stack. |
value_type& top() |
Returns a mutable reference to the element at the top of the stack. Precondition: empty() is false. |
const value_type& top() const |
Returns a const reference to the element at the top of the stack. Precondition: empty() is false. |
void push(const value_type& x) |
Inserts x at the top of the stack. Postconditions: size() will be incremented by 1, and top() will be equal to x. |
void pop() |
Removes the element at the top of the stack. [3] Precondition: empty() is false. Postcondition: size() will be decremented by 1. |
bool operator==(const stack&, const stack&) |
Compares two stacks for equality. Two stacks are equal if they contain the same number of elements and if they are equal element-by-element. This is a global function, not a member function. |
bool operator<(const stack&, const stack&) |
Lexicographical ordering of two stacks. This is a global function, not a member function. |