From 3a13c19650ab3f23a9fb66c589dc86ab159c2c3b Mon Sep 17 00:00:00 2001
From: Florent Lamiraux <florent@laas.fr>
Date: Fri, 18 Oct 2019 11:16:49 +0200
Subject: [PATCH] Specialize template DefaultCastRegisterer<std::string>::disp

  Default implementation adds std::endl at the end of the stream.
  In the case of string this extra '\n' is not desired.
---
 src/signal/signal-cast-helper.cpp | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/signal/signal-cast-helper.cpp b/src/signal/signal-cast-helper.cpp
index bde4ff5..9b1323f 100644
--- a/src/signal/signal-cast-helper.cpp
+++ b/src/signal/signal-cast-helper.cpp
@@ -84,6 +84,14 @@ inline boost::any DefaultCastRegisterer<std::string>::cast
   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, std::ostream &os)
+{
+  os << boost::any_cast<std::string>(object);
+}
+
 /// Registers useful casts
 namespace {
 DefaultCastRegisterer<double> double_reg;
-- 
GitLab