From: Mikko Rasa Date: Sun, 18 Dec 2022 10:59:32 +0000 (+0200) Subject: Disable the templated constructor of Value if the source type is Value X-Git-Url: http://git.tdb.fi/?p=libs%2Fdatafile.git;a=commitdiff_plain;h=9d71185a55558c80c85a65e13427dd491a2f4451 Disable the templated constructor of Value if the source type is Value Microsoft's std::vector uses a T & (without const) for copying, which resolves to the templated constructor instead of the copy constructor unless the former is disabled for that signature. --- diff --git a/source/value.h b/source/value.h index bcddd6e..ba61181 100644 --- a/source/value.h +++ b/source/value.h @@ -2,6 +2,7 @@ #define MSP_DATAFILE_VALUE_H_ #include +#include #include #include #include @@ -18,7 +19,7 @@ private: public: template - Value(T &&d): + Value(T &&d, typename std::enable_if::type, Value>::value, int>::type = 0): sig(TypeInfo::signature), data(static_cast::Store>(std::forward(d))) { }