Property: silently return empty string when serialization is not supported

This commit is contained in:
Robert Haschke 2018-05-17 17:12:06 +02:00
parent 2106c51c9d
commit e3ca832497
2 changed files with 2 additions and 2 deletions

View File

@ -91,7 +91,7 @@ class Property {
template <typename T>
static typename std::enable_if<!hasSerialize<T>::value, std::string>::type serialize(const boost::any& value) {
throw std::runtime_error (std::string("no operator<< for type ") + typeid(T).name());
return "";
}
public:

View File

@ -86,7 +86,7 @@ TEST(Property, serialize) {
// std::map doesn't provide operator<< serialization
props.declare<std::map<int, int>>("map", std::map<int, int>());
EXPECT_THROW(props.property("map").serialize(), std::runtime_error);
EXPECT_EQ(props.property("map").serialize(), "");
}
class InitFromTest : public ::testing::Test {