Commit db25cb65 authored by Florent Lamiraux's avatar Florent Lamiraux Committed by Florent Lamiraux florent@laas.fr

Specialize template DefaultCastRegisterer<std::string>::cast

  When type is string and input istringstream contains an empty string,
  operator>> make method fail return true.
  This commit overcome this issue by not testing the result.
parent 9308145b
......@@ -73,6 +73,17 @@ void DefaultCastRegisterer<dynamicgraph::Matrix>::trace(
}
}
// 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 >> inst;
return inst;
}
/// Registers useful casts
namespace {
DefaultCastRegisterer<double> double_reg;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment