Skip to content

Commit 3a13c19

Browse files
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.
1 parent 85fcf12 commit 3a13c19

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/signal/signal-cast-helper.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,14 @@ inline boost::any DefaultCastRegisterer<std::string>::cast
8484
return inst;
8585
}
8686

87+
// for std::string, do not add std::endl at the end of the stream.
88+
template <>
89+
inline void DefaultCastRegisterer<std::string>::disp
90+
(const boost::any &object, std::ostream &os)
91+
{
92+
os << boost::any_cast<std::string>(object);
93+
}
94+
8795
/// Registers useful casts
8896
namespace {
8997
DefaultCastRegisterer<double> double_reg;

0 commit comments

Comments
 (0)