AK: Make IsUnsigned<T> behave as you would expect

This commit is contained in:
Andreas Kling 2021-02-10 22:23:24 +01:00
parent 8743ea3149
commit 497d48a8de
2 changed files with 11 additions and 1 deletions

View file

@ -533,7 +533,7 @@ template<typename... _Ignored>
constexpr auto DependentFalse = false;
template<typename T>
using IsUnsigned = IsSame<T, MakeUnsigned<T>>;
using IsUnsigned = IsSame<T, typename MakeUnsigned<T>::Type>;
template<typename T>
using IsArithmetic = IntegralConstant<bool, IsIntegral<T>::value || IsFloatingPoint<T>::value>;
@ -620,6 +620,7 @@ using AK::IsFundamental;
using AK::IsNullPointer;
using AK::IsSame;
using AK::IsUnion;
using AK::IsUnsigned;
using AK::IsVoid;
using AK::MakeIndexSequence;
using AK::MakeIntegerSequence;

View file

@ -80,6 +80,15 @@ TEST_CASE(FundamentalTypeClassification)
EXPECT_TRAIT_TRUE(IsFundamental, unsigned short, unsigned int, unsigned long, unsigned long long);
EXPECT_TRAIT_FALSE(IsFundamental, Empty, int*, int&);
EXPECT_TRAIT_TRUE(IsUnsigned, unsigned);
EXPECT_TRAIT_TRUE(IsUnsigned, unsigned short);
EXPECT_TRAIT_TRUE(IsUnsigned, unsigned char);
EXPECT_TRAIT_TRUE(IsUnsigned, unsigned long);
EXPECT_TRAIT_FALSE(IsUnsigned, int);
EXPECT_TRAIT_FALSE(IsUnsigned, short);
EXPECT_TRAIT_FALSE(IsUnsigned, char);
EXPECT_TRAIT_FALSE(IsUnsigned, long);
}
TEST_CASE(AddConst)