From e9718374ac6d6c27de4dc90e630e2064d786ed3c Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Wed, 27 Oct 2021 03:41:40 +0300 Subject: [PATCH] Hardcode all integral and floating point types --- include/boost/core/type_name.hpp | 140 ++++++++++++++++++++++++++++++- 1 file changed, 139 insertions(+), 1 deletion(-) diff --git a/include/boost/core/type_name.hpp b/include/boost/core/type_name.hpp index 526d5d9..853ca33 100644 --- a/include/boost/core/type_name.hpp +++ b/include/boost/core/type_name.hpp @@ -209,6 +209,62 @@ template struct tn_holder // integrals +template<> struct tn_holder +{ + static std::string type_name( std::string const& suffix ) + { + return "bool" + suffix; + } +}; + +template<> struct tn_holder +{ + static std::string type_name( std::string const& suffix ) + { + return "char" + suffix; + } +}; + +template<> struct tn_holder +{ + static std::string type_name( std::string const& suffix ) + { + return "signed char" + suffix; + } +}; + +template<> struct tn_holder +{ + static std::string type_name( std::string const& suffix ) + { + return "unsigned char" + suffix; + } +}; + +template<> struct tn_holder +{ + static std::string type_name( std::string const& suffix ) + { + return "short" + suffix; + } +}; + +template<> struct tn_holder +{ + static std::string type_name( std::string const& suffix ) + { + return "unsigned short" + suffix; + } +}; + +template<> struct tn_holder +{ + static std::string type_name( std::string const& suffix ) + { + return "int" + suffix; + } +}; + template<> struct tn_holder { static std::string type_name( std::string const& suffix ) @@ -217,7 +273,21 @@ template<> struct tn_holder } }; -#if defined(_MSC_VER) +template<> struct tn_holder +{ + static std::string type_name( std::string const& suffix ) + { + return "long" + suffix; + } +}; + +template<> struct tn_holder +{ + static std::string type_name( std::string const& suffix ) + { + return "unsigned long" + suffix; + } +}; template<> struct tn_holder { @@ -235,6 +305,36 @@ template<> struct tn_holder } }; +template<> struct tn_holder +{ + static std::string type_name( std::string const& suffix ) + { + return "wchar_t" + suffix; + } +}; + +#if !defined(BOOST_NO_CXX11_CHAR16_T) + +template<> struct tn_holder +{ + static std::string type_name( std::string const& suffix ) + { + return "char16_t" + suffix; + } +}; + +#endif + +#if !defined(BOOST_NO_CXX11_CHAR32_T) + +template<> struct tn_holder +{ + static std::string type_name( std::string const& suffix ) + { + return "char32_t" + suffix; + } +}; + #endif #if defined(__cpp_char8_t) && __cpp_char8_t >= 201811L @@ -249,6 +349,44 @@ template<> struct tn_holder #endif +#if defined(__cpp_lib_byte) && __cpp_lib_byte >= 201603L + +template<> struct tn_holder +{ + static std::string type_name( std::string const& suffix ) + { + return "std::byte" + suffix; + } +}; + +#endif + +// floating point + +template<> struct tn_holder +{ + static std::string type_name( std::string const& suffix ) + { + return "float" + suffix; + } +}; + +template<> struct tn_holder +{ + static std::string type_name( std::string const& suffix ) + { + return "double" + suffix; + } +}; + +template<> struct tn_holder +{ + static std::string type_name( std::string const& suffix ) + { + return "long double" + suffix; + } +}; + // cv template struct tn_holder