We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 54e3f1a commit 642867bCopy full SHA for 642867b
include/boost/decimal/fmt_format.hpp
@@ -268,7 +268,12 @@ struct formatter
268
269
if (use_locale)
270
{
271
- convert_pointer_pair_to_local_locale(const_cast<char*>(s.data()), s.data() + s.size());
+ // We need approximately 1/3 more space in order to insert the thousands separators,
272
+ // but after we have done our processing we need to shrink the string back down
273
+ const auto initial_length {s.length()};
274
+ s.resize(s.length() * 4 / 3 + 1);
275
+ const auto offset {static_cast<std::size_t>(convert_pointer_pair_to_local_locale(const_cast<char*>(s.data()), s.data() + s.length()))};
276
+ s.resize(initial_length + offset);
277
}
278
279
return fmt::format_to(ctx.out(), "{}", s);
0 commit comments