mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 00:07:36 +00:00
HashTable: Rename finders with a more accurate and self-descripting name
This commit is contained in:
parent
de7831153f
commit
213e2af281
1 changed files with 9 additions and 9 deletions
|
@ -281,10 +281,10 @@ public:
|
||||||
return HashSetResult::InsertedNewEntry;
|
return HashSetResult::InsertedNewEntry;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Finder>
|
template<typename TUnaryPredicate>
|
||||||
Iterator find(unsigned hash, Finder finder)
|
Iterator find(unsigned hash, TUnaryPredicate predicate)
|
||||||
{
|
{
|
||||||
return Iterator(lookup_with_hash(hash, move(finder)));
|
return Iterator(lookup_with_hash(hash, move(predicate)));
|
||||||
}
|
}
|
||||||
|
|
||||||
Iterator find(const T& value)
|
Iterator find(const T& value)
|
||||||
|
@ -292,10 +292,10 @@ public:
|
||||||
return find(TraitsForT::hash(value), [&](auto& other) { return TraitsForT::equals(value, other); });
|
return find(TraitsForT::hash(value), [&](auto& other) { return TraitsForT::equals(value, other); });
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Finder>
|
template<typename TUnaryPredicate>
|
||||||
ConstIterator find(unsigned hash, Finder finder) const
|
ConstIterator find(unsigned hash, TUnaryPredicate predicate) const
|
||||||
{
|
{
|
||||||
return ConstIterator(lookup_with_hash(hash, move(finder)));
|
return ConstIterator(lookup_with_hash(hash, move(predicate)));
|
||||||
}
|
}
|
||||||
|
|
||||||
ConstIterator find(const T& value) const
|
ConstIterator find(const T& value) const
|
||||||
|
@ -405,8 +405,8 @@ private:
|
||||||
kfree_sized(old_buckets, size_in_bytes(old_capacity));
|
kfree_sized(old_buckets, size_in_bytes(old_capacity));
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Finder>
|
template<typename TUnaryPredicate>
|
||||||
BucketType* lookup_with_hash(unsigned hash, Finder finder) const
|
BucketType* lookup_with_hash(unsigned hash, TUnaryPredicate predicate) const
|
||||||
{
|
{
|
||||||
if (is_empty())
|
if (is_empty())
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
@ -414,7 +414,7 @@ private:
|
||||||
for (;;) {
|
for (;;) {
|
||||||
auto& bucket = m_buckets[hash % m_capacity];
|
auto& bucket = m_buckets[hash % m_capacity];
|
||||||
|
|
||||||
if (bucket.used && finder(*bucket.slot()))
|
if (bucket.used && predicate(*bucket.slot()))
|
||||||
return &bucket;
|
return &bucket;
|
||||||
|
|
||||||
if (!bucket.used && !bucket.deleted)
|
if (!bucket.used && !bucket.deleted)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue