mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-08 05:27:14 +09:00
AK: Define hash() and equals() for WeakPtr
This commit is contained in:
parent
0dd23e43e3
commit
f926604cc3
Notes:
github-actions[bot]
2025-02-11 09:23:30 +00:00
Author: https://github.com/kalenikaliaksandr
Commit: f926604cc3
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3532
1 changed files with 8 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue