lib/upnp/Discovery: use std::list::remove_if()

This commit is contained in:
Max Kellermann 2017-08-25 10:14:18 +02:00
parent d0734e27ba
commit be29da46f8
1 changed files with 6 additions and 9 deletions

View File

@ -246,15 +246,12 @@ UPnPDeviceDirectory::ExpireDevices()
const auto now = std::chrono::steady_clock::now();
bool didsomething = false;
for (auto it = directories.begin();
it != directories.end();) {
if (now > it->expires) {
it = directories.erase(it);
didsomething = true;
} else {
it++;
}
}
directories.remove_if([now, &didsomething](const ContentDirectoryDescriptor &d){
bool expired = now > d.expires;
if (expired)
didsomething = true;
return expired;
});
if (didsomething)
Search();