Move to common variant

This saves approximately 34kB in the compressed binary size of bmcweb
due to reduced template instantiations.  This amounts to a 2.5%
reduction in the overall size.

Note, there were a few places where we broke const-correctness in the
form of pulling a non-const reference out of a const variant.  This
new variant now requires const correctness, so some consts are
added where required.

Tested: Code compiles.

Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I6a60c8881c1268627eedb4ffddf16689dc5f6ed2
diff --git a/redfish-core/lib/memory.hpp b/redfish-core/lib/memory.hpp
index 90e54e8..49304e2 100644
--- a/redfish-core/lib/memory.hpp
+++ b/redfish-core/lib/memory.hpp
@@ -19,6 +19,7 @@
 
 #include <app.hpp>
 #include <boost/container/flat_map.hpp>
+#include <dbus_utility.hpp>
 #include <registries/privilege_registry.hpp>
 #include <utils/collection.hpp>
 #include <utils/hex_utils.hpp>
@@ -27,11 +28,8 @@
 namespace redfish
 {
 
-using DimmProperty =
-    std::variant<std::string, std::vector<uint32_t>, std::vector<uint16_t>,
-                 uint64_t, uint32_t, uint16_t, uint8_t, bool>;
-
-using DimmProperties = boost::container::flat_map<std::string, DimmProperty>;
+using DimmProperties =
+    boost::container::flat_map<std::string, dbus::utility::DbusVariantType>;
 
 inline std::string translateMemoryTypeToRedfish(const std::string& memoryType)
 {
@@ -142,9 +140,9 @@
     return "";
 }
 
-inline void dimmPropToHex(const std::shared_ptr<bmcweb::AsyncResp>& aResp,
-                          const char* key,
-                          const std::pair<std::string, DimmProperty>& property)
+inline void dimmPropToHex(
+    const std::shared_ptr<bmcweb::AsyncResp>& aResp, const char* key,
+    const std::pair<std::string, dbus::utility::DbusVariantType>& property)
 {
     const uint16_t* value = std::get_if<uint16_t>(&property.second);
     if (value == nullptr)
@@ -745,8 +743,7 @@
         [aResp{std::move(aResp)}](
             const boost::system::error_code ec,
             const boost::container::flat_map<
-                std::string, std::variant<std::string, uint64_t, uint32_t,
-                                          bool>>& properties) {
+                std::string, dbus::utility::DbusVariantType>& properties) {
             if (ec)
             {
                 BMCWEB_LOG_DEBUG << "DBUS response error";