Переглянути джерело

AK: Add comparison operators to NonnullOwnPtr

Allan Regush 3 роки тому
батько
коміт
50c88e5e3a
1 змінених файлів з 6 додано та 0 видалено
  1. 6 0
      AK/NonnullOwnPtr.h

+ 6 - 0
AK/NonnullOwnPtr.h

@@ -135,6 +135,12 @@ public:
         return NonnullOwnPtr<U>(NonnullOwnPtr<U>::Adopt, static_cast<U&>(*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()
     {