Skip to content
Snippets Groups Projects
Commit db25cb65 authored by Florent Lamiraux's avatar Florent Lamiraux
Browse files

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
No related branches found
No related tags found
No related merge requests found
......@@ -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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment