1 #include "sensor_cache.hpp" 2 findExpiredSensor(SensorCache::SensorsContainer::iterator begin)3SensorCache::SensorsContainer::iterator SensorCache::findExpiredSensor( 4 SensorCache::SensorsContainer::iterator begin) 5 { 6 return std::find_if(begin, sensors.end(), 7 [](const auto& item) { return item.second.expired(); }); 8 } 9 cleanupExpiredSensors()10void SensorCache::cleanupExpiredSensors() 11 { 12 auto begin = sensors.begin(); 13 14 for (auto it = findExpiredSensor(begin); it != sensors.end(); 15 it = findExpiredSensor(begin)) 16 { 17 begin = sensors.erase(it); 18 } 19 } 20