Skip to content

Commit f0ddf27

Browse files
Partially revert 5daf1d3:
"[signal-cast-helper] Removed unused template specialization". DefaultCastRegisterer<std::string>::cast template specialization is required to set empty string to a signal.
1 parent e70e3c8 commit f0ddf27

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/signal/signal-cast-helper.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,15 @@ inline boost::any DefaultCastRegisterer<double>::cast(std::istringstream &iss) {
5252
}
5353
}
5454

55+
// for std::string, do not check failure. If input stream contains an
56+
// empty string, iss.fail() returns true and an exception is thrown
57+
template <>
58+
inline boost::any
59+
DefaultCastRegisterer<std::string>::cast(std::istringstream &iss) {
60+
std::string inst(iss.str());
61+
return inst;
62+
}
63+
5564
// for std::string, do not add std::endl at the end of the stream.
5665
template <>
5766
inline void DefaultCastRegisterer<std::string>::disp(const boost::any &object,

0 commit comments

Comments
 (0)