X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Ftype.h;h=0e371e632a9bb4b66aee10520e5aab300726675e;hb=refs%2Fheads%2Fmaster;hp=f40657eb14a07003a295cb979ae4813523183d17;hpb=3b78eeb8b92dc3524d6a0456b4daf0a0f3dbf813;p=libs%2Fdatafile.git diff --git a/source/type.h b/source/type.h index f40657e..0e371e6 100644 --- a/source/type.h +++ b/source/type.h @@ -1,7 +1,8 @@ #ifndef MSP_DATAFILE_TYPE_H_ #define MSP_DATAFILE_TYPE_H_ -#include +#include +#include #include namespace Msp { @@ -11,7 +12,7 @@ struct Symbol { std::string name; - Symbol() { } + Symbol() = default; template Symbol(const T &n): name(lexical_cast(n)) { } @@ -22,7 +23,7 @@ struct Symbol struct IntType { static const char signature = 'i'; - typedef Int64 Store; + typedef std::int64_t Store; typedef Store Load; }; @@ -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; @@ -99,19 +96,11 @@ struct TypeInfo: IntType { }; template<> struct TypeInfo: IntType { }; -#if defined(_MSC_VER) -template<> -struct TypeInfo<__int64, false>: IntType { }; - -template<> -struct TypeInfo: IntType { }; -#elif defined(__GNUC__) template<> struct TypeInfo: IntType { }; template<> struct TypeInfo: IntType { }; -#endif template<> struct TypeInfo: FloatType { };