Utils: Destructure interface properties in templateCharReplace()

Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Change-Id: Ie9d2c51f0d7a23126a49cba29e15ddc7afe12910
diff --git a/src/Utils.cpp b/src/Utils.cpp
index 68cd9db..b23754f 100644
--- a/src/Utils.cpp
+++ b/src/Utils.cpp
@@ -237,9 +237,9 @@
         boost::replace_all(*strPtr, *replaceStr, std::to_string(index));
     }
 
-    for (auto& propertyPair : interface)
+    for (auto& [propName, propValue] : interface)
     {
-        std::string templateName = templateChar + propertyPair.first;
+        std::string templateName = templateChar + propName;
         boost::iterator_range<std::string::const_iterator> find =
             boost::ifind_first(*strPtr, templateName);
         if (!find)
@@ -255,18 +255,15 @@
         // check for additional operations
         if (!start && find.end() == strPtr->end())
         {
-            std::visit([&](auto&& val) { keyPair.value() = val; },
-                       propertyPair.second);
+            std::visit([&](auto&& val) { keyPair.value() = val; }, propValue);
             return ret;
         }
         if (nextItemIdx > strPtr->size() ||
             std::find(mathChars.begin(), mathChars.end(),
                       strPtr->at(nextItemIdx)) == mathChars.end())
         {
-            std::string val =
-                std::visit(VariantToStringVisitor(), propertyPair.second);
-            boost::ireplace_all(*strPtr, templateChar + propertyPair.first,
-                                val);
+            std::string val = std::visit(VariantToStringVisitor(), propValue);
+            boost::ireplace_all(*strPtr, templateChar + propName, val);
             continue;
         }
 
@@ -295,7 +292,7 @@
         // we assume that the replacement is a number, because we can
         // only do math on numbers.. we might concatenate strings in the
         // future, but thats later
-        int number = std::visit(VariantToIntVisitor(), propertyPair.second);
+        int number = std::visit(VariantToIntVisitor(), propValue);
 
         bool isOperator = true;
         TemplateOperation next = TemplateOperation::addition;