Skip to content

Commit e8870b2

Browse files
authored
Merge pull request #1339 from pps83/develop-tostr-len
Reuse `r.ptr` instead of using strlen to get return size
2 parents 17cfe8b + 999ce9f commit e8870b2

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

include/boost/decimal/string.hpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,7 @@ auto to_string(const DecimalType value)
8181
{
8282
char buffer[64];
8383
auto r = to_chars(buffer, buffer + sizeof(buffer), value);
84-
*r.ptr = '\0';
85-
return std::string(buffer);
84+
return std::string(buffer, r.ptr - buffer);
8685
}
8786

8887
} //namespace decimal

0 commit comments

Comments
 (0)