Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
Aleph::DynSkipList< Key, Compare > Class Template Reference

Dynamic ordered set implemented with a Skip List. More...

#include <tpl_dynSkipList.H>

Inheritance diagram for Aleph::DynSkipList< Key, Compare >:
[legend]
Collaboration diagram for Aleph::DynSkipList< Key, Compare >:
[legend]

Classes

class  Iterator
 Forward iterator for DynSkipList. More...
 
struct  Node
 Internal node structure. More...
 

Public Types

using Set_Type = DynSkipList
 The type of container.
 
using Item_Type = Key
 The type of element that stores the container.
 
using Key_Type = Key
 The type of element that stores the container.
 
- Public Types inherited from StlAlephIterator< SetName >
using iterator = StlIterator< SetName >
 
using const_iterator = StlConstIterator< SetName >
 

Public Member Functions

void set_seed (unsigned long seed) noexcept
 Set the random number generator seed.
 
gsl_rnggsl_rng_object () noexcept
 Get a pointer to the GSL random number generator.
 
 DynSkipList (unsigned long seed, double p=defaultProbability)
 Construct a DynSkipList with given seed and probability.
 
 DynSkipList (double p=defaultProbability)
 Construct a DynSkipList with time-based seed.
 
template<template< typename > class List>
 DynSkipList (const List< Key > &l)
 
template<class It >
 DynSkipList (It b, It e)
 
 DynSkipList (std::initializer_list< Key > l)
 
 DynSkipList (const DynSkipList &other)
 Copy constructor.
 
 DynSkipList (DynSkipList &&other) noexcept
 Move constructor.
 
 ~DynSkipList ()
 Destructor - frees all nodes and GSL random number generator.
 
DynSkipListoperator= (const DynSkipList &other)
 Copy assignment operator.
 
DynSkipListoperator= (DynSkipList &&other) noexcept
 Move assignment operator.
 
void swap (DynSkipList &other) noexcept
 Swap contents with another DynSkipList.
 
void empty () noexcept
 Remove all elements from the set.
 
void clear () noexcept
 Alias for empty() for STL compatibility.
 
size_t size () const noexcept
 Return the number of elements in the set.
 
bool is_empty () const noexcept
 Return true if the set is empty.
 
Compare & get_compare () noexcept
 Get the comparison functor.
 
const Compare & get_compare () const noexcept
 Get the comparison functor (const version)
 
Key * insert (const Key &key)
 Insert an element into the set.
 
Key * insert (Key &&key)
 Insert an element into the set (move version).
 
Key & insert_unique (const Key &key)
 Insert an element, throwing if it already exists.
 
Key & append (const Key &key)
 Append method for Special_Ctors compatibility (aliases to insert)
 
Key & append (Key &&key)
 
Key * search_or_insert (const Key &key)
 Search and insert if not found.
 
Key * search (const Key &key) const noexcept
 Search for a key in the set.
 
bool has (const Key &key) const noexcept
 Return true if the key exists in the set.
 
bool contains (const Key &key) const noexcept
 Alias for has() for STL-like interface.
 
bool exist (const Key &key) const noexcept
 Alias for has()
 
Key & find (const Key &key)
 Find a key, throwing if not found.
 
const Key & find (const Key &key) const
 Const version of find()
 
size_t remove (const Key &key)
 Remove a key from the set.
 
Key del (const Key &key)
 Remove and return a key.
 
const Key & min () const
 Return the minimum element (first in sorted order)
 
const Key & get_first () const
 Alias for min()
 
const Key & max () const
 Return the maximum element (last in sorted order)
 
const Key & get_last () const
 Alias for max()
 
DynSkipList join (const DynSkipList &other) const
 Compute the union of two sets.
 
DynSkipList intersect (const DynSkipList &other) const
 Compute the intersection of two sets.
 
DynSkipList diff (const DynSkipList &other) const
 Compute the difference of two sets.
 
Iterator begin () const noexcept
 
Iterator end () const noexcept
 
Iterator get_it () const noexcept
 Alias for begin() - for generic programming.
 
template<class Operation >
bool traverse (Operation &op) const
 
template<class Operation >
bool traverse (Operation &&op=Operation()) const
 
template<class Operation >
void for_each (Operation &op) const
 
template<class Operation >
void for_each (Operation &&op=Operation()) const
 
template<class Pred >
bool all (Pred &pred) const
 
