1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 06:17:35 +00:00

AK: Add ConstPeekType to Traits

Also, the PeekType of smart pointers is now T* instead of const T*.

Note: This commit doesn't compile, it breaks HashMap::get() for some
types. Fixed in the next commit.
This commit is contained in:
Itamar 2021-05-08 12:11:37 +03:00 committed by Andreas Kling
parent 77d462426b
commit b816bd0806
4 changed files with 7 additions and 3 deletions

View file

@ -451,7 +451,8 @@ struct Formatter<RefPtr<T>> : Formatter<const T*> {
template<typename T>
struct Traits<RefPtr<T>> : public GenericTraits<RefPtr<T>> {
using PeekType = const T*;
using PeekType = T*;
using ConstPeekType = const T*;
static unsigned hash(const RefPtr<T>& p) { return ptr_hash(p.ptr()); }
static bool equals(const RefPtr<T>& a, const RefPtr<T>& b) { return a.ptr() == b.ptr(); }
};