Explorar el Código

AK: Add comparison operators to NonnullOwnPtr

Allan Regush hace 3 años
padre
commit
50c88e5e3a
Se han modificado 1 ficheros con 6 adiciones y 0 borrados
  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()
     {