mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-25 17:25:08 +02:00
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:
committed by
Jelle Raaijmakers
parent
887ed85877
commit
4c58be255a
Notes:
github-actions[bot]
2026-02-06 10:57:22 +00:00
Author: https://github.com/gmta Commit: https://github.com/LadybirdBrowser/ladybird/commit/4c58be255a5 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/7662
10
AK/HashMap.h
10
AK/HashMap.h
@@ -301,16 +301,6 @@ public:
|
||||
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>
|
||||
ErrorOr<HashMap<K, V, NewKeyTraits, NewValueTraits, NewIsOrdered>> clone() const
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user