X-Git-Url: http://git.tdb.fi/?p=libs%2Fcore.git;a=blobdiff_plain;f=source%2Fcore%2Fmeta.h;h=35373013e5eb91d6faceae24592dcd298f4b1280;hp=923096517dba8132a873de68a79344ab6e2910b1;hb=HEAD;hpb=ff0d3252cad08280b9c320b3fea5a11c80406c23 diff --git a/source/core/meta.h b/source/core/meta.h index 9230965..3537301 100644 --- a/source/core/meta.h +++ b/source/core/meta.h @@ -1,36 +1,47 @@ #ifndef MSP_CORE_META_H_ #define MSP_CORE_META_H_ +#include +#include "attributes.h" + namespace Msp { +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" template -struct RemoveConst +struct DEPRECATED RemoveConst { typedef T Type; }; template -struct RemoveConst +struct DEPRECATED RemoveConst { typedef T Type; }; template -struct RemoveReference +struct DEPRECATED RemoveReference { typedef T Type; }; template -struct RemoveReference +struct DEPRECATED RemoveReference { typedef T Type; }; +template +struct DEPRECATED RemoveConstReference +{ typedef typename RemoveConst::Type>::Type Type; }; + + template -struct EnableIf; +struct DEPRECATED EnableIf; template -struct EnableIf +struct DEPRECATED EnableIf { typedef R Yes; }; template -struct EnableIf +struct DEPRECATED EnableIf { typedef R No; }; +#pragma GCC diagnostic pop /** @@ -41,13 +52,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