From 235622dc7f7eeeced07b30333abebb7678c9c53b Mon Sep 17 00:00:00 2001 From: asynts Date: Thu, 15 Oct 2020 15:24:01 +0200 Subject: [PATCH] AK: Add formatters for NonnullOwnPtr and WeakPtr. --- AK/NonnullOwnPtr.h | 8 ++++++++ AK/WeakPtr.h | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/AK/NonnullOwnPtr.h b/AK/NonnullOwnPtr.h index 795a08b5683..30addf86b27 100644 --- a/AK/NonnullOwnPtr.h +++ b/AK/NonnullOwnPtr.h @@ -193,6 +193,14 @@ inline void swap(NonnullOwnPtr& a, NonnullOwnPtr& b) a.swap(b); } +template +struct Formatter> : Formatter { + void format(TypeErasedFormatParams& params, FormatBuilder& builder, const NonnullOwnPtr& value) + { + Formatter::format(params, builder, value.ptr()); + } +}; + } using AK::adopt_own; diff --git a/AK/WeakPtr.h b/AK/WeakPtr.h index e5f50e77887..393d76576fe 100644 --- a/AK/WeakPtr.h +++ b/AK/WeakPtr.h @@ -102,6 +102,14 @@ inline const LogStream& operator<<(const LogStream& stream, const WeakPtr& va return stream << value.ptr(); } +template +struct Formatter> : Formatter { + void format(TypeErasedFormatParams& params, FormatBuilder& builder, const WeakPtr& value) + { + Formatter::format(params, builder, value.ptr()); + } +}; + } using AK::WeakPtr;