From 95d5efbfe60cdba06a750c9a863fa01543046c97 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sun, 28 Mar 2021 13:31:01 +0200 Subject: [PATCH] java/Ref: add nullptr comparison --- src/java/Ref.hxx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/java/Ref.hxx b/src/java/Ref.hxx index 40e415497..421b3d5f0 100644 --- a/src/java/Ref.hxx +++ b/src/java/Ref.hxx @@ -85,6 +85,14 @@ public: return value != nullptr; } + bool operator==(std::nullptr_t n) const noexcept { + return value == n; + } + + bool operator!=(std::nullptr_t n) const noexcept { + return !(*this == n); + } + T Get() const noexcept { return value; }