summaryrefslogtreecommitdiffstats
path: root/src/format.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/format.hpp')
-rw-r--r--src/format.hpp48
1 files changed, 32 insertions, 16 deletions
diff --git a/src/format.hpp b/src/format.hpp
index f622f2e..32a85f8 100644
--- a/src/format.hpp
+++ b/src/format.hpp
@@ -12,62 +12,77 @@ namespace detail
{
/** @brief Map format strings to undecorated C++ types. */
-template <typename T> struct GetFormatType
+template <typename T>
+struct GetFormatType
{
};
-template <> struct GetFormatType<bool>
+template <>
+struct GetFormatType<bool>
{
static constexpr auto format = "%d";
};
-template <> struct GetFormatType<char>
+template <>
+struct GetFormatType<char>
{
static constexpr auto format = "=%hhd";
};
-template <> struct GetFormatType<short int>
+template <>
+struct GetFormatType<short int>
{
static constexpr auto format = "=%hd";
};
-template <> struct GetFormatType<int>
+template <>
+struct GetFormatType<int>
{
static constexpr auto format = "=%d";
};
-template <> struct GetFormatType<long int>
+template <>
+struct GetFormatType<long int>
{
static constexpr auto format = "=%ld";
};
-template <> struct GetFormatType<long long int>
+template <>
+struct GetFormatType<long long int>
{
static constexpr auto format = "=%lld";
};
-template <> struct GetFormatType<unsigned char>
+template <>
+struct GetFormatType<unsigned char>
{
static constexpr auto format = "=%hhd";
};
-template <> struct GetFormatType<unsigned short int>
+template <>
+struct GetFormatType<unsigned short int>
{
static constexpr auto format = "=%hd";
};
-template <> struct GetFormatType<unsigned int>
+template <>
+struct GetFormatType<unsigned int>
{
static constexpr auto format = "=%d";
};
-template <> struct GetFormatType<unsigned long int>
+template <>
+struct GetFormatType<unsigned long int>
{
static constexpr auto format = "=%ld";
};
-template <> struct GetFormatType<unsigned long long int>
+template <>
+struct GetFormatType<unsigned long long int>
{
static constexpr auto format = "=%lld";
};
-template <> struct GetFormatType<std::string>
+template <>
+struct GetFormatType<std::string>
{
static constexpr auto format = "=%s";
};
-template <> struct GetFormatType<char*>
+template <>
+struct GetFormatType<char*>
{
static constexpr auto format = "=%s";
};
-template <> struct GetFormatType<const char*>
+template <>
+struct GetFormatType<const char*>
{
static constexpr auto format = "=%s";
};
@@ -75,7 +90,8 @@ template <> struct GetFormatType<const char*>
} // namespace detail
/** @brief Get the format string for a C++ type. */
-template <typename T> struct GetFormat
+template <typename T>
+struct GetFormat
{
static constexpr auto format =
detail::GetFormatType<DowncastType<T>>::format;
OpenPOWER on IntegriCloud