QVarLengthArray: simplify default ctor
Instead of calling the QVLA(qsizetype) ctor and letting the optimizer and inliner have a field day on them, simply set the trivial values for a, s, and ptr manually. Mark it as noexcept. Task-number: QTBUG-84785 Change-Id: I011826eacdaf63a4c37b21465e5fe4a6e70a1ab7 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This commit is contained in:
parent
c891382900
commit
1a61b85a2c
@ -63,7 +63,10 @@ class QVarLengthArray
|
||||
static_assert(std::is_nothrow_destructible_v<T>, "Types with throwing destructors are not supported in Qt containers.");
|
||||
|
||||
public:
|
||||
QVarLengthArray() : QVarLengthArray(0) {}
|
||||
QVarLengthArray() noexcept
|
||||
: a{Prealloc}, s{0}, ptr{reinterpret_cast<T *>(array)}
|
||||
{
|
||||
}
|
||||
|
||||
inline explicit QVarLengthArray(qsizetype size);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user