]> git.tdb.fi Git - libs/datafile.git/blobdiff - source/value.h
Disable the templated constructor of Value if the source type is Value
[libs/datafile.git] / source / value.h
index bcddd6ed3aebb579256cd0a11061a76312a4a95c..ba6118181260c1c92c2a53f8f885507914a4d759 100644 (file)
@@ -2,6 +2,7 @@
 #define MSP_DATAFILE_VALUE_H_
 
 #include <vector>
+#include <type_traits>
 #include <msp/core/attributes.h>
 #include <msp/core/meta.h>
 #include <msp/core/variant.h>
@@ -18,7 +19,7 @@ private:
 
 public:
        template<typename T>
-       Value(T &&d):
+       Value(T &&d, typename std::enable_if<!std::is_same<typename std::remove_reference<T>::type, Value>::value, int>::type = 0):
                sig(TypeInfo<T>::signature),
                data(static_cast<typename TypeInfo<T>::Store>(std::forward<T>(d)))
        { }