summaryrefslogtreecommitdiff
path: root/AK
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-03-09 21:30:07 +0100
committerAndreas Kling <kling@serenityos.org>2021-03-09 22:10:41 +0100
commit4d30166d61581f3064a19a5223fb9b5fadba70a4 (patch)
treec714f1ebf398d87e83e16cfc5fcc3f089ccc3b5a /AK
parent07564577c08aa80293fd975d2565572f78e9c63c (diff)
downloadserenity-4d30166d61581f3064a19a5223fb9b5fadba70a4.zip
AK: Add Formatter for RefPtr
Diffstat (limited to 'AK')
-rw-r--r--AK/RefPtr.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/AK/RefPtr.h b/AK/RefPtr.h
index aad97e22c2..eb5b4afff9 100644
--- a/AK/RefPtr.h
+++ b/AK/RefPtr.h
@@ -468,6 +468,14 @@ inline const LogStream& operator<<(const LogStream& stream, const RefPtr<T, PtrT
}
template<typename T>
+struct Formatter<RefPtr<T>> : Formatter<const T*> {
+ void format(FormatBuilder& builder, const RefPtr<T>& value)
+ {
+ Formatter<const T*>::format(builder, value.ptr());
+ }
+};
+
+template<typename T>
struct Traits<RefPtr<T>> : public GenericTraits<RefPtr<T>> {
using PeekType = const T*;
static unsigned hash(const RefPtr<T>& p) { return ptr_hash(p.ptr()); }