Browse Source

AK: Add comparison operators to NonnullRefPtr

Allan Regush 3 năm trước cách đây
mục cha
commit
ce7d868d6b
1 tập tin đã thay đổi với 6 bổ sung0 xóa
  1. 6 0
      AK/NonnullRefPtr.h

+ 6 - 0
AK/NonnullRefPtr.h

@@ -218,6 +218,12 @@ public:
         AK::swap(m_ptr, other.m_ptr);
         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
     // clang-format off
 private:
 private:
     NonnullRefPtr() = delete;
     NonnullRefPtr() = delete;