mCRL2
Loading...
Searching...
No Matches
mcrl2::utilities::unordered_set< Key, Hash, Equals, Allocator, ThreadSafe, Resize > Class Template Reference

A unordered_set with a subset of the interface of std::unordered_set that only stores a single pointer for each element. More...

#include <unordered_set.h>

Classes

class  unordered_set_iterator
 An iterator over all elements in the unordered set. More...
 

Public Types

using key_type = Key
 
using value_type = Key
 
using hasher = Hash
 
using key_equal = Equals
 
using allocator_type = typename bucket_type::NodeAllocator
 
using reference = value_type &
 
using const_reference = const value_type &
 
using pointer = typename std::allocator_traits< Allocator >::pointer
 
using const_pointer = typename std::allocator_traits< Allocator >::const_pointer
 
using const_local_iterator = typename bucket_type::const_iterator
 
using local_iterator = typename bucket_type::const_iterator
 
using const_iterator = unordered_set_iterator< bucket_type, true >
 
using iterator = const_iterator
 
using size_type = std::size_t
 
using difference_type = std::ptrdiff_t
 

Public Member Functions

 unordered_set ()
 
 unordered_set (size_type bucket_count, const hasher &hash=hasher(), const key_equal &equals=key_equal())
 Constructs an unordered_set that contains bucket_count number of buckets.
 
 unordered_set (const unordered_set &set)
 
unordered_setoperator= (const unordered_set &set)
 
 unordered_set (unordered_set &&other)=default
 
unordered_setoperator= (unordered_set &&other)=default
 
 ~unordered_set ()
 
const allocator_typeget_allocator () const noexcept
 
allocator_typeget_allocator () noexcept
 
iterator begin ()
 
iterator end ()
 
const_iterator begin () const
 
const_iterator end () const
 
const_iterator cbegin () const
 
const_iterator cend () const
 
bool empty () const noexcept
 
size_type size () const noexcept
 
size_type max_size () const noexcept
 
void clear ()
 Removes all elements from the set.
 
template<typename ... Args>
std::pair< iterator, bool > emplace (Args &&... args)
 Inserts an element Key(args...) into the set if it did not already exist.
 
template<typename... Args>
void erase (const Args &... args)
 Erases the given key_type(args...) from the unordered set.
 
iterator erase (const_iterator it)
 Erases the element pointed to by the iterator.
 
template<typename ... Args>
size_type count (const Args &... args) const
 Counts the number of occurrences of the given key (1 when it exists and 0 otherwise).
 
template<typename... Args>
const_iterator find (const Args &... args) const
 Searches whether an object key_type(args...) occurs in the set.
 
template<typename... Args>
iterator find (const Args &... args)
 
local_iterator begin (size_type n)
 
local_iterator end (size_type n)
 
const_local_iterator begin (size_type n) const
 
const_local_iterator end (size_type n) const
 
const_local_iterator cbegin (size_type n) const
 
const_local_iterator cend (size_type n) const
 
size_type bucket_count () const noexcept
 
size_type max_bucket_count () const noexcept
 
size_type bucket_size (size_type n) const noexcept
 
size_type bucket (const key_type &key) const noexcept
 
float load_factor () const
 
float max_load_factor () const
 
void max_load_factor (float factor)
 
void rehash (size_type number_of_buckets)
 Resize the number buckets to at least number_of_buckets.
 
void reserve (size_type count)
 Resizes the set to the given number of elements.
 
hasher hash_function () const
 
key_equal key_eq () const
 
size_type capacity () const noexcept
 
void rehash_if_needed ()
 Resizes the hash table if necessary.
 

Private Types

using bucket_type = detail::bucket_list< Key, Allocator >
 Combine the bucket list and a lock that locks modifications to the bucket list.
 
using bucket_iterator = typename std::vector< bucket_type >::iterator
 
using const_bucket_iterator = typename std::vector< bucket_type >::const_iterator
 
using mutex_type = std::mutex
 

Private Member Functions

template<typename ... Args>
std::pair< iterator, bool > emplace_impl (size_type bucket_index, Args &&... args)
 Inserts T(args...) into the given bucket, assumes that it did not exists before. \threadsafe.
 
template<typename ... Args>
void erase_impl (const Args &... args)
 Removes T(args...) from the set.
 
template<typename ... Args>
size_type find_bucket_index (const Args &... args) const
 
template<typename ... Args>
const_iterator find_impl (size_type bucket_index, const Args &... args) const
 Searches for the element in the given bucket.
 

Private Attributes

std::conditional_t< ThreadSafe, std::atomic< size_type >, size_typem_number_of_elements = 0
 The number of elements stored in this set.
 
std::conditional_t< ThreadSafe, std::atomic< size_type >, size_typem_buckets_mask = 0
 Always equal to m_buckets.size() - 1.
 
std::vector< bucket_typem_buckets
 
std::vector< std::mutex > m_bucket_mutexes
 
float m_max_load_factor = 1.0f
 
hasher m_hash = hasher()
 
key_equal m_equals = key_equal()
 
allocator_type m_allocator
 

Static Private Attributes

static constexpr bool allow_transparent = detail::is_transparent<Hash>() && detail::is_transparent<Equals>()
 True iff the hash and equals functions allow transparent lookup,.
 

