Since memset operates on (unsigned char), we should multiply the count in our call to memset with the sizeof T to clear the whole memory block.

This commit is contained in:
Tomek-Stolarczyk 2025-06-18 11:39:29 -04:00
parent 5ffa586765
commit 90a59f5d59

View File

@ -553,7 +553,7 @@ FMT_CONSTEXPR auto fill_n(OutputIt out, Size count, const T& value)
template <typename T, typename Size> template <typename T, typename Size>
FMT_CONSTEXPR20 auto fill_n(T* out, Size count, char value) -> T* { FMT_CONSTEXPR20 auto fill_n(T* out, Size count, char value) -> T* {
if (is_constant_evaluated()) return fill_n<T*, Size, T>(out, count, value); if (is_constant_evaluated()) return fill_n<T*, Size, T>(out, count, value);
std::memset(out, value, to_unsigned(count)); std::memset(out, value, to_unsigned(count) * sizeof(T));
return out + count; return out + count;
} }