Suppress checked iterator warnings

This commit is contained in:
Victor Zverovich
2021-04-27 11:47:47 -07:00
parent 77258f6069
commit ab7c33ede0
2 changed files with 9 additions and 4 deletions

View File

@ -896,6 +896,7 @@ class buffer_appender : public std::back_insert_iterator<buffer<T>> {
public: public:
using std::back_insert_iterator<buffer<T>>::back_insert_iterator; using std::back_insert_iterator<buffer<T>>::back_insert_iterator;
buffer_appender(base it) : base(it) {} buffer_appender(base it) : base(it) {}
using _Unchecked_type = buffer_appender; // Mark iterator as checked.
buffer_appender& operator++() { buffer_appender& operator++() {
base::operator++(); base::operator++();

View File

@ -498,7 +498,9 @@ FMT_CONSTEXPR20 OutChar* copy_str(InputIt begin, InputIt end, OutChar* out) {
if (is_constant_evaluated()) { if (is_constant_evaluated()) {
return copy_str<OutChar, InputIt, OutChar*>(begin, end, out); return copy_str<OutChar, InputIt, OutChar*>(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 <typename OutChar, typename InputIt, typename OutputIt, template <typename OutChar, typename InputIt, typename OutputIt,
@ -1791,10 +1793,12 @@ inline Char* write_significand(Char* out, UInt significand,
if (!decimal_point) if (!decimal_point)
return format_decimal(out, significand, significand_size).end; return format_decimal(out, significand, significand_size).end;
auto end = format_decimal(out + 1, significand, significand_size).end; auto end = format_decimal(out + 1, significand, significand_size).end;
if (integral_size == 1) if (integral_size == 1) {
out[0] = out[1]; out[0] = out[1];
else } else {
std::uninitialized_copy_n(out + 1, integral_size, out); std::uninitialized_copy_n(out + 1, integral_size,
make_checked(out, to_unsigned(integral_size)));
}
out[integral_size] = decimal_point; out[integral_size] = decimal_point;
return end; return end;
} }