Browse Source

AK: Add a couple more helper templates to StdLibExtras

Andreas Kling 5 years ago
parent
commit
cd4bc81dbb
1 changed files with 20 additions and 0 deletions
  1. 20 0
      AK/StdLibExtras.h

+ 20 - 0
AK/StdLibExtras.h

@@ -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;