]> git.tdb.fi Git - libs/core.git/blobdiff - source/core/meta.h
Add equality comparison for Variant
[libs/core.git] / source / core / meta.h
index d6ca35935543049d8026b842ecca40785a92ecae..6998c5d1b8a712d69176a556e7c677bb745b9ec2 100644 (file)
@@ -23,6 +23,11 @@ struct RemoveReference<T &>
 { typedef T Type; };
 
 
+template<typename T>
+struct RemoveConstReference
+{ typedef typename RemoveConst<typename RemoveReference<T>::Type>::Type Type; };
+
+
 template<bool c, typename R>
 struct EnableIf;
 
@@ -53,6 +58,18 @@ struct Sfinae
        };
 };
 
+
+struct CheckEqualityComparable: Sfinae
+{
+       static int &v;
+       template<typename T>
+       static Yes f(int (*)[sizeof(reinterpret_cast<const T &>(v)==reinterpret_cast<const T &>(v))]);
+       using Sfinae::f;
+};
+
+template<typename T>
+struct IsEqualityComparable: Sfinae::Evaluate<CheckEqualityComparable, T> { };
+
 } // namespace Msp
 
 #endif