mirror of
https://github.com/fmtlib/fmt.git
synced 2025-09-09 12:42:38 -04:00
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:
parent
5ffa586765
commit
90a59f5d59
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user