Friends

template<typename Key_ , typename T , typename Hash_ , typename KeyEqual , typename Allocator_ , bool ThreadSafe_, bool Resize_>
class unordered_map
 
template<typename Key_ , typename T , typename Hash_ , typename KeyEqual , typename Allocator_ , bool ThreadSafe_, bool Resize_>
class unordered_map
 

Detailed Description

template<typename Key, typename Hash = std::hash<Key>, typename Equals = std::equal_to<Key>, typename Allocator = std::allocator<Key>, bool ThreadSafe = false, bool Resize = true>
class mcrl2::utilities::unordered_set< Key, Hash, Equals, Allocator, ThreadSafe, Resize >

A unordered_set with a subset of the interface of std::unordered_set that only stores a single pointer for each element.

Only supports input iterators (not bidirectional) compared to std::unordered_set. Furthermore, iterating over all elements in the set is O(n + m), where n is the number of elements in the set and m the number of empty buckets. Also incrementing the iterator is O(m) as opposed to O(1) as the standard mandates.

Additionally, the unordered_set supports allocators that have a specialized allocate_args(args...) to vary the allocation size based on the arguments used. This is required to store _aterm_appl classes with the function symbol arity determined at runtime.

Threadsafe enables concurrent emplace calls, and Resize enables automatically resizing if needed.

Todo:
Does not implement std::unordered_map equal_range and swap.

Definition at line 74 of file unordered_set.h.

Member Typedef Documentation

◆ allocator_type

template<typename Key , typename Hash = std::hash<Key>, typename Equals = std::equal_to<Key>, typename Allocator = std::allocator<Key>, bool ThreadSafe = false, bool Resize = true>
using mcrl2::utilities::unordered_set< Key, Hash, Equals, Allocator, ThreadSafe, Resize >::allocator_type = typename bucket_type::NodeAllocator

Definition at line 218 of file unordered_set.h.

◆ bucket_iterator

template<typename Key , typename Hash = std::hash<Key>, typename Equals = std::equal_to<Key>, typename Allocator = std::allocator<Key>, bool ThreadSafe = false, bool Resize = true>
using mcrl2::utilities::unordered_set< Key, Hash, Equals, Allocator, ThreadSafe, Resize >::bucket_iterator = typename std::vector<bucket_type>::iterator
private

Definition at line 81 of file unordered_set.h.

◆ bucket_type

template<typename Key , typename Hash = std::hash<Key>, typename Equals = std::equal_to<Key>, typename Allocator = std::allocator<Key>, bool ThreadSafe = false, bool Resize = true>
using mcrl2::utilities::unordered_set< Key, Hash, Equals, Allocator, ThreadSafe, Resize >::bucket_type = detail::bucket_list<Key, Allocator>
private

Combine the bucket list and a lock that locks modifications to the bucket list.

Definition at line 80 of file unordered_set.h.

◆ const_bucket_iterator

template<typename Key , typename Hash = std::hash<Key>, typename Equals = std::equal_to<Key>, typename Allocator = std::allocator<Key>, bool ThreadSafe = false, bool Resize = true>
using mcrl2::utilities::unordered_set< Key, Hash, Equals, Allocator, ThreadSafe, Resize >::const_bucket_iterator = typename std::vector<bucket_type>::const_iterator
private

Definition at line 82 of file unordered_set.h.

◆ const_iterator

template<typename Key , typename Hash = std::hash<Key>, typename Equals = std::equal_to<Key>, typename Allocator = std::allocator<Key>, bool ThreadSafe = false, bool Resize = true>
using mcrl2::utilities::unordered_set< Key, Hash, Equals, Allocator, ThreadSafe, Resize >::const_iterator = unordered_set_iterator<bucket_type, true>

Definition at line 227 of file unordered_set.h.

◆ const_local_iterator

template<typename Key , typename Hash = std::hash<Key>, typename Equals = std::equal_to<Key>, typename Allocator = std::allocator<Key>, bool ThreadSafe = false, bool Resize = true>
using mcrl2::utilities::unordered_set< Key, Hash, Equals, Allocator, ThreadSafe, Resize >::const_local_iterator = typename bucket_type::const_iterator

Definition at line 225 of file unordered_set.h.

◆ const_pointer

template<typename Key , typename Hash = std::hash<Key>, typename Equals = std::equal_to<Key>, typename Allocator = std::allocator<Key>, bool ThreadSafe = false, bool Resize = true>
using mcrl2::utilities::unordered_set< Key, Hash, Equals, Allocator, ThreadSafe, Resize >::const_pointer = typename std::allocator_traits<Allocator>::const_pointer

Definition at line 223 of file unordered_set.h.

◆ const_reference

template<typename Key , typename Hash = std::hash<Key>, typename Equals = std::equal_to<Key>, typename Allocator = std::allocator<Key>, bool ThreadSafe = false, bool Resize = true>
using mcrl2::utilities::unordered_set< Key, Hash, Equals, Allocator, ThreadSafe, Resize >::const_reference = const value_type&

Definition at line 221 of file unordered_set.h.

◆ difference_type

template<typename Key , typename Hash = std::hash<Key>, typename Equals = std::equal_to<Key>, typename Allocator = std::allocator<Key>, bool ThreadSafe = false, bool Resize = true>
using mcrl2::utilities::unordered_set< Key, Hash, Equals, Allocator, ThreadSafe, Resize >::difference_type = std::ptrdiff_t

Definition at line 231 of file unordered_set.h.

◆ hasher

template<typename Key , typename Hash = std::hash<Key>, typename Equals = std::equal_to<Key>, typename Allocator = std::allocator<Key>, bool ThreadSafe = false, bool Resize = true>
using mcrl2::utilities::unordered_set< Key, Hash, Equals, Allocator, ThreadSafe, Resize >::hasher = Hash

Definition at line 216 of file unordered_set.h.

◆ iterator

template<typename Key , typename Hash = std::hash<Key>, typename Equals = std::equal_to<Key>, typename Allocator = std::allocator<Key>, bool ThreadSafe = false, bool Resize = true>
using mcrl2::utilities::unordered_set< Key, Hash, Equals, Allocator, ThreadSafe, Resize >::iterator = const_iterator

Definition at line 228 of file unordered_set.h.

◆ key_equal

template<typename Key , typename Hash = std::hash<Key>, typename Equals = std::equal_to<Key>, typename Allocator = std::allocator<Key>, bool ThreadSafe = false, bool Resize = true>
using mcrl2::utilities::unordered_set< Key, Hash, Equals, Allocator, ThreadSafe, Resize >::key_equal = Equals

Definition at line 217 of file unordered_set.h.

◆ key_type

template<typename Key , typename Hash = std::hash<Key>, typename Equals = std::equal_to<Key>, typename Allocator = std::allocator<Key>, bool ThreadSafe = false, bool Resize = true>
using mcrl2::utilities::unordered_set< Key, Hash, Equals, Allocator, ThreadSafe, Resize >::key_type = Key

Definition at line 214 of file unordered_set.h.

◆ local_iterator

template<typename Key , typename Hash = std::hash<Key>, typename Equals = std::equal_to<Key>, typename Allocator = std::allocator<Key>, bool ThreadSafe = false, bool Resize = true>
using mcrl2::utilities::unordered_set< Key, Hash, Equals, Allocator, ThreadSafe, Resize >::local_iterator = typename bucket_type::const_iterator

Definition at line 226 of file unordered_set.h.

◆ mutex_type

template<typename Key , typename Hash = std::hash<Key>, typename Equals = std::equal_to<Key>, typename Allocator = std::allocator<Key>, bool ThreadSafe = false, bool Resize = true>
using mcrl2::utilities::unordered_set< Key, Hash, Equals, Allocator, ThreadSafe, Resize >::mutex_type = std::mutex
private

Definition at line 83 of file unordered_set.h.

◆ pointer

template<typename Key , typename Hash = std::hash<Key>, typename Equals = std::equal_to<Key>, typename Allocator = std::allocator<Key>, bool ThreadSafe = false, bool Resize = true>
using mcrl2::utilities::unordered_set< Key, Hash, Equals, Allocator, ThreadSafe, Resize >::pointer = typename std::allocator_traits<Allocator>::pointer

Definition at line 222 of file unordered_set.h.

◆ reference

template<typename Key , typename Hash = std::hash<Key>, typename Equals = std::equal_to<Key>, typename Allocator = std::allocator<Key>, bool ThreadSafe = false, bool Resize = true>
using mcrl2::utilities::unordered_set< Key, Hash, Equals, Allocator, ThreadSafe, Resize >::reference = value_type&

Definition at line 220 of file unordered_set.h.

◆ size_type

template<typename Key , typename Hash = std::hash<Key>, typename Equals = std::equal_to<Key>, typename Allocator = std::allocator<Key>, bool ThreadSafe = false, bool Resize = true>
using mcrl2::utilities::unordered_set< Key, Hash, Equals, Allocator, ThreadSafe, Resize >::size_type = std::size_t

Definition at line 230 of file unordered_set.h.

◆ value_type

template<typename Key , typename Hash = std::hash<Key>, typename Equals = std::equal_to<Key>, typename Allocator = std::allocator<Key>, bool ThreadSafe = false, bool Resize = true>
using mcrl2::utilities::unordered_set< Key, Hash, Equals, Allocator, ThreadSafe, Resize >::value_type = Key

Definition at line 215 of file unordered_set.h.

Constructor & Destructor Documentation

◆ unordered_set() [1/4]

template<typename Key , typename Hash = std::hash<Key>, typename Equals = std::equal_to<Key>, typename Allocator = std::allocator<Key>, bool ThreadSafe = false, bool Resize = true>
mcrl2::utilities::unordered_set< Key, Hash, Equals, Allocator, ThreadSafe, Resize >::unordered_set ( )
inline

Definition at line 233 of file unordered_set.h.

◆ unordered_set() [2/4]

template<typename Key , typename Hash = std::hash<Key>, typename Equals = std::equal_to<Key>, typename Allocator = std::allocator<Key>, bool ThreadSafe = false, bool Resize = true>
mcrl2::utilities::unordered_set< Key, Hash, Equals, Allocator, ThreadSafe, Resize >::unordered_set ( size_type  bucket_count,
const hasher hash = hasher(),
const key_equal equals = key_equal() 
)
inlineexplicit

Constructs an unordered_set that contains bucket_count number of buckets.

Definition at line 236 of file unordered_set.h.

◆ unordered_set() [3/4]

template<typename Key , typename Hash = std::hash<Key>, typename Equals = std::equal_to<Key>, typename Allocator = std::allocator<Key>, bool ThreadSafe = false, bool Resize = true>
mcrl2::utilities::unordered_set< Key, Hash, Equals, Allocator, ThreadSafe, Resize >::unordered_set ( const unordered_set< Key, Hash, Equals, Allocator, ThreadSafe, Resize > &  set)

◆ unordered_set() [4/4]

template<typename Key , typename Hash = std::hash<Key>, typename Equals = std::equal_to<Key>, typename Allocator = std::allocator<Key>, bool ThreadSafe = false, bool Resize = true>
mcrl2::utilities::unordered_set< Key, Hash, Equals, Allocator, ThreadSafe, Resize >::unordered_set ( unordered_set< Key, Hash, Equals, Allocator, ThreadSafe, Resize > &&  other)
default

◆ ~unordered_set()

template<typename Key , typename Hash = std::hash<Key>, typename Equals = std::equal_to<Key>, typename Allocator = std::allocator<Key>, bool ThreadSafe = false, bool Resize = true>
mcrl2::utilities::unordered_set< Key, Hash, Equals, Allocator, ThreadSafe, Resize >::~unordered_set ( )

Member Function Documentation

◆ begin() [1/4]

template<typename Key , typename Hash = std::hash<Key>, typename Equals = std::equal_to<Key>, typename Allocator = std::allocator<Key>, bool ThreadSafe = false, bool Resize = true>
iterator mcrl2::utilities::unordered_set< Key, Hash, Equals, Allocator, ThreadSafe, Resize >::begin ( )
inline
Returns
An iterator over all keys.

Definition at line 260 of file unordered_set.h.

◆ begin() [2/4]

template<typename Key , typename Hash = std::hash<Key>, typename Equals = std::equal_to<Key>, typename Allocator = std::allocator<Key>, bool ThreadSafe = false, bool Resize = true>
const_iterator mcrl2::utilities::unordered_set< Key, Hash, Equals, Allocator, ThreadSafe, Resize >::begin ( ) const
inline
Returns
A const iterator over all keys.

Definition at line 264 of file unordered_set.h.

◆ begin() [3/4]

template<typename Key , typename Hash = std::hash<Key>, typename Equals = std::equal_to<Key>, typename Allocator = std::allocator<Key>, bool ThreadSafe = false, bool Resize = true>
local_iterator mcrl2::utilities::unordered_set< Key, Hash, Equals, Allocator, ThreadSafe, Resize >::begin ( size_type  n)
inline
Returns
An iterator to the elements in the given bucket with index n.

Definition at line 310 of file unordered_set.h.

◆ begin() [4/4]

template<typename Key , typename Hash = std::hash<Key>, typename Equals = std::equal_to<Key>, typename Allocator = std::allocator<Key>, bool ThreadSafe = false, bool Resize = true>
const_local_iterator mcrl2::utilities::unordered_set< Key, Hash, Equals, Allocator, ThreadSafe, Resize >::begin ( size_type  n) const
inline

Definition at line 313 of file unordered_set.h.

◆ bucket()

template<typename Key , typename Hash = std::hash<Key>, typename Equals = std::equal_to<Key>, typename Allocator = std::allocator<Key>, bool ThreadSafe = false, bool Resize = true>
size_type mcrl2::utilities::unordered_set< Key, Hash, Equals, Allocator, ThreadSafe, Resize >::bucket ( const key_type key) const
inlinenoexcept

Definition at line 324 of file unordered_set.h.

◆ bucket_count()

template<typename Key , typename Hash = std::hash<Key>, typename Equals = std::equal_to<Key>, typename Allocator = std::allocator<Key>, bool ThreadSafe = false, bool Resize = true>
size_type mcrl2::utilities::unordered_set< Key, Hash, Equals, Allocator, ThreadSafe, Resize >::bucket_count ( ) const
inlinenoexcept
Returns
The number of buckets.

Definition at line 320 of file unordered_set.h.

◆ bucket_size()

template<typename Key , typename Hash = std::hash<Key>, typename Equals = std::equal_to<Key>, typename Allocator = std::allocator<Key>, bool ThreadSafe = false, bool Resize = true>
size_type mcrl2::utilities::unordered_set< Key, Hash, Equals, Allocator, ThreadSafe, Resize >::bucket_size ( size_type  n) const
inlinenoexcept

Definition at line 323 of file unordered_set.h.

◆ capacity()

template<typename Key , typename Hash = std::hash<Key>, typename Equals = std::equal_to<Key>, typename Allocator = std::allocator<Key>, bool ThreadSafe = false, bool Resize = true>
size_type mcrl2::utilities::unordered_set< Key, Hash, Equals, Allocator, ThreadSafe, Resize >::capacity ( ) const
inlinenoexcept
Returns
The number of elements that can be present in the set before resizing.

Not standard.

Definition at line 341 of file unordered_set.h.

◆ cbegin() [1/2]

