Skip to content

Commit 5a995a0

Browse files
committed
[RF] Use std::to_string in RooFitHS3 JSONParser
This change is motivated by fixing the Windows build.
1 parent 62a3a07 commit 5a995a0

File tree

1 file changed

+3
-18
lines changed

1 file changed

+3
-18
lines changed

roofit/hs3/src/JSONParser.cxx

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -244,29 +244,14 @@ std::string TJSONTree::Node::key() const
244244
return node->key();
245245
}
246246

247-
namespace {
248-
std::string itoa(int i)
249-
{
250-
std::stringstream ss;
251-
ss << i;
252-
return ss.str();
253-
}
254-
std::string ftoa(float f)
255-
{
256-
std::stringstream ss;
257-
ss << f;
258-
return ss.str();
259-
}
260-
} // namespace
261-
262247
std::string TJSONTree::Node::val() const
263248
{
264249
switch (node->get().type()) {
265250
case nlohmann::json::value_t::string: return node->get().get<std::string>();
266251
case nlohmann::json::value_t::boolean: return node->get().get<bool>() ? "true" : "false";
267-
case nlohmann::json::value_t::number_integer: return ::itoa(node->get().get<int>());
268-
case nlohmann::json::value_t::number_unsigned: return ::itoa(node->get().get<unsigned int>());
269-
case nlohmann::json::value_t::number_float: return ::ftoa(node->get().get<float>());
252+
case nlohmann::json::value_t::number_integer: return std::to_string(node->get().get<int>());
253+
case nlohmann::json::value_t::number_unsigned: return std::to_string(node->get().get<unsigned int>());
254+
case nlohmann::json::value_t::number_float: return std::to_string(node->get().get<float>());
270255
default:
271256
throw std::runtime_error(std::string("node " + node->key() + ": implicit string conversion for type " +
272257
node->get().type_name() + " not supported!"));

0 commit comments

Comments
 (0)