Fixed conversion of floating point values to string from PlaceholderParser

after boost::to_string() was removed from boost 1.66.
This commit is contained in:
bubnikv 2019-01-18 09:50:56 +01:00
parent b6f2f00ea4
commit 13f0da3ace

View file

@ -270,9 +270,22 @@ namespace client
{
std::string out;
switch (type) {
case TYPE_BOOL: out = std::to_string(data.b); break;
case TYPE_BOOL: out = data.b ? "true" : "false"; break;
case TYPE_INT: out = std::to_string(data.i); break;
case TYPE_DOUBLE: out = std::to_string(data.d); break;
case TYPE_DOUBLE:
#if 0
// The default converter produces trailing zeros after the decimal point.
out = std::to_string(data.d);
#else
// ostringstream default converter produces no trailing zeros after the decimal point.
// It seems to be doing what the old boost::to_string() did.
{
std::ostringstream ss;
ss << data.d;
out = ss.str();
}
#endif
break;
case TYPE_STRING: out = *data.s; break;
default: break;
}