template<class Pred >
bool all (Pred &&pred=Pred()) const
 
template<class Pred >
bool exists (Pred &pred) const
 
template<class Pred >
bool exists (Pred &&pred=Pred()) const
 
template<class Pred >
bool none (Pred &pred) const
 
template<class Pred >
bool none (Pred &&pred=Pred()) const
 
template<typename T >
T foldl (const T &init, std::function< T(const T &, const Key &)> op) const
 
template<typename T , class Operation >
T foldl (const T &init, Operation &op) const
 
template<typename T , class Operation >
T foldl (const T &init, Operation &&op) const
 
- Public Member Functions inherited from GenericTraverse< Container >
template<class Operation >
bool traverse (Operation &operation) noexcept(traverse_is_noexcept< Operation >())
 Traverse the container via its iterator and performs a conditioned operation on each item.
 
template<class Operation >
bool traverse (Operation &operation) const noexcept(traverse_is_noexcept< Operation >())
 Const overload of traverse(Operation&).
 
template<class Operation >
bool traverse (Operation &&operation) const noexcept(traverse_is_noexcept< Operation >())
 Overload of traverse(Operation&) const that accepts rvalues.
 
template<class Operation >
bool traverse (Operation &&operation) noexcept(traverse_is_noexcept< Operation >())
 Overload of traverse(Operation&) that accepts rvalues.
 
- Public Member Functions inherited from SpecialCtors< Container, T >
 SpecialCtors ()=default
 
 SpecialCtors (const SpecialCtors &)=default
 
 SpecialCtors (SpecialCtors &&) noexcept
 
SpecialCtorsoperator= (const SpecialCtors &)
 
SpecialCtorsoperator= (SpecialCtors &&) noexcept
 
 SpecialCtors (const Aleph::DynList< T > &l)
 Build the container by inserting all items of list l.
 
template<class It >
 SpecialCtors (It b, It e)
 Construct the container from a range of iterators.
 
 SpecialCtors (std::initializer_list< T > l)
 Construct the container from an initializer list.
 
- Public Member Functions inherited from LocateFunctions< Container, Type >
auto get_it () const
 Return a properly initialized iterator positioned at the first item on the container.
 
auto get_it (const size_t pos) const
 Return a properly initialized iterator positioned at the pos item on the container.
 
auto get_itor () const
 Alias of get_it().
 
Type & nth_ne (const size_t n) noexcept
 Return the n‑th element without bounds checking.
 
const Type & nth_ne (const size_t n) const noexcept
 Const overload of nth_ne(size_t).
 
Type & nth (const size_t n)
 Return the n-th item of container.
 
const Type & nth (const size_t n) const
 Const overload of nth(size_t).
 
template<class Operation >
Type * find_ptr (Operation &operation) noexcept(operation_is_noexcept< Operation >())
 Find a pointer to an item in the container according to a searching criteria.
 
template<class Operation >
const Type * find_ptr (Operation &operation) const noexcept(operation_is_noexcept< Operation >())
 Const overload of find_ptr(Operation&).
 
template<class Operation >
const Type * find_ptr (Operation &&operation) const noexcept(operation_is_noexcept< Operation >())
 Overload of find_ptr(Operation&) const that accepts rvalues.
 
template<class Operation >
Type * find_ptr (Operation &&operation) noexcept(operation_is_noexcept< Operation >())
 Overload of find_ptr(Operation&) that accepts rvalues.
 
template<class Operation >
size_t find_index (Operation &operation) const noexcept(operation_is_noexcept< Operation >())
 Find the position of an item in the container according to a searching criteria.
 
template<class Operation >
size_t find_index (Operation &&operation) const noexcept(operation_is_noexcept< Operation >())
 Overload of find_index(Operation&) that accepts rvalues.
 
template<class Operation >
std::tuple< bool, Type > find_item (Operation &operation) noexcept(operation_is_noexcept< Operation >())
 Safe sequential searching of an item matching a criteria.
 
template<class Operation >
std::tuple< bool, Type > find_item (Operation &operation) const noexcept(operation_is_noexcept< Operation >())
 
template<class Operation >
std::tuple< bool, Type > find_item (Operation &&operation) noexcept(operation_is_noexcept< Operation >())
 
template<class Operation >
std::tuple< bool, Type > find_item (Operation &&operation) const noexcept(operation_is_noexcept< Operation >())
 
- Public Member Functions inherited from FunctionalMethods< Container, T >
template<typename ... Args>
void emplace (Args &&... args)
 Appends a new element into the container by constructing it in-place with the given args.
 
template<typename ... Args>
void emplace_end (Args &&... args)
 
template<typename ... Args>
void emplace_ins (Args &&... args)
 Insert a new element into the container by constructing it in-place with the given args.
 
template<typename ... Args>
size_t ninsert (Args ... args)
 Insert n variadic items.
 
template<typename ... Args>
size_t nappend (Args ... args)
 Append n variadic items.
 
template<class Operation >
void for_each (Operation &operation)
 Traverse all the container and performs an operation on each element.
 
template<class Operation >
void for_each (Operation &operation) const
 Const overload of for_each(Operation&).
 
template<class Operation >
void for_each (Operation &&operation) const
 Overload of for_each(Operation&) const that accepts rvalues.
 
template<class Operation >
void for_each (Operation &&operation)
 Overload of for_each(Operation&) that accepts rvalues.
 
template<class Operation >
void each (Operation &operation)
 Alias of for_each(Operation&).
 
template<class Operation >
void each (Operation &operation) const
 Const alias of for_each(Operation&).
 
template<class Operation >
void each (Operation &&operation) const
 Const alias of for_each(Operation&) that accepts rvalues.
 
template<class Operation >
void each (Operation &&operation)
 Alias of for_each(Operation&) that accepts rvalues.
 
template<class Operation >
void each (size_t pos, const size_t slice, Operation &operation) const
 Traverse the container starting at pos taking one item every slice, performing a mutable operation on each visited element.
 
template<class Operation >
void each (const size_t pos, const size_t slice, Operation &&operation) const
 
template<class Operation >
void mutable_for_each (Operation &operation)
 
template<class Operation >
void mutable_for_each (Operation &&operation)
 
template<class Operation >
bool all (Operation &operation) const
 Check if all the elements of container satisfy a condition.
 
template<class Operation >
bool all (Operation &&operation) const
 Overload of all(Operation&) that accepts rvalues.
 
template<class Operation >
bool exists (Operation &op) const
 Test for existence in the container of an element satisfying a criteria.
 
template<class Operation >
bool exists (Operation &&op) const
 Overload of exists(Operation&) that accepts rvalues.
 
template<typename __T = T, class Operation = Aleph::Dft_Map_Op<T, __T>>
Aleph::DynList< __T > maps (Operation &op) const
 Map the elements of the container.
 
template<typename __T = T, class Operation = Aleph::Dft_Map_Op<__T, __T>>
Aleph::DynList< __T > maps (Operation &&op) const
 Overload of maps(Operation&) that accepts rvalues.
 
template<typename __T = T, class Prop , class Operation >
Aleph::DynList< __Tmaps_if (Prop prop, Operation &op) const
 Conditional mapping of the elements of the container.
 
template<typename __T = T, class Prop , class Operation >
Aleph::DynList< __Tmaps_if (Prop prop, Operation &&op) const
 Overload of maps_if(Prop, Operation&) that accepts rvalues.
 
Aleph::DynList< T > to_dynlist () const
 Convert container to DynList.
 
std::vector< T > to_vector () const
 Convert container to std::vector.
 
template<typename __T = T, class Op = Aleph::Dft_Fold_Op<__T, T>>
__T foldl (const __T &init, Op &op) const
 Fold the elements of the container to a specific result.
 
template<typename __T = T, class Op = Aleph::Dft_Fold_Op<__T, T>>
__T foldl (const __T &init, Op &&op=Op()) const
 Overload of foldl(const __T&, Op&) that accepts rvalues.
 
template<typename __T = T, class Op = Aleph::Dft_Fold_Op<__T, T>>
__T fold_left (const __T &init, Op &op) const
 Alias for foldl with the same accumulator type.
 
template<typename __T = T, class Op = Aleph::Dft_Fold_Op<__T, T>>
__T fold_left (const __T &init, Op &&op=Op()) const
 Overload of fold_left(const __T&, Op&) that accepts rvalues.
 
template<class Operation >
fold (const T &init, Operation &operation) const
 Simplified version of foldl() where the folded type is the same type of elements stored in the container.
 
template<class Operation >
fold (const T &init, Operation &&operation) const
 Overload of fold(const T&, Operation&) that accepts rvalues.
 
template<class Operation >
Aleph::DynList< T > filter (Operation &operation) const
 Filter the elements of a container according to a matching criteria.
 
