X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fcore%2Fmeta.h;h=6998c5d1b8a712d69176a556e7c677bb745b9ec2;hb=20c897ece781e18ba54c41fd68e232ce566a938d;hp=923096517dba8132a873de68a79344ab6e2910b1;hpb=ff0d3252cad08280b9c320b3fea5a11c80406c23;p=libs%2Fcore.git diff --git a/source/core/meta.h b/source/core/meta.h index 9230965..6998c5d 100644 --- a/source/core/meta.h +++ b/source/core/meta.h @@ -1,6 +1,8 @@ #ifndef MSP_CORE_META_H_ #define MSP_CORE_META_H_ +#include + namespace Msp { template @@ -21,6 +23,11 @@ struct RemoveReference { typedef T Type; }; +template +struct RemoveConstReference +{ typedef typename RemoveConst::Type>::Type Type; }; + + template struct EnableIf; @@ -41,13 +48,28 @@ struct Sfinae struct Yes { char c[2]; }; struct No { char c; }; - template + template + static No f(...); + + template struct Evaluate { - enum { value = (s==sizeof(Yes)) }; + enum { value = (sizeof(C::template f(0))==sizeof(Yes)) }; }; }; + +struct CheckEqualityComparable: Sfinae +{ + static int &v; + template + static Yes f(int (*)[sizeof(reinterpret_cast(v)==reinterpret_cast(v))]); + using Sfinae::f; +}; + +template +struct IsEqualityComparable: Sfinae::Evaluate { }; + } // namespace Msp #endif