IntelCPUSensorMain: Replace iterator pairs with structured bindings

Signed-off-by: Zev Weiss <zev@bewilderbeest.net>
Change-Id: I5c1f41665c06fb6e1ed961334425659cf8738563
diff --git a/src/IntelCPUSensorMain.cpp b/src/IntelCPUSensorMain.cpp
index ea144de..287be9f 100644
--- a/src/IntelCPUSensorMain.cpp
+++ b/src/IntelCPUSensorMain.cpp
@@ -240,10 +240,9 @@
         const std::string* interfacePath = nullptr;
         const SensorBaseConfiguration* baseConfiguration = nullptr;
 
-        for (const std::pair<sdbusplus::message::object_path, SensorData>&
-                 sensor : sensorConfigs)
+        for (const auto& [path, cfgData] : sensorConfigs)
         {
-            sensorData = &(sensor.second);
+            sensorData = &cfgData;
             for (const char* type : sensorTypes)
             {
                 sensorType = configPrefix + std::string(type);
@@ -277,7 +276,7 @@
                 continue;
             }
 
-            interfacePath = &(sensor.first.str);
+            interfacePath = &path.str;
             break;
         }
         if (interfacePath == nullptr)
@@ -623,18 +622,17 @@
     // before starting ping operation
     for (const char* type : sensorTypes)
     {
-        for (const std::pair<sdbusplus::message::object_path, SensorData>&
-                 sensor : sensorConfigs)
+        for (const auto& [path, cfgData] : sensorConfigs)
         {
-            for (const SensorBaseConfiguration& config : sensor.second)
+            for (const auto& [intf, cfg] : cfgData)
             {
-                if ((configPrefix + std::string(type)) != config.first)
+                if ((configPrefix + std::string(type)) != intf)
                 {
                     continue;
                 }
 
-                auto findName = config.second.find("Name");
-                if (findName == config.second.end())
+                auto findName = cfg.find("Name");
+                if (findName == cfg.end())
                 {
                     continue;
                 }
@@ -645,12 +643,11 @@
 
                 auto present = std::optional<bool>();
                 // if we can't detect it via gpio, we set presence later
-                for (const SensorBaseConfiguration& suppConfig : sensor.second)
+                for (const auto& [suppIntf, suppCfg] : cfgData)
                 {
-                    if (suppConfig.first.find("PresenceGpio") !=
-                        std::string::npos)
+                    if (suppIntf.find("PresenceGpio") != std::string::npos)
                     {
-                        present = cpuIsPresent(suppConfig.second);
+                        present = cpuIsPresent(suppCfg);
                         break;
                     }
                 }
@@ -667,8 +664,8 @@
                     inventoryIfaces[name] = std::move(iface);
                 }
 
-                auto findBus = config.second.find("Bus");
-                if (findBus == config.second.end())
+                auto findBus = cfg.find("Bus");
+                if (findBus == cfg.end())
                 {
                     std::cerr << "Can't find 'Bus' setting in " << name << "\n";
                     continue;
@@ -676,8 +673,8 @@
                 uint64_t bus =
                     std::visit(VariantToUnsignedIntVisitor(), findBus->second);
 
-                auto findAddress = config.second.find("Address");
-                if (findAddress == config.second.end())
+                auto findAddress = cfg.find("Address");
+                if (findAddress == cfg.end())
                 {
                     std::cerr << "Can't find 'Address' setting in " << name
                               << "\n";