From 2dbece54f56118e0084b7ba77822376b26c3f589 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sun, 14 Apr 2019 02:15:43 +0200 Subject: [PATCH] AK: Add WeakPtr::operator T*() for ergonomy. --- AK/WeakPtr.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/AK/WeakPtr.h b/AK/WeakPtr.h index 775c2dfee1..f5413ca6d6 100644 --- a/AK/WeakPtr.h +++ b/AK/WeakPtr.h @@ -35,6 +35,9 @@ public: T& operator*() { return *ptr(); } const T& operator*() const { return *ptr(); } + operator const T*() const { return ptr(); } + operator T*() { return ptr(); } + bool is_null() const { return !m_link || !m_link->ptr(); } void clear() { m_link = nullptr; }