blob: 3b9c83da96da190f2b3009e66f543253bde6310e [file] [log] [blame]
#include "sensor_cache.hpp"
SensorCache::SensorsContainer::iterator SensorCache::findExpiredSensor(
SensorCache::SensorsContainer::iterator begin)
{
return std::find_if(begin, sensors.end(),
[](const auto& item) { return item.second.expired(); });
}
void SensorCache::cleanupExpiredSensors()
{
auto begin = sensors.begin();
for (auto it = findExpiredSensor(begin); it != sensors.end();
it = findExpiredSensor(begin))
{
begin = sensors.erase(it);
}
}