fennec
Loading...
Searching...
No Matches
fennec::sequence< TypeT, CompareT, AllocT >

wrapper for ordered sets of elements, called sequences in mathematics More...

#include <sequence.h>

Detailed Description

template<typename TypeT, typename CompareT = less<TypeT>, class AllocT = allocator<pair<TypeT, bool>>>
struct fennec::sequence< TypeT, CompareT, AllocT >

This data-structure behaves like an ordered-set, but does not use pointers, instead storing the table in-array

Property Value
stable
dynamic
homogenous
distinct
ordered
space \(O(N)\)
linear
access \(O(\log N)\)
find \(O(\log N)\)
insertion \(O(\log N)\)
deletion \(O(\log N)\)
Template Parameters
TypeTThe type to contain
CompareTFunction for comparing two values
AllocTAn allocator class

Public Member Functions

constexpr iterator begin ()
 
constexpr iterator end ()
 
Constructors & Destructor
constexpr sequence ()
 Default Constructor, initializes an empty sequence.
 
constexpr sequence (sequence &&) noexcept=default
 Move Constructor, takes ownership of a sequence.
 
constexpr sequence (const sequence &)=default
 Copy Constructor, copies a sequence.
 
constexpr ~sequence ()
 Default Destructor, destructs elements in-order
 
Search
constexpr iterator find (const value_t &val)
 Value Find Function, finds the iterator position for val, otherwise returns end()
 
bool contains (const value_t &val)
 Value Contains Function, checks if the sequence contains a value.
 
Properties
constexpr size_t size () const
 
constexpr bool empty () const
 
Modifiers
constexpr void insert (value_t &&val)
 Move Insertion, moves val into the sequence.
 
constexpr void insert (const value_t &val)
 Copy Insertion, inserts a copy of val into the sequence.
 
template<typename... ArgsT>
constexpr void emplace (ArgsT &&...args)
 Emplacement, constructs and adds a value into the sequence.
 
constexpr void clear ()
 Destructs all elements, in-order, contained in the sequence.
 

Member Function Documentation

◆ find()

template<typename TypeT , typename CompareT = less<TypeT>, class AllocT = allocator<pair<TypeT, bool>>>
constexpr iterator fennec::sequence< TypeT, CompareT, AllocT >::find ( const value_t &  val)
inlineconstexpr
Parameters
valThe value to find
Returns
An iterator at the value

◆ contains()

template<typename TypeT , typename CompareT = less<TypeT>, class AllocT = allocator<pair<TypeT, bool>>>
bool fennec::sequence< TypeT, CompareT, AllocT >::contains ( const value_t &  val)
inline
Parameters
valThe value to find
Returns
true if val is in the sequence, false otherwise

◆ size()

template<typename TypeT , typename CompareT = less<TypeT>, class AllocT = allocator<pair<TypeT, bool>>>
constexpr size_t fennec::sequence< TypeT, CompareT, AllocT >::size ( ) const
inlineconstexpr
Returns
The number of elements in the sequence

◆ empty()

template<typename TypeT , typename CompareT = less<TypeT>, class AllocT = allocator<pair<TypeT, bool>>>
constexpr bool fennec::sequence< TypeT, CompareT, AllocT >::empty ( ) const
inlineconstexpr
Returns
true when there are no elements in the sequence, false otherwise.

◆ insert() [1/2]

template<typename TypeT , typename CompareT = less<TypeT>, class AllocT = allocator<pair<TypeT, bool>>>
constexpr void fennec::sequence< TypeT, CompareT, AllocT >::insert ( value_t &&  val)
inlineconstexpr
Parameters
valThe value to insert

◆ insert() [2/2]

template<typename TypeT , typename CompareT = less<TypeT>, class AllocT = allocator<pair<TypeT, bool>>>
constexpr void fennec::sequence< TypeT, CompareT, AllocT >::insert ( const value_t &  val)
inlineconstexpr
Parameters
valThe value to insert

◆ emplace()

template<typename TypeT , typename CompareT = less<TypeT>, class AllocT = allocator<pair<TypeT, bool>>>
template<typename... ArgsT>
constexpr void fennec::sequence< TypeT, CompareT, AllocT >::emplace ( ArgsT &&...  args)
inlineconstexpr
Template Parameters
ArgsTThe argument types
Parameters
argsThe arguments to construct with

◆ begin()

template<typename TypeT , typename CompareT = less<TypeT>, class AllocT = allocator<pair<TypeT, bool>>>
constexpr iterator fennec::sequence< TypeT, CompareT, AllocT >::begin ( )
inlineconstexpr
Returns
An iterator at the smallest element in the sequence

◆ end()

template<typename TypeT , typename CompareT = less<TypeT>, class AllocT = allocator<pair<TypeT, bool>>>
constexpr iterator fennec::sequence< TypeT, CompareT, AllocT >::end ( )
inlineconstexpr
Returns
An iterator after the largest element in the sequence

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