mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 17:47:44 +00:00
AK: Support using custom comparison operations for hash compatible keys
This commit is contained in:
parent
4a99170cd2
commit
9b0d90a71d
3 changed files with 8 additions and 8 deletions
|
@ -342,13 +342,12 @@ public:
|
|||
{
|
||||
return find(TraitsForT::hash(value), [&](auto& other) { return TraitsForT::equals(value, other); });
|
||||
}
|
||||
// FIXME: Use some Traits to get the comparison operation
|
||||
// FIXME: Support for predicates, while guaranteeing that the predicate call
|
||||
// does not call a non trivial constructor each time invoked
|
||||
template<Concepts::HashCompatible<T> K>
|
||||
requires(IsSame<TraitsForT, Traits<T>>) [[nodiscard]] Iterator find(K const& value)
|
||||
{
|
||||
return find(Traits<K>::hash(value), [&](auto& other) { return value == other; });
|
||||
return find(Traits<K>::hash(value), [&](auto& other) { return Traits<T>::equals(other, value); });
|
||||
}
|
||||
|
||||
template<Concepts::HashCompatible<T> K, typename TUnaryPredicate>
|
||||
|
@ -360,7 +359,7 @@ public:
|
|||
template<Concepts::HashCompatible<T> K>
|
||||
requires(IsSame<TraitsForT, Traits<T>>) [[nodiscard]] ConstIterator find(K const& value) const
|
||||
{
|
||||
return find(Traits<K>::hash(value), [&](auto& other) { return value == other; });
|
||||
return find(Traits<K>::hash(value), [&](auto& other) { return Traits<T>::equals(other, value); });
|
||||
}
|
||||
|
||||
template<Concepts::HashCompatible<T> K, typename TUnaryPredicate>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue