From 6807a2afcf431c5c609b0606c483ea17d0e83944 Mon Sep 17 00:00:00 2001 From: Stefan Boberg Date: Mon, 24 May 2021 13:16:06 +0200 Subject: Added RefPtr::IsNull() --- zencore/include/zencore/refcount.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/zencore/include/zencore/refcount.h b/zencore/include/zencore/refcount.h index de7d315f4..e6cdbc540 100644 --- a/zencore/include/zencore/refcount.h +++ b/zencore/include/zencore/refcount.h @@ -58,9 +58,10 @@ public: inline RefPtr(T* Ptr) : m_Ref(Ptr) { m_Ref && m_Ref->AddRef(); } inline ~RefPtr() { m_Ref && m_Ref->Release(); } - inline explicit operator bool() const { return m_Ref != nullptr; } - inline operator T*() const { return m_Ref; } - inline T* operator->() const { return m_Ref; } + [[nodiscard]] inline bool IsNull() const { return m_Ref == nullptr; } + inline explicit operator bool() const { return m_Ref != nullptr; } + inline operator T*() const { return m_Ref; } + inline T* operator->() const { return m_Ref; } inline std::strong_ordering operator<=>(const RefPtr& Rhs) const = default; -- cgit v1.2.3