From fb0c2d1de3d1ef7396d19c18ac09e12bd956929e Mon Sep 17 00:00:00 2001 From: nyx Date: Fri, 24 Jan 2025 08:31:48 -0500 Subject: [PATCH] memory/weak: add missing nullptr comparison operators (#41) --- include/hyprutils/memory/WeakPtr.hpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/include/hyprutils/memory/WeakPtr.hpp b/include/hyprutils/memory/WeakPtr.hpp index d4a1b8e..023bf78 100644 --- a/include/hyprutils/memory/WeakPtr.hpp +++ b/include/hyprutils/memory/WeakPtr.hpp @@ -153,6 +153,14 @@ namespace Hyprutils { return impl_ == rhs.impl_; } + bool operator==(std::nullptr_t) const { + return !valid(); + } + + bool operator!=(std::nullptr_t) const { + return valid(); + } + bool operator()(const CWeakPointer& lhs, const CWeakPointer& rhs) const { return reinterpret_cast(lhs.impl_) < reinterpret_cast(rhs.impl_); }