Data Structures & Algorithms in C++
Goodrich, Tamassia, Mount and Goldwasser
|
#include <array_queue.h>
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 | |
Implementation of a queue interface using an array with bounded capacity
T | the element type |
|
inline |
Construct a new queue with given capacity (default 1000)
|
inline |
return live (non-const) reference to the last element of the queue
|
inline |
return const reference to the last element of the queue
|
inline |
return whether the queue is currently empty
|
inline |
return live (non-const) reference to the first element of the queue
|
inline |
return const reference to the first element of the queue
|
inline |
remove the first element from the queue
|
inline |
add element to the end of the queue
elem | the new element |
overflow_error | if queue is already at full capacity |
|
inline |
return number of elements currently in the queue