- for (std::vector<ActiveComm*>::iterator it = from->ActiveCommsUp.begin(); it != from->ActiveCommsUp.end(); ++it) {
- if ((*it)->action == action) {
- delete *it;
- from->ActiveCommsUp.erase(it);
- break;
- }
+ auto it = std::find_if(begin(from->ActiveCommsUp), end(from->ActiveCommsUp),
+ [action](const ActiveComm* comm) { return comm->action == action; });
+ if (it != std::end(from->ActiveCommsUp)) {
+ delete *it;
+ from->ActiveCommsUp.erase(it);