Luna::HashSet
An container that contains a set of unique objects using open-addressing hashing algorithm.
template <typename _Kty, typename _Hash, typename _KeyEqual, typename _Alloc>
class Luna::HashSet
Remark
See remarks of HashMap for details.
Member functions
-
Constructs an empty set.
-
HashSet(const allocator_type &alloc)
Constructs an empty set with an custom allocator.
-
Constructs a set by coping elements from another set.
-
HashSet(const HashSet &rhs, const allocator_type &alloc)
Constructs a set with an custom allocator and with elements copied from another set.
-
Constructs a set by moving elements from another set.
-
HashSet(HashSet &&rhs, const allocator_type &alloc)
Constructs a set with an custom allocator and with elements moved from another set.
-
HashSet & operator=(const HashSet &rhs)
Replaces elements of the set by coping elements from another set.
-
HashSet & operator=(HashSet &&rhs)
Replaces elements of the set by moving elements from another set.
-
Gets one iterator to the first element of the set.
-
Gets one constant iterator to the first element of the set.
-
Gets one constant iterator to the first element of the set.
-
Gets one iterator to the one past last element of the set.
-
Gets one constant iterator to the one past last element of the set.
-
Gets one constant iterator to the one past last element of the set.
-
Checks whether this set is empty, that is, the size of this set is
0
. -
Gets the size of the set, that is, the number of elements in the set.
-
Gets the capacity of the set, that is, the number of elements the hash table can hold before expanding the hash table.
-
Gets the hash table size of the set, that is, the number of slots of the hash table array.
-
Gets the load factor of the set, which can be computed by
(f32)size() / (f32)hash_table_size()
. -
Gets the maximum load factor allowed for the set.
-
Sets the maximum load factor allowed for the set.
-
Removes all elements in the set.
-
Reduces the hash table size to a minimum value that satisfy the maximum load factor limitation.
-
Gets the hash function used by this set.
-
Gets the equality comparison function used by this set.
-
void rehash(usize new_buckets_count)
Changes the data table size and rehashes all elements to insert them to the new data table.
-
Expands the data table size to the specified value.
-
iterator find(const key_type &key)
Finds the specified element in the set.
-
const_iterator find(const key_type &key) const
Finds the specified element in the set.
-
usize count(const key_type &key) const
Gets the number of elements whose key is equal to the specified key.
-
bool contains(const key_type &key) const
Checks whether at least one element with the specified key exists.
-
Pair< iterator, bool > insert(const value_type &value)
Inserts the specified value to the set.
-
Pair< iterator, bool > insert(value_type &&value)
Inserts the specified value to the set.
-
Pair< iterator, bool > emplace(_Args &&... args)
Constructs one element directly in the set using the provided arguments.
-
iterator erase(const_iterator pos)
Removes one element from the set.
-
usize erase(const key_type &key)
Removes elements with the specified key from the set.
-
Swaps elements of this set with the specified set.
-
allocator_type get_allocator() const
Gets the allocator used by this set.