]> git.tdb.fi Git - libs/core.git/blobdiff - source/core/meta.h
Filter the types that get fallback lexical conversion operators
[libs/core.git] / source / core / meta.h
index 0034512b6ec2bea573ffbcc34115fc8562a5cac8..923096517dba8132a873de68a79344ab6e2910b1 100644 (file)
@@ -11,6 +11,7 @@ template<typename T>
 struct RemoveConst<const T>
 { typedef T Type; };
 
+
 template<typename T>
 struct RemoveReference
 { typedef T Type; };
@@ -19,6 +20,34 @@ template<typename T>
 struct RemoveReference<T &>
 { typedef T Type; };
 
+
+template<bool c, typename R>
+struct EnableIf;
+
+template<typename R>
+struct EnableIf<true, R>
+{ typedef R Yes; };
+
+template<typename R>
+struct EnableIf<false, R>
+{ typedef R No; };
+
+
+/**
+Common fragments used in SFINAE-based decider constructs.
+*/
+struct Sfinae
+{
+       struct Yes { char c[2]; };
+       struct No { char c; };
+
+       template<size_t s>
+       struct Evaluate
+       {
+               enum { value = (s==sizeof(Yes)) };
+       };
+};
+
 } // namespace Msp
 
 #endif