diff --git a/src/misc/pv/anyscalar.h b/src/misc/pv/anyscalar.h index 97c6f33..98bf5ea 100644 --- a/src/misc/pv/anyscalar.h +++ b/src/misc/pv/anyscalar.h @@ -27,6 +27,13 @@ template<> struct any_storage_type { typedef uint32 type; }; template<> struct any_storage_type { typedef std::string type; }; template<> struct any_storage_type { typedef std::string type; }; +#if __cplusplus>=201103L +// std::max() isn't constexpr until c++14 :( +constexpr size_t cmax(size_t A, size_t B) { + return A>B ? A : B; +} +#endif + }// namespace detail /** A type-safe variant union capable of holding @@ -59,10 +66,13 @@ public: private: ScalarType _stype; - // always reserve enough storage for std::string (assumed worst case) + // always reserve enough storage for std::string or double (assumed worst case) #if __cplusplus>=201103L + struct wrap_t { - typename std::aligned_storage::type blob[1]; + typename std::aligned_storage::type blob[1]; } _wrap; #else struct wrap_t {