diff --git a/libc/utils/CPP/TypeTraits.h b/libc/utils/CPP/TypeTraits.h --- a/libc/utils/CPP/TypeTraits.h +++ b/libc/utils/CPP/TypeTraits.h @@ -26,27 +26,12 @@ static constexpr bool Value = false; }; -template struct IsIntegral : public FalseValue {}; -template <> struct IsIntegral : public TrueValue {}; -template <> struct IsIntegral : public TrueValue {}; -template <> struct IsIntegral : public TrueValue {}; -template <> struct IsIntegral : public TrueValue {}; -template <> struct IsIntegral : public TrueValue {}; -template <> struct IsIntegral : public TrueValue {}; -template <> struct IsIntegral : public TrueValue {}; -template <> struct IsIntegral : public TrueValue {}; -template <> struct IsIntegral : public TrueValue {}; -template <> struct IsIntegral : public TrueValue {}; -template <> struct IsIntegral : public TrueValue {}; -template <> struct IsIntegral : public TrueValue {}; - -template struct IsPointerType : public FalseValue {}; -template struct IsPointerType : public TrueValue {}; +template struct TypeIdentity { typedef T Type; }; template struct IsSame : public FalseValue {}; template struct IsSame : public TrueValue {}; - -template struct TypeIdentity { typedef T Type; }; +template +static constexpr bool IsSameV = IsSame::Value; template struct RemoveCV : public TypeIdentity {}; template struct RemoveCV : public TypeIdentity {}; @@ -56,10 +41,28 @@ template using RemoveCVType = typename RemoveCV::Type; +template struct IsIntegral { + using TypeNoCV = RemoveCVType; + static constexpr bool Value = + IsSameV || IsSameV || + IsSameV || IsSameV || + IsSameV || IsSameV || + IsSameV || IsSameV || + IsSameV || IsSameV || + IsSameV || IsSameV; +}; + +template struct IsPointerTypeNoCV : public FalseValue {}; +template struct IsPointerTypeNoCV : public TrueValue {}; +template struct IsPointerType { + static constexpr bool Value = IsPointerTypeNoCV>::Value; +}; + template struct IsFloatingPointType { - static constexpr bool Value = IsSame>::Value || - IsSame>::Value || - IsSame>::Value; + using TypeNoCV = RemoveCVType; + static constexpr bool Value = IsSame::Value || + IsSame::Value || + IsSame::Value; }; } // namespace cpp