Include file:
#include "mcrl2/utilities/unordered_set.h
mcrl2::utilities::
unordered_set
¶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.TodoDoes not implement std::unordered_map equal_range and swap.
mcrl2::utilities::unordered_set::
bucket_iterator
¶typedef for typename std::vector< bucket_type >::iterator
mcrl2::utilities::unordered_set::
bucket_type
¶typedef for detail::bucket_list< Key, Allocator >
Combine the bucket list and a lock that locks modifications to the bucket list.
mcrl2::utilities::unordered_set::
const_bucket_iterator
¶typedef for typename std::vector< bucket_type >::const_iterator
mcrl2::utilities::unordered_set::
mutex_type
¶typedef for std::mutex
mcrl2::utilities::unordered_set::
allocator_type
¶typedef for typename bucket_type::NodeAllocator
mcrl2::utilities::unordered_set::
const_iterator
¶typedef for unordered_set_iterator< bucket_type, true >
mcrl2::utilities::unordered_set::
const_local_iterator
¶typedef for typename bucket_type::const_iterator
mcrl2::utilities::unordered_set::
const_pointer
¶typedef for typename std::allocator_traits< Allocator >::const_pointer
mcrl2::utilities::unordered_set::
const_reference
¶typedef for const value_type &
mcrl2::utilities::unordered_set::
difference_type
¶typedef for std::ptrdiff_t
mcrl2::utilities::unordered_set::
hasher
¶typedef for Hash
mcrl2::utilities::unordered_set::
iterator
¶typedef for const_iterator
mcrl2::utilities::unordered_set::
key_equal
¶typedef for Equals
mcrl2::utilities::unordered_set::
key_type
¶typedef for Key
mcrl2::utilities::unordered_set::
local_iterator
¶typedef for typename bucket_type::const_iterator
mcrl2::utilities::unordered_set::
pointer
¶typedef for typename std::allocator_traits< Allocator >::pointer
mcrl2::utilities::unordered_set::
reference
¶typedef for value_type &
mcrl2::utilities::unordered_set::
size_type
¶typedef for std::size_t
mcrl2::utilities::unordered_set::
value_type
¶typedef for Key
friend class mcrl2::utilities::unordered_set::unordered_map
friend class mcrl2::utilities::unordered_set::unordered_map
mcrl2::utilities::unordered_set::
allow_transparent
¶True iff the hash and equals functions allow transparent lookup,.
mcrl2::utilities::unordered_set::
m_allocator
¶mcrl2::utilities::unordered_set::
m_bucket_mutexes
¶mcrl2::utilities::unordered_set::
m_buckets
¶mcrl2::utilities::unordered_set::
m_buckets_mask
¶Always equal to m_buckets.size() - 1.
mcrl2::utilities::unordered_set::
m_equals
¶mcrl2::utilities::unordered_set::
m_hash
¶mcrl2::utilities::unordered_set::
m_max_load_factor
¶mcrl2::utilities::unordered_set::
m_number_of_elements
¶The number of elements stored in this set.
begin
()Returns: An iterator over all keys.
begin
() constReturns: A const iterator over all keys.
begin
(size_type n)Returns: An iterator to the elements in the given bucket with index n.
begin
(size_type n) constbucket
(const key_type &key) const noexceptbucket_count
() const noexceptReturns: The number of buckets.
bucket_size
(size_type n) const noexceptcapacity
() const noexceptReturns: The number of elements that can be present in the set before resizing.
Not standard.
cbegin
() constReturns: A const iterator over all keys.
cbegin
(size_type n) constcend
() constcend
(size_type n) constclear
()Removes all elements from the set.
Does not free the vector of buckets itself.
count
(const Args&... args) const¶Counts the number of occurrences of the given key (1 when it exists and 0 otherwise).
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
empty
() const noexceptReturns: True iff the set is empty.
end
()end
() constend
(size_type n)end
(size_type n) consterase
(const Args&... args)¶Erases the given key_type(args…) from the unordered set.
erase
(const_iterator it)Erases the element pointed to by the iterator.
Returns: An iterator to the next key.
find
(const Args&... args)find
(const Args&... args) constSearches 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.
get_allocator
() const noexceptReturns: A reference to the local node allocator.
get_allocator
() noexcepthash_function
() constkey_eq
() constload_factor
() constmax_bucket_count
() const noexceptmax_load_factor
() constmax_load_factor
(float factor)max_size
() const noexceptoperator=
(const unordered_set &set)¶operator=
(unordered_set &&other) = default¶rehash
(size_type number_of_buckets)Resize the number buckets to at least number_of_buckets.
rehash_if_needed
()Resizes the hash table if necessary.
Not standard.
reserve
(size_type count)Resizes the set to the given number of elements.
size
() const noexceptReturns: The amount of elements stored in this set.
unordered_set
()¶unordered_set
(const unordered_set &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
(unordered_set &&other) = default¶~unordered_set
()¶emplace_impl
(size_type bucket_index, Args&&... args)¶Inserts T(args…) into the given bucket, assumes that it did not exists before. threadsafe.
erase_impl
(const Args&... args)¶Removes T(args…) from the set.
find_bucket_index
(const Args&... args) const¶Returns: The index of the bucket that might contain the element constructed by the given arguments.
find_impl
(size_type bucket_index, const Args&... args) const¶Searches for the element in the given bucket.