From 893b348890781dba2603ead61cf6f724350d0b47 Mon Sep 17 00:00:00 2001 From: Brad Bishop Date: Tue, 23 May 2017 18:17:25 -0400 Subject: Add printf format utility Add a template for obtaining a format string at build for a built-in C++ type. Change-Id: I8e5d26d4481b3ddafb5ffddbb058a1c75b3a2257 Signed-off-by: Brad Bishop --- src/data_types.hpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/data_types.hpp') 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 struct Downcast +{ + using Type = std::remove_cv_t>; +}; +template using DowncastType = + typename Downcast::Type; + } // namespace monitoring } // namespace dbus } // namespace phosphor -- cgit v1.2.1