1
Fork 0
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:
Andreas Kling 2020-10-06 18:38:18 +02:00
parent 8baacda03d
commit d3d3b25e1c

View file

@ -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>