X-Git-Url: http://git.tdb.fi/?p=libs%2Fcore.git;a=blobdiff_plain;f=source%2Fcore%2Fmeta.h;h=8015f42370837e2ba6633acb0ee9b50a87ca9273;hp=f12aede28a60029fd875377610d161d21ca63f61;hb=f635ee3173be05375cd7d5c7a8edfbfb61f70d60;hpb=3553d02ef9cf66ae5ff16dd0b129815f144857a1 diff --git a/source/core/meta.h b/source/core/meta.h index f12aede..8015f42 100644 --- a/source/core/meta.h +++ b/source/core/meta.h @@ -1,13 +1,8 @@ -/* $Id$ - -This file is part of libmspcore -Copyright © 2008 Mikko Rasa, Mikkosoft Productions -Distributed under the LGPL -*/ - #ifndef MSP_CORE_META_H_ #define MSP_CORE_META_H_ +#include + namespace Msp { template @@ -18,6 +13,51 @@ template struct RemoveConst { typedef T Type; }; + +template +struct RemoveReference +{ typedef T Type; }; + +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