X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fvalue.h;h=bcddd6ed3aebb579256cd0a11061a76312a4a95c;hb=8a412367448c55916380ce7040ddbd0a75fa722e;hp=219b0e42dd5174cf8b5eabecf55df7f5b03b17d5;hpb=7df5e45c7f414f6a07681dc4ec2abb63b091a309;p=libs%2Fdatafile.git diff --git a/source/value.h b/source/value.h index 219b0e4..bcddd6e 100644 --- a/source/value.h +++ b/source/value.h @@ -2,9 +2,9 @@ #define MSP_DATAFILE_VALUE_H_ #include +#include #include #include -#include "except.h" #include "type.h" namespace Msp { @@ -18,15 +18,16 @@ private: public: template - Value(T d): + Value(T &&d): sig(TypeInfo::signature), - data(static_cast::Store>(d)) + data(static_cast::Store>(std::forward(d))) { } - Value(Symbol d): sig(TypeInfo::signature), data(d) { } + Value(const Symbol &d): sig(TypeInfo::signature), data(d) { } + Value(Symbol &&d): sig(TypeInfo::signature), data(std::move(d)) { } template - typename RemoveReference::Type get() const + typename TypeInfo::Load get() const { return get_::Store>(); } char get_signature() const { return sig; } @@ -35,14 +36,9 @@ private: T get_() const; }; -typedef std::vector ValueArray __attribute__((deprecated)); - template inline T Value::get_() const { - if(sig!=TypeInfo::signature) - throw TypeError("Type mismatch"); - return data.value::Store>(); } @@ -51,10 +47,8 @@ inline FloatType::Store Value::get_() const { if(sig==IntType::signature) return data.value(); - else if(sig!=FloatType::signature) - throw TypeError("Type mismatch"); - - return data.value(); + else + return data.value(); } } // namespace DataFile