diff --git a/utils.hpp b/utils.hpp index c931b80..e02b4f1 100644 --- a/utils.hpp +++ b/utils.hpp @@ -10,15 +10,37 @@ namespace uart { namespace util { -template -struct always_false { - static constexpr auto value = false; -}; - -template -static constexpr auto always_false_v = always_false::value; - // clang-format off +template struct set_bool { static constexpr auto value = Val; }; + +struct true_type : set_bool {}; +struct false_type : set_bool {}; + +template struct always_false : false_type {}; + +template static constexpr auto always_false_v = always_false::value; + +template struct is_integral : false_type {}; +template <> struct is_integral : true_type {}; +template <> struct is_integral : true_type {}; +template <> struct is_integral : true_type {}; +template <> struct is_integral : true_type {}; +template <> struct is_integral : true_type {}; +template <> struct is_integral : true_type {}; +template <> struct is_integral : true_type {}; +template <> struct is_integral : true_type {}; +template <> struct is_integral : true_type {}; +template <> struct is_integral : true_type {}; +template <> struct is_integral : true_type {}; +template <> struct is_integral : true_type {}; + +template static constexpr auto is_integral_v = is_integral::value; + +template struct is_same : false_type {}; +template struct is_same : true_type {}; + +template static constexpr auto is_same_v = is_same::value; + template struct NumericLimits { static constexpr T min() { return T(); }