1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-14 09:34:59 +00:00

AK: Add tests for type traits and IndexSequence

Use TypeLists to add test for IsIntegral, IsFloatingPoint, IsVoid,
IsNullPointer, IsArithmetic, IsFundamental, and AddConst type traits.

More can "easily" be added once the TypeList and macro magic is squinted
at for long enough :).
This commit is contained in:
Andrew Kaster 2020-12-29 22:44:59 -07:00 committed by Andreas Kling
parent 3bf77f01a7
commit b4eb734204
4 changed files with 198 additions and 0 deletions

View file

@ -372,6 +372,22 @@ template<>
struct MakeUnsigned<char> {
using Type = unsigned char;
};
template<>
struct MakeUnsigned<char8_t> {
using Type = char8_t;
};
template<>
struct MakeUnsigned<char16_t> {
using Type = char16_t;
};
template<>
struct MakeUnsigned<char32_t> {
using Type = char32_t;
};
template<>
struct MakeUnsigned<bool> {
using Type = bool;
};
template<typename T>
struct MakeSigned {
@ -469,9 +485,21 @@ template<typename T>
struct __IsIntegral : FalseType {
};
template<>
struct __IsIntegral<bool> : TrueType {
};
template<>
struct __IsIntegral<unsigned char> : TrueType {
};
template<>
struct __IsIntegral<char8_t> : TrueType {
};
template<>
struct __IsIntegral<char16_t> : TrueType {
};
template<>
struct __IsIntegral<char32_t> : TrueType {
};
template<>
struct __IsIntegral<unsigned short> : TrueType {
};
template<>
@ -495,6 +523,9 @@ struct __IsFloatingPoint<float> : TrueType {
template<>
struct __IsFloatingPoint<double> : TrueType {
};
template<>
struct __IsFloatingPoint<long double> : TrueType {
};
template<typename T>
using IsFloatingPoint = __IsFloatingPoint<typename RemoveCV<T>::Type>;