Use std::memmove
... and add include for it. Amends ffb73175e6c5b35e6367c88479cc0bf160482016 Change-Id: I709a5aed13f6f62017b9e4116a03a4dfaae4bb13 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
This commit is contained in:
parent
e932a898a5
commit
b3146d2bb8
@ -49,6 +49,7 @@
|
|||||||
#include <QtCore/qglobal.h>
|
#include <QtCore/qglobal.h>
|
||||||
#include <QtCore/qtypeinfo.h>
|
#include <QtCore/qtypeinfo.h>
|
||||||
|
|
||||||
|
#include <cstring>
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
@ -62,9 +63,9 @@ void q_uninitialized_relocate_n(T* first, N n, T* out)
|
|||||||
{
|
{
|
||||||
if constexpr (QTypeInfoQuery<T>::isRelocatable) {
|
if constexpr (QTypeInfoQuery<T>::isRelocatable) {
|
||||||
if (n != N(0)) { // even if N == 0, out == nullptr or first == nullptr are UB for memmove()
|
if (n != N(0)) { // even if N == 0, out == nullptr or first == nullptr are UB for memmove()
|
||||||
memmove(static_cast<void*>(out),
|
std::memmove(static_cast<void*>(out),
|
||||||
static_cast<const void*>(first),
|
static_cast<const void*>(first),
|
||||||
n * sizeof(T));
|
n * sizeof(T));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
std::uninitialized_move_n(first, n, out);
|
std::uninitialized_move_n(first, n, out);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user