lib/upnp/Discovery: use std::list::remove_if()
This commit is contained in:
parent
d0734e27ba
commit
be29da46f8
|
@ -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();
|
||||||
|
|
Loading…
Reference in New Issue