1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-07 21:17:07 +09:00

AK: Define hash() and equals() for WeakPtr

This commit is contained in:
Aliaksandr Kalenik 2025-02-10 18:54:22 +01:00 committed by Andreas Kling
parent 0dd23e43e3
commit f926604cc3
Notes: github-actions[bot] 2025-02-11 09:23:30 +00:00

View file

@ -206,6 +206,14 @@ WeakPtr<T> make_weak_ptr_if_nonnull(T const* ptr)
return MUST(try_make_weak_ptr_if_nonnull(ptr));
}
template<typename T>
struct Traits<WeakPtr<T>> : public DefaultTraits<WeakPtr<T>> {
using PeekType = T*;
using ConstPeekType = T const*;
static unsigned hash(WeakPtr<T> const& p) { return ptr_hash(p.ptr()); }
static bool equals(WeakPtr<T> const& a, WeakPtr<T> const& b) { return a.ptr() == b.ptr(); }
};
}
#if USING_AK_GLOBALLY