From f0ddf2756d7ce1cc13cd6dae88b47230851c0328 Mon Sep 17 00:00:00 2001 From: Florent Lamiraux <florent@laas.fr> Date: Tue, 4 Feb 2020 10:38:39 +0100 Subject: [PATCH] Partially revert 5daf1d390dbd1249a153d015ca00c6cfb847734c: "[signal-cast-helper] Removed unused template specialization". DefaultCastRegisterer<std::string>::cast template specialization is required to set empty string to a signal. --- src/signal/signal-cast-helper.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/signal/signal-cast-helper.cpp b/src/signal/signal-cast-helper.cpp index 73c0e57..360f442 100644 --- a/src/signal/signal-cast-helper.cpp +++ b/src/signal/signal-cast-helper.cpp @@ -52,6 +52,15 @@ inline boost::any DefaultCastRegisterer<double>::cast(std::istringstream &iss) { } } +// for std::string, do not check failure. If input stream contains an +// empty string, iss.fail() returns true and an exception is thrown +template <> +inline boost::any +DefaultCastRegisterer<std::string>::cast(std::istringstream &iss) { + std::string inst(iss.str()); + return inst; +} + // for std::string, do not add std::endl at the end of the stream. template <> inline void DefaultCastRegisterer<std::string>::disp(const boost::any &object, -- GitLab