mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 04:57:45 +00:00
AK: Make Vector::remove_first_matching() signal if anything was removed
This commit is contained in:
parent
8baacda03d
commit
d3d3b25e1c
1 changed files with 3 additions and 2 deletions
|
@ -339,14 +339,15 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Callback>
|
template<typename Callback>
|
||||||
void remove_first_matching(Callback callback)
|
bool remove_first_matching(Callback callback)
|
||||||
{
|
{
|
||||||
for (size_t i = 0; i < size(); ++i) {
|
for (size_t i = 0; i < size(); ++i) {
|
||||||
if (callback(at(i))) {
|
if (callback(at(i))) {
|
||||||
remove(i);
|
remove(i);
|
||||||
return;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Callback>
|
template<typename Callback>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue