iv::volatile_set< Key, Hash, Pred > Class Template Reference

#include <volatile_set.hpp>

Public Types

using iterator = typename std::unordered_set< Key, Hash, Pred >::iterator
 

Public Member Functions

void insert (Key const &val)
 
void erase (Key const &val)
 
int count (Key const &val)
 
void foreach (std::function< void(Key const &) > const &fun)
 
iteratorlock_begin ()
 this is stack based; lock_end unlocks (and invalidates) iterator returned by last lock_begin call More...
 
iteratorlock_find (Key const &val)
 
void unlock ()
 
iterator end ()
 
size_t size ()
 
bool empty ()
 

Detailed Description

template<class Key, class Hash = std::hash<Key>, class Pred = std::equal_to<Key>>
class iv::volatile_set< Key, Hash, Pred >

Works like unordered_set, but elements can be inserted and removed while iterating using foreach() method. Items that are inserted during iteration will be added after the iteration ends. Item erasure is instant.

Definition at line 16 of file volatile_set.hpp.

Member Typedef Documentation

◆ iterator

template<class Key , class Hash = std::hash<Key>, class Pred = std::equal_to<Key>>
using iv::volatile_set< Key, Hash, Pred >::iterator = typename std::unordered_set< Key, Hash, Pred >::iterator

Definition at line 19 of file volatile_set.hpp.

Member Function Documentation

◆ insert()

template<class Key , class Hash , class Pred >
void iv::volatile_set< Key, Hash, Pred >::insert ( Key const &  val)

Definition at line 5 of file volatile_set.inl.

◆ erase()

template<class Key , class Hash , class Pred >
void iv::volatile_set< Key, Hash, Pred >::erase ( Key const &  val)

Definition at line 14 of file volatile_set.inl.

◆ count()

template<class Key , class Hash , class Pred >
int iv::volatile_set< Key, Hash, Pred >::count ( Key const &  val)

Definition at line 79 of file volatile_set.inl.

◆ foreach()

template<class Key , class Hash , class Pred >
void iv::volatile_set< Key, Hash, Pred >::foreach ( std::function< void(Key const &) > const &  fun)

Definition at line 31 of file volatile_set.inl.

◆ lock_begin()

template<class Key , class Hash , class Pred >
volatile_set< Key, Hash, Pred >::iterator & iv::volatile_set< Key, Hash, Pred >::lock_begin

this is stack based; lock_end unlocks (and invalidates) iterator returned by last lock_begin call

Definition at line 46 of file volatile_set.inl.

◆ lock_find()

template<class Key , class Hash , class Pred >
volatile_set< Key, Hash, Pred >::iterator & iv::volatile_set< Key, Hash, Pred >::lock_find ( Key const &  val)

Definition at line 54 of file volatile_set.inl.

◆ unlock()

template<class Key , class Hash , class Pred >
void iv::volatile_set< Key, Hash, Pred >::unlock

Definition at line 61 of file volatile_set.inl.

◆ end()

template<class Key , class Hash , class Pred >
volatile_set< Key, Hash, Pred >::iterator iv::volatile_set< Key, Hash, Pred >::end

Definition at line 73 of file volatile_set.inl.

◆ size()

template<class Key , class Hash , class Pred >
size_t iv::volatile_set< Key, Hash, Pred >::size

Definition at line 85 of file volatile_set.inl.

◆ empty()

template<class Key , class Hash , class Pred >
bool iv::volatile_set< Key, Hash, Pred >::empty

Definition at line 92 of file volatile_set.inl.


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