Template Class ArrayQueue

Class Documentation

template<class T>
class ArrayQueue

a QUEUE realized with a circular vector of a given capacity

Public Types

using Item = T

the type of the items

using value_type = T
using size_type = std::size_t
using difference_type = std::ptrdiff_t
using reference = const T&
using const_reference = const T&
using iterator = CircularIterator<T>
using const_iterator = CircularIterator<T>

Public Functions

explicit ArrayQueue(std::size_t dim)

the empty queue of at most dim items

bool empty(void) const
const T &top(void) const

the item at the front

Pre:

the queue is not empty

T dequeue(void)

removes the item at the front and returns it

Pre:

the queue is not empty

Post:

one item less

void enqueue(const T &v)

puts v at the back

Pre:

the queue is not full

Post:

one item more

std::size_t size(void) const

the number of items

std::size_t capacity(void) const

the maximum number of items

bool contains(const T &v) const

whether v is in the queue, O( n )

inline const_iterator begin(void) const
inline const_iterator end(void) const
inline const_iterator cbegin(void) const
inline const_iterator cend(void) const