mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-22 09:19:03 +00:00
AK: Add Vector::remove_all_matching()
This commit is contained in:
13
AK/Vector.h
13
AK/Vector.h
@@ -360,6 +360,18 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
template<typename Callback>
|
||||
void remove_all_matching(Callback callback)
|
||||
{
|
||||
for (int i = 0; i < size();) {
|
||||
if (callback(at(i))) {
|
||||
remove(i);
|
||||
} else {
|
||||
++i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void unchecked_append(T&& value)
|
||||
{
|
||||
ASSERT((size() + 1) <= capacity());
|
||||
@@ -535,6 +547,7 @@ public:
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
private:
|
||||
void reset_capacity()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user