diff --git a/include/fmt/core.h b/include/fmt/core.h index f22d1f26..a7f9e4b2 100644 --- a/include/fmt/core.h +++ b/include/fmt/core.h @@ -896,6 +896,7 @@ class buffer_appender : public std::back_insert_iterator> { public: using std::back_insert_iterator>::back_insert_iterator; buffer_appender(base it) : base(it) {} + using _Unchecked_type = buffer_appender; // Mark iterator as checked. buffer_appender& operator++() { base::operator++(); diff --git a/include/fmt/format.h b/include/fmt/format.h index 24210fc6..4bc4229c 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -498,7 +498,9 @@ FMT_CONSTEXPR20 OutChar* copy_str(InputIt begin, InputIt end, OutChar* out) { if (is_constant_evaluated()) { return copy_str(begin, end, out); } - return std::uninitialized_copy(begin, end, out); + auto size = to_unsigned(end - begin); + std::uninitialized_copy(begin, end, make_checked(out, size)); + return out + size; } template