template<class Operation >
Aleph::DynList< T > filter (Operation &&operation) const
 Overload of filter(Operation&) that accepts rvalues.
 
template<class Operation >
Aleph::DynList< const T * > ptr_filter (Operation &operation) const
 Filter the elements of a container according to a matching criteria and return a pointer to the matched items in the container.
 
template<class Operation >
Aleph::DynList< const T * > ptr_filter (Operation &&operation) const
 Overload of ptr_filter(Operation&) that accepts rvalues.
 
template<class Operation >
Aleph::DynList< std::tuple< T, size_t > > pfilter (Operation &operation) const
 Filter the elements of a container according to a matching criteria and determine its positions respect to the traversal of container.
 
template<class Operation >
Aleph::DynList< std::tuple< T, size_t > > pfilter (Operation &&operation) const
 Overload of pfilter(Operation&) that accepts rvalues.
 
template<class Operation >
std::pair< Aleph::DynList< T >, Aleph::DynList< T > > partition (Operation &op) const
 Exclusive partition of container according to a filter criteria.
 
template<class Operation >
std::pair< Aleph::DynList< T >, Aleph::DynList< T > > partition (Operation &&op) const
 Overload of partition(Operation&) that accepts rvalues.
 
template<class Operation >
std::pair< Aleph::DynList< T >, Aleph::DynList< T > > partition (size_t n) const
 Exclusive partition of container in the nth item.
 
std::pair< Aleph::DynList< T >, Aleph::DynList< T > > split_half () const
 Split the container into two halves by alternating elements.
 
template<class Operation >
std::tuple< Aleph::DynList< T >, Aleph::DynList< T > > tpartition (Operation &op) const
 Exclusive partition of container according to a filter criteria.
 
template<class Operation >
std::tuple< Aleph::DynList< T >, Aleph::DynList< T > > tpartition (Operation &&op) const
 Overload of tpartition(Operation&) that accepts rvalues.
 
size_t length () const noexcept
 Count the number of elements of a container.
 
Aleph::DynList< T > rev () const
 Return a list with the elements of container in reverse order respect to its traversal order.
 
Aleph::DynList< T > take (const size_t n) const
 Return a list with the first n elements seen in the container during its traversal.
 
Aleph::DynList< T > take (size_t i, const size_t j, const size_t step=1) const
 Return a list with elements seen in the container between i and j position respect to its traversal.
 
Aleph::DynList< T > drop (const size_t n) const
 Drop the first n elements seen in the container during its traversal.
 
void mutable_drop (const size_t n)
 Drop the first n elements seen from container.
 
- Public Member Functions inherited from GenericItems< Container, T >
Aleph::DynList< T > items () const
 Return a list of all the elements of a container sorted by traversal order.
 
Aleph::DynList< T > keys () const
 
- Public Member Functions inherited from StlAlephIterator< SetName >
iterator begin () noexcept
 Return an STL-compatible iterator to the first element.
 
iterator end () noexcept
 Return an STL-compatible end iterator.
 
const_iterator begin () const noexcept
 Return a const iterator to the first element.
 
const_iterator end () const noexcept
 Return a const end iterator.
 
const_iterator cbegin () const noexcept
 Return a const iterator to the first element.
 
const_iterator cend () const noexcept
 Return a const end iterator.
 

Static Public Attributes

static constexpr int maxLevel = 32
 Maximum number of levels (supports up to 2^32 elements efficiently)
 
static constexpr double defaultProbability = 0.5
 Default probability for level generation (0.5 = geometric distribution)
 

Private Member Functions

void init (unsigned long seed)
 
int random_level () const noexcept
 
bool keys_equal (const Key &k1, const Key &k2) const noexcept
 

Private Attributes

Nodeheader
 
gsl_rngr
 
size_t num_nodes = 0
 
int current_level = 1
 
double probability
 
Compare cmp
 

Additional Inherited Members

Detailed Description

template<typename Key, class Compare = std::less<Key>>
class Aleph::DynSkipList< Key, Compare >

Dynamic ordered set implemented with a Skip List.

DynSkipList<Key, Compare> is a dynamic set that automatically manages memory for its elements. It uses a Skip List as the underlying data structure, providing expected O(log n) time for search, insert, and delete operations.

The class internally uses the gsl random number generator of GSL - GNU Scientific Library. By default, the Mersenne twister is used and the seed is taken from system time.

