Fix const correctness issues

cppcheck correctly notes that a lot of variables in the new code can be
const.  Make most of them const.

Tested: WIP

Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I8f37b6353fd707923f533e1d61c5b5419282bf23
diff --git a/redfish-core/lib/managers.hpp b/redfish-core/lib/managers.hpp
index bda5a1a..039fced 100644
--- a/redfish-core/lib/managers.hpp
+++ b/redfish-core/lib/managers.hpp
@@ -935,19 +935,19 @@
         }
         if (inputs || outputs)
         {
-            std::array<std::optional<std::vector<std::string>>*, 2> containers =
-                {&inputs, &outputs};
+            std::array<
+                std::reference_wrapper<std::optional<std::vector<std::string>>>,
+                2>
+                containers = {inputs, outputs};
             size_t index = 0;
-            for (const auto& containerPtr : containers)
+            for (std::optional<std::vector<std::string>>& container :
+                 containers)
             {
-                std::optional<std::vector<std::string>>& container =
-                    *containerPtr;
                 if (!container)
                 {
                     index++;
                     continue;
                 }
-
                 for (std::string& value : *container)
                 {
                     boost::replace_all(value, "_", " ");
@@ -1534,7 +1534,7 @@
             }
             BMCWEB_LOG_DEBUG << *container;
 
-            std::string& type = containerPair.first;
+            const std::string& type = containerPair.first;
 
             for (nlohmann::json::iterator it = container->begin();
                  it != container->end(); ++it)
@@ -1833,7 +1833,7 @@
         }
 
         bool foundImage = false;
-        for (auto& object : subtree)
+        for (const auto& object : subtree)
         {
             const std::string& path =
                 static_cast<const std::string&>(object.first);