diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-04-14 02:15:43 +0200 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-04-14 02:15:43 +0200 |
commit | 2dbece54f56118e0084b7ba77822376b26c3f589 (patch) | |
tree | ff43aa227c6c334ecade08e0c5d290faace3fedf | |
parent | 91e1f3ffb1f6d967a0b1ca3af09d75d5c1ac0212 (diff) | |
download | serenity-2dbece54f56118e0084b7ba77822376b26c3f589.zip |
AK: Add WeakPtr::operator T*() for ergonomy.
-rw-r--r-- | AK/WeakPtr.h | 3 |
1 files changed, 3 insertions, 0 deletions
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; } |