mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-29 12:49:05 +00:00
AK: Add operator== & operator!= to Vector
This commit is contained in:
parent
c3ecf753b2
commit
2c4af740c7
Notes:
sideshowbarker
2024-07-19 13:20:15 +09:00
Author: https://github.com/rburchell
Commit: 2c4af740c7
Pull-request: https://github.com/SerenityOS/serenity/pull/294
1 changed files with 18 additions and 0 deletions
18
AK/Vector.h
18
AK/Vector.h
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue