From 50c88e5e3a6918f99cfcfb802d111cb22a87645c Mon Sep 17 00:00:00 2001 From: Allan Regush Date: Fri, 17 Jun 2022 18:40:18 -0600 Subject: [PATCH] AK: Add comparison operators to NonnullOwnPtr --- AK/NonnullOwnPtr.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/AK/NonnullOwnPtr.h b/AK/NonnullOwnPtr.h index b10ac3ddc7..178cdccaa6 100644 --- a/AK/NonnullOwnPtr.h +++ b/AK/NonnullOwnPtr.h @@ -135,6 +135,12 @@ public: return NonnullOwnPtr(NonnullOwnPtr::Adopt, static_cast(*leak_ptr())); } + bool operator==(NonnullOwnPtr const& other) const { return m_ptr == other.m_ptr; } + bool operator!=(NonnullOwnPtr const& other) const { return m_ptr != other.m_ptr; } + + bool operator==(NonnullOwnPtr& other) { return m_ptr == other.m_ptr; } + bool operator!=(NonnullOwnPtr& other) { return m_ptr != other.m_ptr; } + private: void clear() {