From: Mikko Rasa Date: Sun, 19 Apr 2020 13:24:11 +0000 (+0300) Subject: Update a SFINAE construct X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=08ca2d33416e549bd3d071a164ed2a98765dda4b;p=libs%2Fdatafile.git Update a SFINAE construct --- diff --git a/source/type.h b/source/type.h index f40657e..fdd040d 100644 --- a/source/type.h +++ b/source/type.h @@ -2,6 +2,7 @@ #define MSP_DATAFILE_TYPE_H_ #include +#include #include namespace Msp { @@ -64,20 +65,16 @@ const char valid_signatures[] = 0 }; -template -struct HasLoadType +struct CheckLoadType: Sfinae { - struct Yes { char c[2]; }; - struct No { char c; }; - - template - static Yes f(typename U::LoadType *); - template - static No f(...); - - enum { value = (sizeof(f(0))==sizeof(Yes)) }; + template + static Yes f(typename T::LoadType *); + using Sfinae::f; }; +template +struct HasLoadType: Sfinae::Evaluate { }; + template::value> struct TypeInfo;