KalleOlaviNiemitalo commented on code in PR #3277:
URL: https://github.com/apache/avro/pull/3277#discussion_r1899970482
##########
lang/c++/impl/json/JsonIO.hh:
##########
@@ -405,19 +404,17 @@ public:
template<typename T>
void encodeNumber(T t) {
sep();
- std::ostringstream oss;
- oss << boost::lexical_cast<std::string>(t);
- const std::string s = oss.str();
+ const std::string s = std::to_string(t);
out_.writeBytes(reinterpret_cast<const uint8_t *>(s.data()), s.size());
sep2();
}
void encodeNumber(double t) {
sep();
std::ostringstream oss;
- if (boost::math::isfinite(t)) {
- oss << boost::lexical_cast<std::string>(t);
- } else if (boost::math::isnan(t)) {
+ if (std::isfinite(t)) {
+ oss << t;
Review Comment:
Does std::locale::global affect the double-to-string formatting here; for
example, can it output "12,34" with a comma, which would be invalid in JSON?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]