QVLA: always use new to create new objects
Even for non-complex types, it makes no sense to use the assignment operator instead of placement new when constructing new objects. Change-Id: I5f15fe4b3397cf52d1d35e6c4dcc513b94b3cf14 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> (cherry picked from commit e6e67f31c10da900ec6ecb06c2e827b17283be6a) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
362b020ec9
commit
54ed4e6b6a
@ -220,18 +220,10 @@ public:
|
||||
T copy(t);
|
||||
reallocate(s, s << 1);
|
||||
const qsizetype idx = s++;
|
||||
if (QTypeInfo<T>::isComplex) {
|
||||
new (ptr + idx) T(std::move(copy));
|
||||
} else {
|
||||
ptr[idx] = std::move(copy);
|
||||
}
|
||||
new (ptr + idx) T(std::move(copy));
|
||||
} else {
|
||||
const qsizetype idx = s++;
|
||||
if (QTypeInfo<T>::isComplex) {
|
||||
new (ptr + idx) T(t);
|
||||
} else {
|
||||
ptr[idx] = t;
|
||||
}
|
||||
new (ptr + idx) T(t);
|
||||
}
|
||||
}
|
||||
|
||||
@ -240,10 +232,7 @@ public:
|
||||
if (s == a)
|
||||
reallocate(s, s << 1);
|
||||
const qsizetype idx = s++;
|
||||
if (QTypeInfo<T>::isComplex)
|
||||
new (ptr + idx) T(std::move(t));
|
||||
else
|
||||
ptr[idx] = std::move(t);
|
||||
new (ptr + idx) T(std::move(t));
|
||||
}
|
||||
|
||||
void append(const T *buf, qsizetype size);
|
||||
|
Loading…
x
Reference in New Issue
Block a user