Luna::SelfIndexedUnorderedMultiMap
Represents one self-indexed unordered map similar to SelfIndexedUnorderedMap, but allows multiple elements with the same key to be inserted.
template <typename _Kty, typename _Ty, typename _ExtractKey, typename _Hash, typename _KeyEqual, typename _Alloc>
class Luna::SelfIndexedUnorderedMultiMap
Member functions
-
SelfIndexedUnorderedMultiMap()
Constructs an empty map.
-
SelfIndexedUnorderedMultiMap(const allocator_type &alloc)
Constructs an empty map with an custom allocator.
-
SelfIndexedUnorderedMultiMap(const SelfIndexedUnorderedMultiMap &rhs)
Constructs a map by coping elements from another map.
-
SelfIndexedUnorderedMultiMap(const SelfIndexedUnorderedMultiMap &rhs, const allocator_type &alloc)
Constructs a map with an custom allocator and with elements copied from another map.
-
SelfIndexedUnorderedMultiMap(SelfIndexedUnorderedMultiMap &&rhs)
Constructs a map by moving elements from another map.
-
SelfIndexedUnorderedMultiMap(SelfIndexedUnorderedMultiMap &&rhs, const allocator_type &alloc)
Constructs a map with an custom allocator and with elements moved from another map.
-
SelfIndexedUnorderedMultiMap & operator=(const SelfIndexedUnorderedMultiMap &rhs)
Replaces elements of the map by coping elements from another map.
-
SelfIndexedUnorderedMultiMap & operator=(SelfIndexedUnorderedMultiMap &&rhs)
Replaces elements of the map by moving elements from another map.
-
Gets one iterator to the first element of the map.
-
Gets one constant iterator to the first element of the map.
-
Gets one constant iterator to the first element of the map.
-
Gets one iterator to the one past last element of the map.
-
Gets one constant iterator to the one past last element of the map.
-
Gets one constant iterator to the one past last element of the map.
-
Gets an iterator to the first element of the bucket with specified index.
-
const_local_iterator begin(usize n) const
Gets an constant iterator to the first element of the bucket with specified index.
-
const_local_iterator cbegin(usize n) const
Gets a constant iterator to the first element of the bucket with specified index.
-
Gets an iterator to the one-past-last element of the bucket with specified index.
-
const_local_iterator end(usize n) const
Gets a constant iterator to the one-past-last element of the bucket with specified index.
-
const_local_iterator cend(usize n) const
Gets a constant iterator to the one-past-last element of the bucket with specified index.
-
Checks whether this map is empty, that is, the size of this map is
0
. -
Gets the size of the map, that is, the number of elements in the map.
-
Gets the capacity of the map, that is, the number of elements the buckets can hold before expanding the bucket buffer.
-
Gets the number of buckets of the map.
-
usize bucket_size(usize n) const
Gets the number of elements of the specified bucket.
-
usize bucket(const key_type &key) const
Gets the index of the bucket that stores the specified key.
-
Gets the load factor of the map, which can be computed by
(f32)size() / (f32)bucket_count()
. -
Gets the maximum load factor allowed for the map.
-
Sets the maximum load factor allowed for the map.
-
Removes all elements in the map.
-
Gets the hash function used by this map.
-
Gets the equality comparison function used by this map.
-
void rehash(usize new_buckets_count)
Changes the bucket count and rehashes all elements to insert them to the new buckets.
-
Expands the bucket buffer so that it can store at least
new_cap
elements without enpanding the bucket buffer again. -
iterator find(const key_type &key)
Finds the specified element in the map.
-
const_iterator find(const key_type &key) const
Finds the specified element in the map.
-
usize count(const key_type &key) const
Gets the number of elements whose key is equal to the specified key.
-
Pair< iterator, iterator > equal_range(const key_type &key)
Gets one pair of iterators specifying one range of elements whose keys are equal to the specified key.
-
Pair< const_iterator, const_iterator > equal_range(const key_type &key) const
Gets one pair of iterators specifying one range of elements whose keys are equal to the specified key.
-
bool contains(const key_type &key) const
Checks whether at least one element with the specified key exists.
-
iterator insert(const value_type &value)
Inserts the specified value to the map. The key is extracted from the value.
-
iterator insert(value_type &&value)
Inserts the specified value to the map. The key is extracted from the value.
-
iterator insert(node_type &&node)
Inserts one node to the map if the node is not empty.
-
iterator emplace(_Args &&... args)
Constructs one element directly in the map using the provided arguments.
-
iterator erase(const_iterator pos)
Removes one element from the map.
-
usize erase(const key_type &key)
Removes elements with the specified key from the map.
-
void swap(SelfIndexedUnorderedMultiMap &rhs)
Swaps elements of this map with the specified map.
-
node_type extract(const_iterator pos)
Extracts one node from the map, so that it can be inserted to another map without any element copy or move operation.
-
allocator_type get_allocator() const
Gets the allocator used by this map.