Corrently handle buffer flush

This commit is contained in:
Victor Zverovich
2024-11-09 09:48:26 -08:00
parent 5a3576acc8
commit a35389b3c2
2 changed files with 24 additions and 3 deletions

View File

@ -505,8 +505,8 @@ constexpr auto to_pointer(OutputIt, size_t) -> T* {
template <typename T>
FMT_CONSTEXPR20 auto to_pointer(basic_appender<T> it, size_t n) -> T* {
buffer<T>& buf = get_container(it);
buf.try_reserve(buf.size() + n);
auto size = buf.size();
buf.try_reserve(size + n);
if (buf.capacity() < size + n) return nullptr;
buf.try_resize(size + n);
return buf.data() + size;