forked from fmtlib/fmt
Replace uninitialized_copy with memmove (#242)
because the memory areas may overlap.
This commit is contained in:
2
format.h
2
format.h
@@ -2773,7 +2773,7 @@ void BasicWriter<Char>::write_double(
|
|||||||
spec.width() > static_cast<unsigned>(n)) {
|
spec.width() > static_cast<unsigned>(n)) {
|
||||||
width = spec.width();
|
width = spec.width();
|
||||||
CharPtr p = grow_buffer(width);
|
CharPtr p = grow_buffer(width);
|
||||||
std::uninitialized_copy(p, p + n, p + (width - n) / 2);
|
std::memmove(p + (width - n) / 2, p, n * sizeof(Char));
|
||||||
fill_padding(p, spec.width(), n, fill);
|
fill_padding(p, spec.width(), n, fill);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user