File tree Expand file tree Collapse file tree 1 file changed +3
-18
lines changed Expand file tree Collapse file tree 1 file changed +3
-18
lines changed Original file line number Diff line number Diff 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-
262247std::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!" ));
You can’t perform that action at this time.
0 commit comments