Gobelijn API documentation  - generated for commit a0cbea7
 All Classes Namespaces Files Functions Variables Typedefs Friends Macros Pages
Stack< T > Class Template Reference

Stack class using vector as element container. More...

#include <stack1.hpp>

Collaboration diagram for Stack< T >:
Collaboration graph

Public Member Functions

 Stack ()
 Default constructor. More...
 
bool empty () const
 Check whether stack is empty. More...
 
void pop ()
 Pop element off the stack. More...
 
void push (const T &e)
 Pushes element onto stack. More...
 
top () const
 Return top element of the stack (but not pop-ing it). More...
 
 Stack ()
 Default constructor. More...
 
bool empty () const
 Check whether stack is empty. More...
 
void pop ()
 Pop element off the stack. More...
 
void push (const T &e)
 Pushes element onto stack. More...
 
top () const
 Return top element of the stack (but not pop-ing it). More...
 
bool empty () const
 Check whether stack is empty. More...
 
bool full () const
 Check wheter stack is full. More...
 
void pop ()
 Pop element off the stack. More...
 
void push (const T &e)
 Pushes element onto stack. More...
 
top () const
 Return top element of the stack (but not pop-ing it). More...
 
 Stack ()
 Default constructor. More...
 
template<typename T2 >
Stack< T > & operator= (const Stack< T2 > &rhs)
 Assignment of one stack to another. More...
 
bool empty () const
 Check whether stack is empty. More...
 
void pop ()
 Pop element off the stack. More...
 
void push (const T &e)
 Pushes element onto stack. More...
 
top () const
 Return top element of the stack (but not pop-ing it). More...
 
 Stack ()
 Default constructor. More...
 
template<typename T2 , typename CONT2 >
Stack< T, CONT > & operator= (Stack< T2, CONT2 > const &)
 Assignment of one stack to another. More...
 
bool empty () const
 Check whether stack is empty. More...
 
void pop ()
 Pop element off the stack. More...
 
void push (const T &e)
 Pushes element onto stack. More...
 
top () const
 Return top element of the stack (but not pop-ing it). More...
 
 Stack ()
 Default constructor. More...
 
bool empty () const
 Check whether stack is empty. More...
 
void pop ()
 Pop element off the stack. More...
 
void push (const T &e)
 Pushes element onto stack. More...
 
top () const
 Return top element of the stack (but not pop-ing it). More...
 

Private Attributes

std::vector< T > elems
 Container for the stack elements. More...
 
CONT elems
 Container for the stack elements. More...
 
elems [MAXSIZE]
 Array to caontain stack elements. More...
 
unsigned int numElems {0}
 Current number of elements. More...
 
std::deque< T > elems
 Container for the stack elements. More...
 
CONT< T, ALLOC > elems
 Container for the stack elements. More...
 

Detailed Description

template<typename T>
class Stack< T >

Stack class using vector as element container.

Stack template.

Stack class using dequeue as element container.

Template Parameters
TTemplate param for element type.
TTemplate param for element type.
CONTContainer type fo stack elements.
TTemplate param for element type.
MAXSIZEMaximum capacity of the container.
Ttemplate param for element type.
TTemplate param for element.
CONTTemplate param for container for elements.
TTemplate param for element.
ALLOCAllocator for the stack container.
CONTTemplate param for container for elements.

Definition at line 15 of file stack1.hpp.

Constructor & Destructor Documentation

template<typename T>
Stack< T >::Stack ( )
inline

Default constructor.

Definition at line 19 of file stack1.hpp.

template<typename T>
Stack< T >::Stack ( )
inline

Default constructor.

Definition at line 20 of file stack3.hpp.

template<typename T>
Stack< T >::Stack ( )
inline

Default constructor.

Definition at line 18 of file stack5.hpp.

template<typename T>
Stack< T >::Stack ( )
inline

Default constructor.

Definition at line 19 of file stack6.hpp.

template<typename T>
Stack< T >::Stack ( )
inline

Default constructor.

Definition at line 20 of file stack7.hpp.

Member Function Documentation

template<typename T>
bool Stack< T >::empty ( ) const
inline

Check whether stack is empty.

Returns
True iff empty.

Definition at line 23 of file stack1.hpp.

References Stack< T >::elems.

Referenced by Stack< T >::operator=().

Here is the caller graph for this function:

template<typename T , typename ALLOC , template< typename, typename > class CONT>
void Stack< T, ALLOC, CONT >::pop ( )

Pop element off the stack.

Definition at line 43 of file stack1.hpp.

Referenced by main(), and Stack< T >::operator=().

Here is the caller graph for this function:

template<typename T , typename ALLOC , template< typename, typename > class CONT>
void Stack< T, ALLOC, CONT >::push ( const T &  e)

Pushes element onto stack.

Parameters
eElement to be pushed onto stack.

Definition at line 52 of file stack1.hpp.

Referenced by main().

Here is the caller graph for this function:

template<typename T , typename ALLOC , template< typename, typename > class CONT>
T Stack< T, ALLOC, CONT >::top ( ) const

Return top element of the stack (but not pop-ing it).

Returns
Top element of the stack.

Definition at line 58 of file stack1.hpp.

Referenced by main(), and Stack< T >::operator=().

Here is the caller graph for this function:

template<typename T>
bool Stack< T >::empty ( ) const
inline

Check whether stack is empty.

Returns
True iff empty.

Definition at line 24 of file stack3.hpp.

References Stack< T >::elems.

template<typename T>
void Stack< T >::pop ( )

Pop element off the stack.

template<typename T>
void Stack< T >::push ( const T &  e)

Pushes element onto stack.

Parameters
eElement to be pushed onto stack.
template<typename T>
T Stack< T >::top ( ) const

Return top element of the stack (but not pop-ing it).

Returns
Top element of the stack.
template<typename T>
bool Stack< T >::empty ( ) const
inline

Check whether stack is empty.

Returns
True iff empty.

Definition at line 19 of file stack4.hpp.

References Stack< T >::numElems.

template<typename T>
bool Stack< T >::full ( ) const
inline

Check wheter stack is full.

Returns
True iff full.

Definition at line 23 of file stack4.hpp.

References Stack< T >::numElems.

template<typename T>
void Stack< T >::pop ( )

Pop element off the stack.

template<typename T>
void Stack< T >::push ( const T &  e)

Pushes element onto stack.

Parameters
eElement to be pushed onto stack.
template<typename T>
T Stack< T >::top ( ) const

Return top element of the stack (but not pop-ing it).

Returns
Top element of the stack.
template<typename T >
template<typename T2 >
Stack< T > & Stack< T >::operator= ( const Stack< T2 > &  rhs)

Assignment of one stack to another.

Template Parameters
T2Template param for element type of rhs stack.
Returns
reference to the stack.

Definition at line 49 of file stack5.hpp.

References Stack< T >::empty(), Stack< T >::pop(), and Stack< T >::top().

Here is the call graph for this function:

template<typename T>
bool Stack< T >::empty ( ) const
inline

Check whether stack is empty.

Returns
True iff empty.

Definition at line 28 of file stack5.hpp.

References Stack< T >::elems.

template<typename T>
void Stack< T >::pop ( )

Pop element off the stack.

template<typename T>
void Stack< T >::push ( const T &  e)

Pushes element onto stack.

Parameters
eElement to be pushed onto stack.
template<typename T>
T Stack< T >::top ( ) const

Return top element of the stack (but not pop-ing it).

Returns
Top element of the stack.
template<typename T , typename CONT >
template<typename T2 , typename CONT2 >
Stack< T, CONT > & Stack< T, CONT >::operator= ( Stack< T2, CONT2 > const &  op2)

Assignment of one stack to another.

Template Parameters
T2Template param for element type of rhs stack.
Returns
reference to the stack.

Definition at line 50 of file stack6.hpp.

References Stack< T >::empty(), Stack< T >::pop(), and Stack< T >::top().

Here is the call graph for this function:

template<typename T>
bool Stack< T >::empty ( ) const
inline

Check whether stack is empty.

Returns
True iff empty.

Definition at line 29 of file stack6.hpp.

References Stack< T >::elems.

template<typename T>
void Stack< T >::pop ( )

Pop element off the stack.

template<typename T>
void Stack< T >::push ( const T &  e)

Pushes element onto stack.

Parameters
eElement to be pushed onto stack
template<typename T>
T Stack< T >::top ( ) const

Return top element of the stack (but not pop-ing it).

Returns
Top element of the stack
template<typename T>
bool Stack< T >::empty ( ) const
inline

Check whether stack is empty.

Returns
True iff empty.

Definition at line 24 of file stack7.hpp.

References Stack< T >::elems.

template<typename T>
void Stack< T >::pop ( )

Pop element off the stack.

template<typename T>
void Stack< T >::push ( const T &  e)

Pushes element onto stack.

Parameters
eElement to be pushed onto stack.
template<typename T>
T Stack< T >::top ( ) const

Return top element of the stack (but not pop-ing it).

Returns
Top element of the stack.

Member Data Documentation

template<typename T>
CONT Stack< T >::elems
private
template<typename T>
CONT Stack< T >::elems
private

Container for the stack elements.

Definition at line 38 of file stack3.hpp.

template<typename T>
T Stack< T >::elems[MAXSIZE]
private

Array to caontain stack elements.

Definition at line 37 of file stack4.hpp.

template<typename T>
unsigned int Stack< T >::numElems {0}
private

Current number of elements.

Definition at line 38 of file stack4.hpp.

Referenced by Stack< T >::empty(), and Stack< T >::full().

template<typename T>
std::deque<T> Stack< T >::elems
private

Container for the stack elements.

Definition at line 42 of file stack5.hpp.

template<typename T>
CONT<T, ALLOC> Stack< T >::elems
private

Container for the stack elements.

Definition at line 38 of file stack7.hpp.


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