template<typename Key , typename Hash = std::hash<Key>, typename Equals = std::equal_to<Key>, typename Allocator = std::allocator<Key>, bool ThreadSafe = false, bool Resize = true>
const_iterator mcrl2::utilities::unordered_set< Key, Hash, Equals, Allocator, ThreadSafe, Resize >::cbegin ( ) const
inline
Returns
A const iterator over all keys.

Definition at line 268 of file unordered_set.h.

◆ cbegin() [2/2]

template<typename Key , typename Hash = std::hash<Key>, typename Equals = std::equal_to<Key>, typename Allocator = std::allocator<Key>, bool ThreadSafe = false, bool Resize = true>
const_local_iterator mcrl2::utilities::unordered_set< Key, Hash, Equals, Allocator, ThreadSafe, Resize >::cbegin ( size_type  n) const
inline

Definition at line 316 of file unordered_set.h.

◆ cend() [1/2]

template<typename Key , typename Hash = std::hash<Key>, typename Equals = std::equal_to<Key>, typename Allocator = std::allocator<Key>, bool ThreadSafe = false, bool Resize = true>
const_iterator mcrl2::utilities::unordered_set< Key, Hash, Equals, Allocator, ThreadSafe, Resize >::cend ( ) const
inline

Definition at line 269 of file unordered_set.h.

◆ cend() [2/2]

template<typename Key , typename Hash = std::hash<Key>, typename Equals = std::equal_to<Key>, typename Allocator = std::allocator<Key>, bool ThreadSafe = false, bool Resize = true>
const_local_iterator mcrl2::utilities::unordered_set< Key, Hash, Equals, Allocator, ThreadSafe, Resize >::cend ( size_type  n) const
inline

Definition at line 317 of file unordered_set.h.

◆ clear()

template<typename Key , typename Hash = std::hash<Key>, typename Equals = std::equal_to<Key>, typename Allocator = std::allocator<Key>, bool ThreadSafe = false, bool Resize = true>
void mcrl2::utilities::unordered_set< Key, Hash, Equals, Allocator, ThreadSafe, Resize >::clear ( )

Removes all elements from the set.

Does not free the vector of buckets itself.

◆ count()

template<typename Key , typename Hash = std::hash<Key>, typename Equals = std::equal_to<Key>, typename Allocator = std::allocator<Key>, bool ThreadSafe = false, bool Resize = true>
template<typename ... Args>
size_type mcrl2::utilities::unordered_set< Key, Hash, Equals, Allocator, ThreadSafe, Resize >::count ( const Args &...  args) const

Counts the number of occurrences of the given key (1 when it exists and 0 otherwise).

◆ emplace()

template<typename Key , typename Hash = std::hash<Key>, typename Equals = std::equal_to<Key>, typename Allocator = std::allocator<Key>, bool ThreadSafe = false, bool Resize = true>
template<typename ... Args>
std::pair< iterator, bool > mcrl2::utilities::unordered_set< Key, Hash, Equals, Allocator, ThreadSafe, Resize >::emplace ( Args &&...  args)

Inserts an element Key(args...) into the set if it did not already exist.

Returns
A pair of the iterator pointing to the element and a boolean that is true iff a new element was inserted (as opposed to it already existing in the set). \threadsafe

◆ emplace_impl()

template<typename Key , typename Hash = std::hash<Key>, typename Equals = std::equal_to<Key>, typename Allocator = std::allocator<Key>, bool ThreadSafe = false, bool Resize = true>
template<typename ... Args>
std::pair< iterator, bool > mcrl2::utilities::unordered_set< Key, Hash, Equals, Allocator, ThreadSafe, Resize >::emplace_impl ( size_type  bucket_index,
Args &&...  args 
)
private

Inserts T(args...) into the given bucket, assumes that it did not exists before. \threadsafe.

◆ empty()

template<typename Key , typename Hash = std::hash<Key>, typename Equals = std::equal_to<Key>, typename Allocator = std::allocator<Key>, bool ThreadSafe = false, bool Resize = true>
bool mcrl2::utilities::unordered_set< Key, Hash, Equals, Allocator, ThreadSafe, Resize >::empty ( ) const
inlinenoexcept
Returns
True iff the set is empty.

Definition at line 272 of file unordered_set.h.

◆ end() [1/4]

template<typename Key , typename Hash = std::hash<Key>, typename Equals = std::equal_to<Key>, typename Allocator = std::allocator<Key>, bool ThreadSafe = false, bool Resize = true>
iterator mcrl2::utilities::unordered_set< Key, Hash, Equals, Allocator, ThreadSafe, Resize >::end ( )
inline

Definition at line 261 of file unordered_set.h.

◆ end() [2/4]

template<typename Key , typename Hash = std::hash<Key>, typename Equals = std::equal_to<Key>, typename Allocator = std::allocator<Key>, bool ThreadSafe = false, bool Resize = true>
const_iterator mcrl2::utilities::unordered_set< Key, Hash, Equals, Allocator, ThreadSafe, Resize >::end ( ) const
inline

Definition at line 265 of file unordered_set.h.

◆ end() [3/4]