Template Parameters
KeyType of elements stored in the set.
CompareComparison functor (default: std::less<Key>).
Complexity
  • Search: O(log n) expected
  • Insert: O(log n) expected
  • Delete: O(log n) expected
  • Min/Max: O(1) / O(n)
  • size(): O(1)
See also
DynSetTree DynSetHash

Definition at line 111 of file tpl_dynSkipList.H.

Member Typedef Documentation

◆ Item_Type

template<typename Key , class Compare = std::less<Key>>
using Aleph::DynSkipList< Key, Compare >::Item_Type = Key

The type of element that stores the container.

Definition at line 125 of file tpl_dynSkipList.H.

◆ Key_Type

template<typename Key , class Compare = std::less<Key>>
using Aleph::DynSkipList< Key, Compare >::Key_Type = Key

The type of element that stores the container.

Definition at line 128 of file tpl_dynSkipList.H.

◆ Set_Type

template<typename Key , class Compare = std::less<Key>>
using Aleph::DynSkipList< Key, Compare >::Set_Type = DynSkipList

The type of container.

Definition at line 122 of file tpl_dynSkipList.H.

Constructor & Destructor Documentation

◆ DynSkipList() [1/7]

template<typename Key , class Compare = std::less<Key>>
Aleph::DynSkipList< Key, Compare >::DynSkipList ( unsigned long  seed,
double  p = defaultProbability 
)
inline

Construct a DynSkipList with given seed and probability.

Parameters
[in]seedRandom seed for level generation.
[in]pProbability for level increase (default 0.5).

Definition at line 213 of file tpl_dynSkipList.H.

References Aleph::DynSkipList< Key, Compare >::header, Aleph::init, and Aleph::DynSkipList< Key, Compare >::maxLevel.

◆ DynSkipList() [2/7]

template<typename Key , class Compare = std::less<Key>>
Aleph::DynSkipList< Key, Compare >::DynSkipList ( double  p = defaultProbability)
inlineexplicit

Construct a DynSkipList with time-based seed.

Parameters
[in]pProbability for level increase (default 0.5).

Definition at line 223 of file tpl_dynSkipList.H.

◆ DynSkipList() [3/7]

template<typename Key , class Compare = std::less<Key>>
template<template< typename > class List>
Aleph::DynSkipList< Key, Compare >::DynSkipList ( const List< Key > &  l)
inline

Definition at line 229 of file tpl_dynSkipList.H.

◆ DynSkipList() [4/7]

template<typename Key , class Compare = std::less<Key>>
template<class It >
Aleph::DynSkipList< Key, Compare >::DynSkipList ( It  b,
It  e 
)
inline

Definition at line 229 of file tpl_dynSkipList.H.

◆ DynSkipList() [5/7]

template<typename Key , class Compare = std::less<Key>>
Aleph::DynSkipList< Key, Compare >::DynSkipList ( std::initializer_list< Key >  l)
inline

Definition at line 229 of file tpl_dynSkipList.H.

◆ DynSkipList() [6/7]

template<typename Key , class Compare = std::less<Key>>
Aleph::DynSkipList< Key, Compare >::DynSkipList ( const DynSkipList< Key, Compare > &  other)
inline

◆ DynSkipList() [7/7]

template<typename Key , class Compare = std::less<Key>>
Aleph::DynSkipList< Key, Compare >::DynSkipList ( DynSkipList< Key, Compare > &&  other)
inlinenoexcept

◆ ~DynSkipList()

template<typename Key , class Compare = std::less<Key>>
Aleph::DynSkipList< Key, Compare >::~DynSkipList ( )
inline

Member Function Documentation

◆ all() [1/2]

template<typename Key , class Compare = std::less<Key>>
template<class Pred >
bool Aleph::DynSkipList< Key, Compare >::all ( Pred &&  pred = Pred()) const
inline

Definition at line 848 of file tpl_dynSkipList.H.

References FunctionalMethods< Container, T >::maps(), and pred.

◆ all() [2/2]

template<typename Key , class Compare = std::less<Key>>
template<class Pred >
bool Aleph::DynSkipList< Key, Compare >::all ( Pred pred) const
inline

◆ append() [1/2]

template<typename Key , class Compare = std::less<Key>>
Key & Aleph::DynSkipList< Key, Compare >::append ( const Key &  key)
inline

Append method for Special_Ctors compatibility (aliases to insert)

