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

#include <array_queue.h>

Collaboration diagram for dsac::stackqueue::ArrayQueue< T >:
Collaboration graph

Public Member Functions

 ArrayQueue (int cap=CAPACITY)
 Construct a new queue with given capacity (default 1000)
 
int size () const
 return number of elements currently in the queue
 
bool empty () const
 return whether the queue is currently empty
 
const T & front () const
 return const reference to the first element of the queue
 
T & front ()
 return live (non-const) reference to the first element of the queue
 
const T & back () const
 return const reference to the last element of the queue
 
T & back ()
 return live (non-const) reference to the last element of the queue
 
void push (const T &elem)
 
void pop ()
 remove the first element from the queue
 

Detailed Description

template<typename T>
class dsac::stackqueue::ArrayQueue< T >

Implementation of a queue interface using an array with bounded capacity

Parameters
Tthe element type

Constructor & Destructor Documentation

◆ ArrayQueue()

template<typename T >
dsac::stackqueue::ArrayQueue< T >::ArrayQueue ( int  cap = CAPACITY)
inline

Construct a new queue with given capacity (default 1000)

Member Function Documentation

◆ back() [1/2]

template<typename T >
T & dsac::stackqueue::ArrayQueue< T >::back ( )
inline

return live (non-const) reference to the last element of the queue

◆ back() [2/2]

template<typename T >
const T & dsac::stackqueue::ArrayQueue< T >::back ( ) const
inline

return const reference to the last element of the queue

◆ empty()

template<typename T >
bool dsac::stackqueue::ArrayQueue< T >::empty ( ) const
inline

return whether the queue is currently empty

◆ front() [1/2]

template<typename T >
T & dsac::stackqueue::ArrayQueue< T >::front ( )
inline

return live (non-const) reference to the first element of the queue

◆ front() [2/2]

template<typename T >
const T & dsac::stackqueue::ArrayQueue< T >::front ( ) const
inline

return const reference to the first element of the queue

◆ pop()

template<typename T >
void dsac::stackqueue::ArrayQueue< T >::pop ( )
inline

remove the first element from the queue

◆ push()

template<typename T >
void dsac::stackqueue::ArrayQueue< T >::push ( const T &  elem)
inline

add element to the end of the queue

Parameters
elemthe new element
Exceptions
overflow_errorif queue is already at full capacity
Here is the call graph for this function:

◆ size()

template<typename T >
int dsac::stackqueue::ArrayQueue< T >::size ( ) const
inline

return number of elements currently in the queue


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