AK: Remove HashMap::hash()
Using `pair_int_hash()` which subsequently uses `int_hash()` means that ordering of the input is important. Since this operates on unordered HashMaps as well, order of the keys and values is dependent on the internal implementation of HashTable and might differ between HashMaps with identical contents, making this implementation of `::hash()` not that useful. Fortunately, it is unused, so let's remove this footgun.
This commit is contained in:
parent
887ed85877
commit
4c58be255a
1 changed files with 0 additions and 10 deletions
10
AK/HashMap.h
10
AK/HashMap.h
|
|
@ -301,16 +301,6 @@ public:
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] u32 hash() const
|
|
||||||
{
|
|
||||||
u32 hash = 0;
|
|
||||||
for (auto const& [key, value] : *this) {
|
|
||||||
auto entry_hash = pair_int_hash(key.hash(), value.hash());
|
|
||||||
hash = pair_int_hash(hash, entry_hash);
|
|
||||||
}
|
|
||||||
return hash;
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename NewKeyTraits = KeyTraits, typename NewValueTraits = ValueTraits, bool NewIsOrdered = IsOrdered>
|
template<typename NewKeyTraits = KeyTraits, typename NewValueTraits = ValueTraits, bool NewIsOrdered = IsOrdered>
|
||||||
ErrorOr<HashMap<K, V, NewKeyTraits, NewValueTraits, NewIsOrdered>> clone() const
|
ErrorOr<HashMap<K, V, NewKeyTraits, NewValueTraits, NewIsOrdered>> clone() const
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue