Ver Fonte

AK: Add comparison operators to NonnullOwnPtr

Allan Regush há 3 anos atrás
pai
commit
50c88e5e3a
1 ficheiros alterados com 6 adições e 0 exclusões
  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()
     {