X-Git-Url: http://git.tdb.fi/?p=libs%2Fcore.git;a=blobdiff_plain;f=source%2Fcore%2Fmeta.h;h=35373013e5eb91d6faceae24592dcd298f4b1280;hp=0034512b6ec2bea573ffbcc34115fc8562a5cac8;hb=HEAD;hpb=967785734be5c3fc6f75da122c2d93ebbb338271 diff --git a/source/core/meta.h b/source/core/meta.h index 0034512..3537301 100644 --- a/source/core/meta.h +++ b/source/core/meta.h @@ -1,24 +1,79 @@ #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 DEPRECATED EnableIf; + +template +struct DEPRECATED EnableIf +{ typedef R Yes; }; + +template +struct DEPRECATED EnableIf +{ typedef R No; }; +#pragma GCC diagnostic pop + + +/** +Common fragments used in SFINAE-based decider constructs. +*/ +struct Sfinae +{ + struct Yes { char c[2]; }; + struct No { char c; }; + + template + static No f(...); + + template + struct Evaluate + { + 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