From ab7c33ede096c53e4a7d61e092384715841c8831 Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Tue, 27 Apr 2021 11:47:47 -0700 Subject: [PATCH] Suppress checked iterator warnings --- include/fmt/core.h | 1 + include/fmt/format.h | 12 ++++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) 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