AK: Add a couple more helper templates to StdLibExtras

This commit is contained in:
Andreas Kling 2020-07-24 02:38:01 +02:00
parent a655cf5b41
commit cd4bc81dbb

View file

@ -98,6 +98,11 @@ struct EnableIf<true, T> {
typedef T Type;
};
template<class T>
struct AddConst {
typedef const T Type;
};
template<class T>
struct RemoveConst {
typedef T Type;
@ -416,6 +421,18 @@ struct MakeSigned<unsigned long long> {
typedef long long type;
};
template<class T>
struct IsVoid : IsSame<void, typename RemoveCV<T>::Type> {
};
template<class T>
struct IsConst : FalseType {
};
template<class T>
struct IsConst<const T> : TrueType {
};
template<typename T, typename U = T>
inline constexpr T exchange(T& slot, U&& value)
{
@ -426,12 +443,15 @@ inline constexpr T exchange(T& slot, U&& value)
}
using AK::AddConst;
using AK::ceil_div;
using AK::clamp;
using AK::Conditional;
using AK::exchange;
using AK::forward;
using AK::IsConst;
using AK::IsSame;
using AK::IsVoid;
using AK::MakeSigned;
using AK::MakeUnsigned;
using AK::max;