mirror of
https://github.com/SerenityOS/serenity
synced 2024-10-07 00:19:27 +00:00
AK: Add a couple more helper templates to StdLibExtras
This commit is contained in:
parent
a655cf5b41
commit
cd4bc81dbb
|
@ -98,6 +98,11 @@ struct EnableIf<true, T> {
|
||||||
typedef T Type;
|
typedef T Type;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
struct AddConst {
|
||||||
|
typedef const T Type;
|
||||||
|
};
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
struct RemoveConst {
|
struct RemoveConst {
|
||||||
typedef T Type;
|
typedef T Type;
|
||||||
|
@ -416,6 +421,18 @@ struct MakeSigned<unsigned long long> {
|
||||||
typedef long long type;
|
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>
|
template<typename T, typename U = T>
|
||||||
inline constexpr T exchange(T& slot, U&& value)
|
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::ceil_div;
|
||||||
using AK::clamp;
|
using AK::clamp;
|
||||||
using AK::Conditional;
|
using AK::Conditional;
|
||||||
using AK::exchange;
|
using AK::exchange;
|
||||||
using AK::forward;
|
using AK::forward;
|
||||||
|
using AK::IsConst;
|
||||||
using AK::IsSame;
|
using AK::IsSame;
|
||||||
|
using AK::IsVoid;
|
||||||
using AK::MakeSigned;
|
using AK::MakeSigned;
|
||||||
using AK::MakeUnsigned;
|
using AK::MakeUnsigned;
|
||||||
using AK::max;
|
using AK::max;
|
||||||
|
|
Loading…
Reference in a new issue