X-Git-Url: http://git.tdb.fi/?p=libs%2Fcore.git;a=blobdiff_plain;f=source%2Fcore%2Fmeta.h;h=8015f42370837e2ba6633acb0ee9b50a87ca9273;hp=0034512b6ec2bea573ffbcc34115fc8562a5cac8;hb=292aed8e23ea543b089d5f2a73000de4640befe7;hpb=c7afef88380ebebc8c2b04e48664d73281ec8848 diff --git a/source/core/meta.h b/source/core/meta.h index 0034512..8015f42 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 @@ -11,6 +13,7 @@ template struct RemoveConst { typedef T Type; }; + template struct RemoveReference { typedef T Type; }; @@ -19,6 +22,42 @@ template struct RemoveReference { typedef T Type; }; + +template +struct RemoveConstReference +{ typedef typename RemoveConst::Type>::Type Type; }; + + +template +struct EnableIf; + +template +struct EnableIf +{ typedef R Yes; }; + +template +struct EnableIf +{ typedef R No; }; + + +/** +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)) }; + }; +}; + } // namespace Msp #endif