summaryrefslogtreecommitdiffstats
path: root/src/data_types.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/data_types.hpp')
-rw-r--r--src/data_types.hpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/data_types.hpp b/src/data_types.hpp
index af0ef68..439045e 100644
--- a/src/data_types.hpp
+++ b/src/data_types.hpp
@@ -80,6 +80,21 @@ using PropertyIndex = TupleRefMap <
const std::string,
const std::string >;
// *INDENT-ON*
+
+/** @brief Convert some C++ types to others.
+ *
+ * Remove type decorators to reduce template specializations.
+ *
+ * 1. Remove references.
+ * 2. Remove 'const' and 'volatile'.
+ */
+template <typename T> struct Downcast
+{
+ using Type = std::remove_cv_t<std::remove_reference_t<T>>;
+};
+template <typename T> using DowncastType =
+ typename Downcast<T>::Type;
+
} // namespace monitoring
} // namespace dbus
} // namespace phosphor
OpenPOWER on IntegriCloud