types/description: add a bool specialisation

This commit is contained in:
Danny Robson 2019-05-14 13:01:23 +10:00
parent b5fdedfe5e
commit a56610e205
2 changed files with 4 additions and 0 deletions

View File

@ -20,6 +20,7 @@ cruft::types::operator<< (std::ostream &os, cruft::types::category val)
case category::UNSIGNED: return os << "UNSIGNED";
case category::SIGNED: return os << "SIGNED";
case category::REAL: return os << "REAL";
case category::BOOL: return os << "BOOL";
}
unreachable ();

View File

@ -54,6 +54,7 @@ namespace cruft::types {
UNSIGNED,
SIGNED,
REAL,
BOOL,
};
@ -106,6 +107,8 @@ namespace cruft::types {
template <> struct category_traits<f32> : public std::integral_constant<category,category::REAL> {};
template <> struct category_traits<f64> : public std::integral_constant<category,category::REAL> {};
template <> struct category_traits<bool> : public std::integral_constant<category,category::BOOL> {};
template <typename T>
constexpr auto category_traits_v = category_traits<T>::value;