QVarLengthArray: clear() is not resize(0)
The latter needs the value_type to be default-constructible, which shouldn't be required to clear() a container. Use std::destroy_n() instead. [ChangeLog][QtCore][QVarLengthArray] clear() no longer requires the value_type to be default-constructible. Manual conflict resolutions: - No QVLAStorage/Base/QVarLengthArray split in 6.2, yet Change-Id: I806de8f3826b50c0bd38156892c3afeb15f13ac9 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit fbfee2d7c59a7c6cd17ae7a3f63f983b9f3316f5) Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This commit is contained in:
parent
df8cf211cc
commit
c581474dfb
@ -183,7 +183,12 @@ public:
|
|||||||
}
|
}
|
||||||
inline bool isEmpty() const { return (s == 0); }
|
inline bool isEmpty() const { return (s == 0); }
|
||||||
inline void resize(qsizetype size);
|
inline void resize(qsizetype size);
|
||||||
inline void clear() { resize(0); }
|
void clear()
|
||||||
|
{
|
||||||
|
if constexpr (QTypeInfo<T>::isComplex)
|
||||||
|
std::destroy_n(data(), size());
|
||||||
|
s = 0;
|
||||||
|
}
|
||||||
inline void squeeze();
|
inline void squeeze();
|
||||||
|
|
||||||
inline qsizetype capacity() const { return a; }
|
inline qsizetype capacity() const { return a; }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user