From 08ca2d33416e549bd3d071a164ed2a98765dda4b Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Sun, 19 Apr 2020 16:24:11 +0300 Subject: [PATCH] Update a SFINAE construct --- source/type.h | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) 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; -- 2.43.0