Definition at line 466 of file tpl_dynSkipList.H.

References Aleph::DynSkipList< Key, Compare >::insert(), and Aleph::DynSkipList< Key, Compare >::search().

◆ append() [2/2]

template<typename Key , class Compare = std::less<Key>>
Key & Aleph::DynSkipList< Key, Compare >::append ( Key &&  key)
inline

◆ begin()

template<typename Key , class Compare = std::less<Key>>
Iterator Aleph::DynSkipList< Key, Compare >::begin ( ) const
inlinenoexcept

Definition at line 800 of file tpl_dynSkipList.H.

◆ clear()

template<typename Key , class Compare = std::less<Key>>
void Aleph::DynSkipList< Key, Compare >::clear ( )
inlinenoexcept

Alias for empty() for STL compatibility.

Definition at line 344 of file tpl_dynSkipList.H.

References Aleph::DynSkipList< Key, Compare >::empty().

◆ contains()

template<typename Key , class Compare = std::less<Key>>
bool Aleph::DynSkipList< Key, Compare >::contains ( const Key &  key) const
inlinenoexcept

Alias for has() for STL-like interface.

Definition at line 527 of file tpl_dynSkipList.H.

References Aleph::DynSkipList< Key, Compare >::has().

◆ del()

◆ diff()

template<typename Key , class Compare = std::less<Key>>
DynSkipList Aleph::DynSkipList< Key, Compare >::diff ( const DynSkipList< Key, Compare > &  other) const
inline

Compute the difference of two sets.

Parameters
[in]otherThe other set.
Returns
A new set containing elements in this but not in other.

Definition at line 694 of file tpl_dynSkipList.H.

References StlAlephIterator< SetName >::begin(), Aleph::DynSkipList< Key, Compare >::insert(), and FunctionalMethods< Container, T >::maps().

◆ empty()

◆ end()

template<typename Key , class Compare = std::less<Key>>
Iterator Aleph::DynSkipList< Key, Compare >::end ( ) const
inlinenoexcept

Definition at line 801 of file tpl_dynSkipList.H.

◆ exist()

template<typename Key , class Compare = std::less<Key>>
bool Aleph::DynSkipList< Key, Compare >::exist ( const Key &  key) const
inlinenoexcept

Alias for has()

Definition at line 530 of file tpl_dynSkipList.H.

References Aleph::DynSkipList< Key, Compare >::has().

◆ exists() [1/2]

template<typename Key , class Compare = std::less<Key>>
template<class Pred >
bool Aleph::DynSkipList< Key, Compare >::exists ( Pred &&  pred = Pred()) const
inline

Definition at line 863 of file tpl_dynSkipList.H.

References FunctionalMethods< Container, T >::maps(), and pred.

◆ exists() [2/2]

template<typename Key , class Compare = std::less<Key>>
template<class Pred >
bool Aleph::DynSkipList< Key, Compare >::exists ( Pred pred) const
inline

◆ find() [1/2]

template<typename Key , class Compare = std::less<Key>>
Key & Aleph::DynSkipList< Key, Compare >::find ( const Key &  key)
inline

Find a key, throwing if not found.

Parameters
[in]keyThe key to find.
Returns
Reference to the key.
Exceptions
std::domain_errorIf the key is not found.

Definition at line 538 of file tpl_dynSkipList.H.

References ah_domain_error_if, and Aleph::DynSkipList< Key, Compare >::search().

◆ find() [2/2]

template<typename Key , class Compare = std::less<Key>>
const Key & Aleph::DynSkipList< Key, Compare >::find ( const Key &  key) const
inline

Const version of find()

Definition at line 547 of file tpl_dynSkipList.H.

References ah_domain_error_if, and Aleph::DynSkipList< Key, Compare >::search().

◆ foldl() [1/3]

template<typename Key , class Compare = std::less<Key>>
template<typename T , class Operation >
T Aleph::DynSkipList< Key, Compare >::foldl ( const T init,
Operation &&  op 
) const
inline

Definition at line 899 of file tpl_dynSkipList.H.

References Aleph::init, and FunctionalMethods< Container, T >::maps().

◆ foldl() [2/3]

template<typename Key , class Compare = std::less<Key>>
template<typename T , class Operation >
T Aleph::DynSkipList< Key, Compare >::foldl ( const T init,
Operation op 
) const
inline

◆ foldl() [3/3]

