Template Class UniqueQueue

Class Documentation

template<std::equality_comparable T, Duplicate D = Duplicate::IGNORE_NEW>
class UniqueQueue

a QUEUE with no duplicates; the equality of T must be an equivalence, so an item unequal to itself (e.g., a NaN) cannot be enqueued: the postcondition of enqueue() refuses it

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 = typename List<T>::const_iterator
using const_iterator = typename List<T>::const_iterator

Public Functions

bool empty(void) const
void enqueue(const T &v)

puts v at the back, unless the policy keeps an old copy of it

Post:

v is in the queue, at the back with FORGET_OLD

T dequeue(void)

removes the item at the front and returns it

Pre:

the queue is not empty

const T &top(void) const

the item at the front

Pre:

the queue is not empty

bool contains(const T &v) const

whether v is in the queue, O( n )

std::size_t size(void) const

the number of items

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