Skip to content

Commit 21036fd

Browse files
committed
Avoid using strlen to get return size
+ leave output buffer unset
1 parent 9bf92ac commit 21036fd

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

include/boost/int128/string.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ namespace int128 {
2020
template <typename T>
2121
auto to_string(const T& value) -> std::enable_if_t<(std::is_same<T, int128_t>::value || std::is_same<T, uint128_t>::value), std::string>
2222
{
23-
char buffer[64U] {};
23+
char buffer[64];
2424
const auto last {detail::mini_to_chars(buffer, value, 10, false)};
25-
return std::string{last};
25+
return std::string{last, buffer + sizeof(buffer)};
2626
}
2727

2828
} // namespace int128

0 commit comments

Comments
 (0)