Browse Source

AK: Add comparison operators to NonnullRefPtr

Allan Regush 3 years ago
parent
commit
ce7d868d6b
1 changed files with 6 additions and 0 deletions
  1. 6 0
      AK/NonnullRefPtr.h

+ 6 - 0
AK/NonnullRefPtr.h

@@ -218,6 +218,12 @@ public:
         AK::swap(m_ptr, other.m_ptr);
     }
 
+    bool operator==(NonnullRefPtr const& other) const { return m_ptr == other.m_ptr; }
+    bool operator!=(NonnullRefPtr const& other) const { return m_ptr != other.m_ptr; }
+
+    bool operator==(NonnullRefPtr& other) { return m_ptr == other.m_ptr; }
+    bool operator!=(NonnullRefPtr& other) { return m_ptr != other.m_ptr; }
+
     // clang-format off
 private:
     NonnullRefPtr() = delete;