mirror of
https://github.com/moveit/moveit_task_constructor.git
synced 2025-11-04 14:49:57 +08:00
Property: silently return empty string when serialization is not supported
This commit is contained in:
parent
2106c51c9d
commit
e3ca832497
@ -91,7 +91,7 @@ class Property {
|
|||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
static typename std::enable_if<!hasSerialize<T>::value, std::string>::type serialize(const boost::any& value) {
|
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:
|
public:
|
||||||
|
|||||||
@ -86,7 +86,7 @@ TEST(Property, serialize) {
|
|||||||
|
|
||||||
// std::map doesn't provide operator<< serialization
|
// std::map doesn't provide operator<< serialization
|
||||||
props.declare<std::map<int, int>>("map", std::map<int, int>());
|
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 {
|
class InitFromTest : public ::testing::Test {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user