template<typename Key , class Compare = std::less<Key>>
template<typename T >
T Aleph::DynSkipList< Key, Compare >::foldl ( const T init,
std::function< T(const T &, const Key &)>  op 
) const
inline

◆ for_each() [1/2]

template<typename Key , class Compare = std::less<Key>>
template<class Operation >
void Aleph::DynSkipList< Key, Compare >::for_each ( Operation &&  op = Operation()) const
inline

Definition at line 833 of file tpl_dynSkipList.H.

References FunctionalMethods< Container, T >::maps().

◆ for_each() [2/2]

template<typename Key , class Compare = std::less<Key>>
template<class Operation >
void Aleph::DynSkipList< Key, Compare >::for_each ( Operation op) const
inline

Definition at line 826 of file tpl_dynSkipList.H.

References StlAlephIterator< SetName >::begin().

◆ get_compare() [1/2]

template<typename Key , class Compare = std::less<Key>>
const Compare & Aleph::DynSkipList< Key, Compare >::get_compare ( ) const
inlinenoexcept

Get the comparison functor (const version)

Definition at line 356 of file tpl_dynSkipList.H.

References Aleph::DynSkipList< Key, Compare >::cmp.

◆ get_compare() [2/2]

template<typename Key , class Compare = std::less<Key>>
Compare & Aleph::DynSkipList< Key, Compare >::get_compare ( )
inlinenoexcept

Get the comparison functor.

Definition at line 353 of file tpl_dynSkipList.H.

References Aleph::DynSkipList< Key, Compare >::cmp.

◆ get_first()

template<typename Key , class Compare = std::less<Key>>
const Key & Aleph::DynSkipList< Key, Compare >::get_first ( ) const
inline

Alias for min()

Definition at line 642 of file tpl_dynSkipList.H.

References Aleph::DynSkipList< Key, Compare >::min().

◆ get_it()

template<typename Key , class Compare = std::less<Key>>
Iterator Aleph::DynSkipList< Key, Compare >::get_it ( ) const
inlinenoexcept

Alias for begin() - for generic programming.

Definition at line 804 of file tpl_dynSkipList.H.

References StlAlephIterator< SetName >::begin().

Referenced by demonstrate_basic_operations(), and demonstrate_string_set().

◆ get_last()

template<typename Key , class Compare = std::less<Key>>
const Key & Aleph::DynSkipList< Key, Compare >::get_last ( ) const
inline

Alias for max()

Definition at line 656 of file tpl_dynSkipList.H.

References Aleph::DynSkipList< Key, Compare >::max().

◆ gsl_rng_object()

template<typename Key , class Compare = std::less<Key>>
gsl_rng * Aleph::DynSkipList< Key, Compare >::gsl_rng_object ( )
inlinenoexcept

Get a pointer to the GSL random number generator.

Definition at line 207 of file tpl_dynSkipList.H.

References Aleph::DynSkipList< Key, Compare >::r.

◆ has()

template<typename Key , class Compare = std::less<Key>>
bool Aleph::DynSkipList< Key, Compare >::has ( const Key &  key) const
inlinenoexcept

◆ init()

template<typename Key , class Compare = std::less<Key>>
void Aleph::DynSkipList< Key, Compare >::init ( unsigned long  seed)
inlineprivate

◆ insert() [1/2]

◆ insert() [2/2]

template<typename Key , class Compare = std::less<Key>>
Key * Aleph::DynSkipList< Key, Compare >::insert ( Key &&  key)
inline

◆ insert_unique()

template<typename Key , class Compare = std::less<Key>>
Key & Aleph::DynSkipList< Key, Compare >::insert_unique ( const Key &  key)
inline

Insert an element, throwing if it already exists.

Parameters
[in]keyThe key to insert.
Returns
Reference to the inserted key.
Exceptions
std::domain_errorIf the key already exists.
std::bad_allocIf memory allocation fails.

Definition at line 457 of file tpl_dynSkipList.H.

References ah_domain_error_if, and Aleph::DynSkipList< Key, Compare >::insert().

◆ intersect()

template<typename Key , class Compare = std::less<Key>>
DynSkipList Aleph::DynSkipList< Key, Compare >::intersect ( const DynSkipList< Key, Compare > &  other) const
inline

Compute the intersection of two sets.

Parameters
[in]otherThe other set.
Returns
A new set containing elements present in both sets.

Definition at line 680 of file tpl_dynSkipList.H.