template<typename Key , typename Hash = std::hash<Key>, typename Equals = std::equal_to<Key>, typename Allocator = std::allocator<Key>, bool ThreadSafe = false, bool Resize = true>
local_iterator mcrl2::utilities::unordered_set< Key, Hash, Equals, Allocator, ThreadSafe, Resize >::end ( size_type  n)
inline

Definition at line 311 of file unordered_set.h.

◆ end() [4/4]

template<typename Key , typename Hash = std::hash<Key>, typename Equals = std::equal_to<Key>, typename Allocator = std::allocator<Key>, bool ThreadSafe = false, bool Resize = true>
const_local_iterator mcrl2::utilities::unordered_set< Key, Hash, Equals, Allocator, ThreadSafe, Resize >::end ( size_type  n) const
inline

Definition at line 314 of file unordered_set.h.

◆ erase() [1/2]

template<typename Key , typename Hash = std::hash<Key>, typename Equals = std::equal_to<Key>, typename Allocator = std::allocator<Key>, bool ThreadSafe = false, bool Resize = true>
template<typename... Args>
void mcrl2::utilities::unordered_set< Key, Hash, Equals, Allocator, ThreadSafe, Resize >::erase ( const Args &...  args)

Erases the given key_type(args...) from the unordered set.

◆ erase() [2/2]

template<typename Key , typename Hash = std::hash<Key>, typename Equals = std::equal_to<Key>, typename Allocator = std::allocator<Key>, bool ThreadSafe = false, bool Resize = true>
iterator mcrl2::utilities::unordered_set< Key, Hash, Equals, Allocator, ThreadSafe, Resize >::erase ( const_iterator  it)

Erases the element pointed to by the iterator.

Returns
An iterator to the next key.

◆ erase_impl()

template<typename Key , typename Hash = std::hash<Key>, typename Equals = std::equal_to<Key>, typename Allocator = std::allocator<Key>, bool ThreadSafe = false, bool Resize = true>
template<typename ... Args>
void mcrl2::utilities::unordered_set< Key, Hash, Equals, Allocator, ThreadSafe, Resize >::erase_impl ( const Args &...  args)
private

Removes T(args...) from the set.

◆ find() [1/2]

template<typename Key , typename Hash = std::hash<Key>, typename Equals = std::equal_to<Key>, typename Allocator = std::allocator<Key>, bool ThreadSafe = false, bool Resize = true>
template<typename... Args>
iterator mcrl2::utilities::unordered_set< Key, Hash, Equals, Allocator, ThreadSafe, Resize >::find ( const Args &...  args)

◆ find() [2/2]

template<typename Key , typename Hash = std::hash<Key>, typename Equals = std::equal_to<Key>, typename Allocator = std::allocator<Key>, bool ThreadSafe = false, bool Resize = true>
template<typename... Args>
const_iterator mcrl2::utilities::unordered_set< Key, Hash, Equals, Allocator, ThreadSafe, Resize >::find ( const Args &...  args) const

Searches whether an object key_type(args...) occurs in the set.

Returns
An iterator to the matching element or the end when this object does not exist.

◆ find_bucket_index()

template<typename Key , typename Hash = std::hash<Key>, typename Equals = std::equal_to<Key>, typename Allocator = std::allocator<Key>, bool ThreadSafe = false, bool Resize = true>
template<typename ... Args>
size_type mcrl2::utilities::unordered_set< Key, Hash, Equals, Allocator, ThreadSafe, Resize >::find_bucket_index ( const Args &...  args) const
private
Returns
The index of the bucket that might contain the element constructed by the given arguments.

◆ find_impl()

template<typename Key , typename Hash = std::hash<Key>, typename Equals = std::equal_to<Key>, typename Allocator = std::allocator<Key>, bool ThreadSafe = false, bool Resize = true>
template<typename ... Args>
const_iterator mcrl2::utilities::unordered_set< Key, Hash, Equals, Allocator, ThreadSafe, Resize >::find_impl ( size_type  bucket_index,
const Args &...  args 
) const
private

Searches for the element in the given bucket.

◆ get_allocator() [1/2]

template<typename Key , typename Hash = std::hash<Key>, typename Equals = std::equal_to<Key>, typename Allocator = std::allocator<Key>, bool ThreadSafe = false, bool Resize = true>
const allocator_type & mcrl2::utilities::unordered_set< Key, Hash, Equals, Allocator, ThreadSafe, Resize >::get_allocator ( ) const
inlinenoexcept
Returns
A reference to the local node allocator.

Definition at line 256 of file unordered_set.h.

◆ get_allocator() [2/2]

template<typename Key , typename Hash = std::hash<Key>, typename Equals = std::equal_to<Key>, typename Allocator = std::allocator<Key>, bool ThreadSafe = false, bool Resize = true>
allocator_type & mcrl2::utilities::unordered_set< Key, Hash, Equals, Allocator, ThreadSafe, Resize >::get_allocator ( )
inlinenoexcept

Definition at line 257 of file unordered_set.h.

◆ hash_function()

template<typename Key , typename Hash = std::hash<Key>, typename Equals = std::equal_to<Key>, typename Allocator = std::allocator<Key>, bool ThreadSafe = false, bool Resize = true>
hasher mcrl2::utilities::unordered_set< Key, Hash, Equals, Allocator, ThreadSafe, Resize >::hash_function ( ) const
inline

