ExternalSensorMain: Replace iterator pairs with structured bindings
Signed-off-by: Zev Weiss <zev@bewilderbeest.net>
Change-Id: I93928a18fc8b12c842b9622fa7382847760fb2c8
diff --git a/src/ExternalSensorMain.cpp b/src/ExternalSensorMain.cpp
index f912750..413a112 100644
--- a/src/ExternalSensorMain.cpp
+++ b/src/ExternalSensorMain.cpp
@@ -61,22 +61,22 @@
const std::chrono::steady_clock::time_point& now)
{
// First pass, reap all stale sensors
- for (auto& sensor : sensors)
+ for (const auto& [name, sensor] : sensors)
{
- if (!sensor.second)
+ if (!sensor)
{
continue;
}
- if (!sensor.second->isAliveAndPerishable())
+ if (!sensor->isAliveAndPerishable())
{
continue;
}
- if (!sensor.second->isAliveAndFresh(now))
+ if (!sensor->isAliveAndFresh(now))
{
// Mark sensor as dead, no longer alive
- sensor.second->writeInvalidate();
+ sensor->writeInvalidate();
}
}
@@ -84,19 +84,19 @@
bool needCheck = false;
// Second pass, determine timer interval to next check
- for (auto& sensor : sensors)
+ for (const auto& [name, sensor] : sensors)
{
- if (!sensor.second)
+ if (!sensor)
{
continue;
}
- if (!sensor.second->isAliveAndPerishable())
+ if (!sensor->isAliveAndPerishable())
{
continue;
}
- auto expiration = sensor.second->ageRemaining(now);
+ auto expiration = sensor->ageRemaining(now);
if (needCheck)
{