References StlAlephIterator< SetName >::begin(), Aleph::DynSkipList< Key, Compare >::insert(), and FunctionalMethods< Container, T >::maps().

◆ is_empty()

template<typename Key , class Compare = std::less<Key>>
bool Aleph::DynSkipList< Key, Compare >::is_empty ( ) const
inlinenoexcept

Return true if the set is empty.

Definition at line 350 of file tpl_dynSkipList.H.

References Aleph::DynSkipList< Key, Compare >::num_nodes.

Referenced by Aleph::DynSkipList< Key, Compare >::max(), and Aleph::DynSkipList< Key, Compare >::min().

◆ join()

template<typename Key , class Compare = std::less<Key>>
DynSkipList Aleph::DynSkipList< Key, Compare >::join ( const DynSkipList< Key, Compare > &  other) const
inline

Compute the union of two sets.

Parameters
[in]otherThe other set.
Returns
A new set containing all elements from both sets.

Definition at line 667 of file tpl_dynSkipList.H.

References Aleph::DynSkipList< Key, Compare >::insert(), and FunctionalMethods< Container, T >::maps().

◆ keys_equal()

◆ max()

template<typename Key , class Compare = std::less<Key>>
const Key & Aleph::DynSkipList< Key, Compare >::max ( ) const
inline

◆ min()

template<typename Key , class Compare = std::less<Key>>
const Key & Aleph::DynSkipList< Key, Compare >::min ( ) const
inline

◆ none() [1/2]

template<typename Key , class Compare = std::less<Key>>
template<class Pred >
bool Aleph::DynSkipList< Key, Compare >::none ( Pred &&  pred = Pred()) const
inline

Definition at line 875 of file tpl_dynSkipList.H.

References FunctionalMethods< Container, T >::maps(), and pred.

◆ none() [2/2]

template<typename Key , class Compare = std::less<Key>>
template<class Pred >
bool Aleph::DynSkipList< Key, Compare >::none ( Pred pred) const
inline

◆ operator=() [1/2]

◆ operator=() [2/2]

◆ random_level()

◆ remove()

◆ search()

◆ search_or_insert()

template<typename Key , class Compare = std::less<Key>>
Key * Aleph::DynSkipList< Key, Compare >::search_or_insert ( const Key &  key)
inline

Search and insert if not found.

Parameters
[in]keyThe key to search/insert.
Returns
Pointer to existing or newly inserted key.

Definition at line 491 of file tpl_dynSkipList.H.

References Aleph::DynSkipList< Key, Compare >::insert(), FunctionalMethods< Container, T >::maps(), and Aleph::DynSkipList< Key, Compare >::search().

◆ set_seed()

template<typename Key , class Compare = std::less<Key>>
void Aleph::DynSkipList< Key, Compare >::set_seed ( unsigned long  seed)
inlinenoexcept

Set the random number generator seed.

Definition at line 204 of file tpl_dynSkipList.H.

References FunctionalMethods< Container, T >::maps(), and Aleph::DynSkipList< Key, Compare >::r.

◆ size()

template<typename Key , class Compare = std::less<Key>>
size_t Aleph::DynSkipList< Key, Compare >::size ( ) const
inlinenoexcept

Return the number of elements in the set.

Definition at line 347 of file tpl_dynSkipList.H.

References Aleph::DynSkipList< Key, Compare >::num_nodes.

Referenced by benchmark_comparison(), and demonstrate_basic_operations().

◆ swap()

◆ traverse() [1/2]

template<typename Key , class Compare = std::less<Key>>
template<class Operation >
bool Aleph::DynSkipList< Key, Compare >::traverse ( Operation &&  op = Operation()) const
inline

Definition at line 820 of file tpl_dynSkipList.H.

References FunctionalMethods< Container, T >::maps().

◆ traverse() [2/2]

template<typename Key , class Compare = std::less<Key>>
template<class Operation >
bool Aleph::DynSkipList< Key, Compare >::traverse ( Operation op) const
inline

Member Data Documentation

◆ cmp

◆ current_level

◆ defaultProbability

template<typename Key , class Compare = std::less<Key>>
constexpr double Aleph::DynSkipList< Key, Compare >::defaultProbability = 0.5
staticconstexpr

Default probability for level generation (0.5 = geometric distribution)

Definition at line 134 of file tpl_dynSkipList.H.

◆ header

◆ maxLevel

◆ num_nodes

◆ probability

◆ r


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