Data Structures & Algorithms in C++
Goodrich, Tamassia, Mount and Goldwasser
Loading...
Searching...
No Matches
Public Member Functions
dsac::stackqueue::stack< T, Container > Class Template Reference

A simplified version of the STL stack class. More...

#include <stack.h>

Collaboration diagram for dsac::stackqueue::stack< T, Container >:
Collaboration graph

Public Member Functions

int size () const
 return the number of elements currently in the stack
 
bool empty () const
 return whether the stack is currently empty
 
const T & top () const
 return const reference to the top element of the stack
 
T & top ()
 return live (non-const) reference to the top element of the stack
 
void push (const T &elem)
 add an element to the top of the stack
 
void pop ()
 remove the top element from the stack
 

Detailed Description

template<typename T, typename Container = std::vector<T>>
class dsac::stackqueue::stack< T, Container >

A simplified version of the STL stack class.

Member Function Documentation

◆ empty()

template<typename T , typename Container = std::vector<T>>
bool dsac::stackqueue::stack< T, Container >::empty ( ) const
inline

return whether the stack is currently empty

◆ pop()

template<typename T , typename Container = std::vector<T>>
void dsac::stackqueue::stack< T, Container >::pop ( )
inline

remove the top element from the stack

◆ push()

template<typename T , typename Container = std::vector<T>>
void dsac::stackqueue::stack< T, Container >::push ( const T &  elem)
inline

add an element to the top of the stack

◆ size()

template<typename T , typename Container = std::vector<T>>
int dsac::stackqueue::stack< T, Container >::size ( ) const
inline

return the number of elements currently in the stack

◆ top() [1/2]

template<typename T , typename Container = std::vector<T>>
T & dsac::stackqueue::stack< T, Container >::top ( )
inline

return live (non-const) reference to the top element of the stack

◆ top() [2/2]

template<typename T , typename Container = std::vector<T>>
const T & dsac::stackqueue::stack< T, Container >::top ( ) const
inline

return const reference to the top element of the stack


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