thiru-mg commented on code in PR #3277:
URL: https://github.com/apache/avro/pull/3277#discussion_r1900313226
##########
lang/c++/impl/json/JsonIO.hh:
##########
@@ -404,9 +404,25 @@ public:
template<typename T>
void encodeNumber(T t) {
Review Comment:
Instead of having a template function `encodeNumber` and its
specializations, it'll be cleaner to have (a) a template function
`numberToString` and its specialization to convert the given number into a
string and then (b) have a single function `encodeNumber` that puts the string
into `out_`.
##########
lang/c++/impl/json/JsonIO.hh:
##########
@@ -404,9 +404,25 @@ public:
template<typename T>
void encodeNumber(T t) {
+ sep();
+ const std::string s = std::to_string(t);
+ out_.writeBytes(reinterpret_cast<const uint8_t *>(s.data()), s.size());
+ sep2();
+ }
+
+ void encodeNumber(float t) {
Review Comment:
Since this is a specialization, it'll better to be explicit about it. Please
add: `template <>` before this line.
--
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]