introspection: add type_char trait

This commit is contained in:
Danny Robson 2017-02-09 16:48:42 +11:00
parent c57569a4ff
commit 4e993f2d4d

View File

@ -78,6 +78,26 @@ namespace util {
{ return type_name_v<T>; }
///////////////////////////////////////////////////////////////////////////
template <typename T>
struct type_char;
template <> struct type_char<float > { static constexpr char value = 'f'; };
template <> struct type_char<double> { static constexpr char value = 'd'; };
template <> struct type_char< int8_t> { static constexpr char value = 'i'; };
template <> struct type_char< int16_t> { static constexpr char value = 'i'; };
template <> struct type_char< int32_t> { static constexpr char value = 'i'; };
template <> struct type_char< int64_t> { static constexpr char value = 'i'; };
template <> struct type_char< uint8_t> { static constexpr char value = 'u'; };
template <> struct type_char<uint16_t> { static constexpr char value = 'u'; };
template <> struct type_char<uint32_t> { static constexpr char value = 'u'; };
template <> struct type_char<uint64_t> { static constexpr char value = 'u'; };
template <typename T>
constexpr auto type_char_v = type_char<T>::value;
///////////////////////////////////////////////////////////////////////////
/// Lists valid values of an enumeration
///