Definition at line 336 of file unordered_set.h.

◆ key_eq()

template<typename Key , typename Hash = std::hash<Key>, typename Equals = std::equal_to<Key>, typename Allocator = std::allocator<Key>, bool ThreadSafe = false, bool Resize = true>
key_equal mcrl2::utilities::unordered_set< Key, Hash, Equals, Allocator, ThreadSafe, Resize >::key_eq ( ) const
inline

Definition at line 337 of file unordered_set.h.

◆ load_factor()

template<typename Key , typename Hash = std::hash<Key>, typename Equals = std::equal_to<Key>, typename Allocator = std::allocator<Key>, bool ThreadSafe = false, bool Resize = true>
float mcrl2::utilities::unordered_set< Key, Hash, Equals, Allocator, ThreadSafe, Resize >::load_factor ( ) const
inline

Definition at line 326 of file unordered_set.h.

◆ max_bucket_count()

template<typename Key , typename Hash = std::hash<Key>, typename Equals = std::equal_to<Key>, typename Allocator = std::allocator<Key>, bool ThreadSafe = false, bool Resize = true>
size_type mcrl2::utilities::unordered_set< Key, Hash, Equals, Allocator, ThreadSafe, Resize >::max_bucket_count ( ) const
inlinenoexcept

Definition at line 321 of file unordered_set.h.

◆ max_load_factor() [1/2]

template<typename Key , typename Hash = std::hash<Key>, typename Equals = std::equal_to<Key>, typename Allocator = std::allocator<Key>, bool ThreadSafe = false, bool Resize = true>
float mcrl2::utilities::unordered_set< Key, Hash, Equals, Allocator, ThreadSafe, Resize >::max_load_factor ( ) const
inline

Definition at line 327 of file unordered_set.h.

◆ max_load_factor() [2/2]

template<typename Key , typename Hash = std::hash<Key>, typename Equals = std::equal_to<Key>, typename Allocator = std::allocator<Key>, bool ThreadSafe = false, bool Resize = true>
void mcrl2::utilities::unordered_set< Key, Hash, Equals, Allocator, ThreadSafe, Resize >::max_load_factor ( float  factor)
inline

Definition at line 328 of file unordered_set.h.

◆ max_size()

template<typename Key , typename Hash = std::hash<Key>, typename Equals = std::equal_to<Key>, typename Allocator = std::allocator<Key>, bool ThreadSafe = false, bool Resize = true>
size_type mcrl2::utilities::unordered_set< Key, Hash, Equals, Allocator, ThreadSafe, Resize >::max_size ( ) const
inlinenoexcept

Definition at line 276 of file unordered_set.h.

◆ operator=() [1/2]

template<typename Key , typename Hash = std::hash<Key>, typename Equals = std::equal_to<Key>, typename Allocator = std::allocator<Key>, bool ThreadSafe = false, bool Resize = true>
unordered_set & mcrl2::utilities::unordered_set< Key, Hash, Equals, Allocator, ThreadSafe, Resize >::operator= ( const unordered_set< Key, Hash, Equals, Allocator, ThreadSafe, Resize > &  set)

◆ operator=() [2/2]

template<typename Key , typename Hash = std::hash<Key>, typename Equals = std::equal_to<Key>, typename Allocator = std::allocator<Key>, bool ThreadSafe = false, bool Resize = true>
unordered_set & mcrl2::utilities::unordered_set< Key, Hash, Equals, Allocator, ThreadSafe, Resize >::operator= ( unordered_set< Key, Hash, Equals, Allocator, ThreadSafe, Resize > &&  other)
default

◆ rehash()

template<typename Key , typename Hash = std::hash<Key>, typename Equals = std::equal_to<Key>, typename Allocator = std::allocator<Key>, bool ThreadSafe = false, bool Resize = true>
void mcrl2::utilities::unordered_set< Key, Hash, Equals, Allocator, ThreadSafe, Resize >::rehash ( size_type  number_of_buckets)

Resize the number buckets to at least number_of_buckets.

◆ rehash_if_needed()

template<typename Key , typename Hash = std::hash<Key>, typename Equals = std::equal_to<Key>, typename Allocator = std::allocator<Key>, bool ThreadSafe = false, bool Resize = true>
void mcrl2::utilities::unordered_set< Key, Hash, Equals, Allocator, ThreadSafe, Resize >::rehash_if_needed ( )

Resizes the hash table if necessary.

Not standard.

◆ reserve()

template<typename Key , typename Hash = std::hash<Key>, typename Equals = std::equal_to<Key>, typename Allocator = std::allocator<Key>, bool ThreadSafe = false, bool Resize = true>
void mcrl2::utilities::unordered_set< Key, Hash, Equals, Allocator, ThreadSafe, Resize >::reserve ( size_type  count)
inline

Resizes the set to the given number of elements.

Definition at line 334 of file unordered_set.h.

◆ size()

template<typename Key , typename Hash = std::hash<Key>, typename Equals = std::equal_to<Key>, typename Allocator = std::allocator<Key>, bool ThreadSafe = false, bool Resize = true>
size_type mcrl2::utilities::unordered_set< Key, Hash, Equals, Allocator, ThreadSafe, Resize >::size ( ) const
inlinenoexcept
Returns
The amount of elements stored in this set.

