Fixup mapbox variant references
This removes all dependencies on the mapbox specific variant api. The
code is now compatible with the drop in std::variant api.
Change-Id: Ie64be86ecae341def54f564eb282fb3b5356cc18
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/include/dbus_singleton.hpp b/include/dbus_singleton.hpp
index 2438152..9fe966f 100644
--- a/include/dbus_singleton.hpp
+++ b/include/dbus_singleton.hpp
@@ -1,20 +1,16 @@
#pragma once
#include <iostream>
#include <sdbusplus/asio/connection.hpp>
+#include <sdbusplus/message/types.hpp>
+#include <type_traits>
namespace mapbox
{
template <typename T, typename... Types>
-const T* getPtr(const mapbox::util::variant<Types...>& v)
+const T* getPtr(const sdbusplus::message::variant<Types...>& v)
{
- if (v.template is<std::remove_const_t<T>>())
- {
- return &v.template get_unchecked<std::remove_const_t<T>>();
- }
- else
- {
- return nullptr;
- }
+ namespace variant_ns = sdbusplus::message::variant_ns;
+ return variant_ns::get_if<std::remove_const_t<T>, Types...>(&v);
}
} // namespace mapbox