TermOx
Classes | Public Types | Public Member Functions | List of all members
ox::Unique_queue< T > Class Template Reference

A Queue like container holding only unique values. More...

#include <unique_queue.hpp>

Public Types

using iterator = Transform_iterator< typename Internal_container_t::iterator, Get_element >
 
using const_iterator = Transform_iterator< typename Internal_container_t::const_iterator, Get_element >
 

Public Member Functions

void append (T const &element)
 Add element to the end of the queue.
 
void append (T &&element)
 Add element to the end of the queue.
 
auto size () const -> std::size_t
 
void compress ()
 Remove duplicate elements, this should be called before using iterators. More...
 
void clear ()
 Remove all elements from the queue.
 
auto begin () -> iterator
 
auto begin () const -> const_iterator
 
auto end () -> iterator
 
auto end () const -> const_iterator
 

Detailed Description

template<typename T>
class ox::Unique_queue< T >

A Queue like container holding only unique values.

Before accessing contained values, the container must be compressed to remove duplicates in a single step. This container has a call order dependency with compress, append, and clear! Uniqueness is determined by T::operator< and T::operator==.

Member Function Documentation

◆ compress()

template<typename T >
void ox::Unique_queue< T >::compress ( )
inline

Remove duplicate elements, this should be called before using iterators.

Do not append() after calling compress() until clear() has been called. compress and clear must be paired together, with iterator access in allowed in-between.


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