Definition at line 275 of file unordered_set.h.

Friends And Related Symbol Documentation

◆ unordered_map [1/2]

template<typename Key , typename Hash = std::hash<Key>, typename Equals = std::equal_to<Key>, typename Allocator = std::allocator<Key>, bool ThreadSafe = false, bool Resize = true>
template<typename Key_ , typename T , typename Hash_ , typename KeyEqual , typename Allocator_ , bool ThreadSafe_, bool Resize_>
friend class unordered_map
friend

Definition at line 86 of file unordered_set.h.

◆ unordered_map [2/2]

template<typename Key , typename Hash = std::hash<Key>, typename Equals = std::equal_to<Key>, typename Allocator = std::allocator<Key>, bool ThreadSafe = false, bool Resize = true>
template<typename Key_ , typename T , typename Hash_ , typename KeyEqual , typename Allocator_ , bool ThreadSafe_, bool Resize_>
class unordered_map
friend

Definition at line 349 of file unordered_set.h.

Member Data Documentation

◆ allow_transparent

template<typename Key , typename Hash = std::hash<Key>, typename Equals = std::equal_to<Key>, typename Allocator = std::allocator<Key>, bool ThreadSafe = false, bool Resize = true>
constexpr bool mcrl2::utilities::unordered_set< Key, Hash, Equals, Allocator, ThreadSafe, Resize >::allow_transparent = detail::is_transparent<Hash>() && detail::is_transparent<Equals>()
staticconstexprprivate

True iff the hash and equals functions allow transparent lookup,.

Definition at line 369 of file unordered_set.h.

◆ m_allocator

template<typename Key , typename Hash = std::hash<Key>, typename Equals = std::equal_to<Key>, typename Allocator = std::allocator<Key>, bool ThreadSafe = false, bool Resize = true>
allocator_type mcrl2::utilities::unordered_set< Key, Hash, Equals, Allocator, ThreadSafe, Resize >::m_allocator
private

Definition at line 384 of file unordered_set.h.

◆ m_bucket_mutexes

template<typename Key , typename Hash = std::hash<Key>, typename Equals = std::equal_to<Key>, typename Allocator = std::allocator<Key>, bool ThreadSafe = false, bool Resize = true>
std::vector<std::mutex> mcrl2::utilities::unordered_set< Key, Hash, Equals, Allocator, ThreadSafe, Resize >::m_bucket_mutexes
private

Definition at line 378 of file unordered_set.h.

◆ m_buckets

template<typename Key , typename Hash = std::hash<Key>, typename Equals = std::equal_to<Key>, typename Allocator = std::allocator<Key>, bool ThreadSafe = false, bool Resize = true>
std::vector<bucket_type> mcrl2::utilities::unordered_set< Key, Hash, Equals, Allocator, ThreadSafe, Resize >::m_buckets
private

Definition at line 377 of file unordered_set.h.

◆ m_buckets_mask

template<typename Key , typename Hash = std::hash<Key>, typename Equals = std::equal_to<Key>, typename Allocator = std::allocator<Key>, bool ThreadSafe = false, bool Resize = true>
std::conditional_t<ThreadSafe, std::atomic<size_type>, size_type> mcrl2::utilities::unordered_set< Key, Hash, Equals, Allocator, ThreadSafe, Resize >::m_buckets_mask = 0
private

Always equal to m_buckets.size() - 1.

Definition at line 375 of file unordered_set.h.

◆ m_equals

template<typename Key , typename Hash = std::hash<Key>, typename Equals = std::equal_to<Key>, typename Allocator = std::allocator<Key>, bool ThreadSafe = false, bool Resize = true>
key_equal mcrl2::utilities::unordered_set< Key, Hash, Equals, Allocator, ThreadSafe, Resize >::m_equals = key_equal()
private

Definition at line 383 of file unordered_set.h.

◆ m_hash

template<typename Key , typename Hash = std::hash<Key>, typename Equals = std::equal_to<Key>, typename Allocator = std::allocator<Key>, bool ThreadSafe = false, bool Resize = true>
hasher mcrl2::utilities::unordered_set< Key, Hash, Equals, Allocator, ThreadSafe, Resize >::m_hash = hasher()
private

Definition at line 382 of file unordered_set.h.

◆ m_max_load_factor

template<typename Key , typename Hash = std::hash<Key>, typename Equals = std::equal_to<Key>, typename Allocator = std::allocator<Key>, bool ThreadSafe = false, bool Resize = true>
float mcrl2::utilities::unordered_set< Key, Hash, Equals, Allocator, ThreadSafe, Resize >::m_max_load_factor = 1.0f
private

Definition at line 380 of file unordered_set.h.

◆ m_number_of_elements

template<typename Key , typename Hash = std::hash<Key>, typename Equals = std::equal_to<Key>, typename Allocator = std::allocator<Key>, bool ThreadSafe = false, bool Resize = true>
std::conditional_t<ThreadSafe, std::atomic<size_type>, size_type> mcrl2::utilities::unordered_set< Key, Hash, Equals, Allocator, ThreadSafe, Resize >::m_number_of_elements = 0
private

The number of elements stored in this set.

Definition at line 372 of file unordered_set.h.


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