|
stack< T, Container > Class Template Reference#include <c06p312.h>
List of all members.
Detailed Description
template<typename T, typename Container = deque <T>>
class stack< T, Container >
Definition at line 15 of file c06p312.h.
|
Public Member Functions |
| stack (const Container &cnt=Container()) |
bool | empty () const |
size_type | size () const |
T & | top () |
void | pop () |
void | push (const T &x) |
Constructor & Destructor Documentation
template<typename T, typename Container = deque <T>> |
stack< T, Container >::stack |
( |
const Container & |
cnt = Container() |
) |
[explicit] |
|
|
Default constructor; initializes an empty stack. - Precondition:
- None.
- Postcondition:
- An empty stack exists.
|
Member Function Documentation
template<typename T, typename Container = deque <T>> |
bool stack< T, Container >::empty |
( |
|
) |
const |
|
|
Determines whether this stack is empty. - Precondition:
- None.
- Postcondition:
- None.
- Returns:
- True if this stack is empty, otherwise returns false.
|
template<typename T, typename Container = deque <T>> |
size_type stack< T, Container >::size |
( |
|
) |
const |
|
|
Determines the size of this stack. The return type size_type is an integral type. - Precondition:
- None.
- Postcondition:
- None.
- Returns:
- The number of items that are currently on this stack.
|
template<typename T, typename Container = deque <T>> |
T& stack< T, Container >::top |
( |
|
) |
|
|
|
Returns a reference to the top of this stack. - Precondition:
- None.
- Postcondition:
- The item remains on this stack.
|
template<typename T, typename Container = deque <T>> |
void stack< T, Container >::pop |
( |
|
) |
|
|
|
Removes the top item in this stack. - Precondition:
- None.
- Postcondition:
- The item most recently added is removed from this stack.
|
template<typename T, typename Container = deque <T>> |
void stack< T, Container >::push |
( |
const T & |
x |
) |
|
|
|
Adds an item to the top of this stack. - Precondition:
- None.
- Postcondition:
- Item x is on top of this stack.
- Parameters:
-
|
The documentation for this class was generated from the following file:
|