AK: Add comparison operators to NonnullOwnPtr

This commit is contained in:
Allan Regush 2022-06-17 18:40:18 -06:00 committed by Linus Groh
parent 709f0a2ab3
commit 50c88e5e3a
Notes: sideshowbarker 2024-07-17 10:06:12 +09:00

View file

@ -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()
{