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(); const auto now = std::chrono::steady_clock::now();
bool didsomething = false; bool didsomething = false;
for (auto it = directories.begin(); directories.remove_if([now, &didsomething](const ContentDirectoryDescriptor &d){
it != directories.end();) { bool expired = now > d.expires;
if (now > it->expires) { if (expired)
it = directories.erase(it); didsomething = true;
didsomething = true; return expired;
} else { });
it++;
}
}
if (didsomething) if (didsomething)
Search(); Search();