AK: Add operator== & operator!= to Vector

This commit is contained in:
Robin Burchell 2019-07-11 14:05:22 +02:00 committed by Andreas Kling
parent c3ecf753b2
commit 2c4af740c7

View file

@ -147,6 +147,24 @@ public:
m_size = 0;
}
bool operator==(const Vector& other) const
{
if (m_size != other.m_size)
return false;
for (int i = 0; i < m_size; ++i) {
if (at(i) != other.at(i))
return false;
}
return true;
}
bool operator!=(const Vector& other) const
{
return !(*this == other);
}
bool contains_slow(const T& value) const
{
for (int i = 0; i < size(); ++i) {