From 0265b923aca1695a5275a5d0d7081de3b826f13f Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Fri, 26 Nov 2021 14:52:56 +0100 Subject: [PATCH] QVarLengthArray: simplify copy ctor implementation std::tie(a, s, ptr) = {Prealloc, 0, (T*)array} is exactly the effects of the default ctor, so just delegate to it, before calling copyAppend(). Also clean up the copy ctor declaration (superfluous inline keyword, and template arguments). Change-Id: Iefc758a47996382fee10b1e081e44f008b146287 Reviewed-by: Thiago Macieira --- src/corelib/tools/qvarlengtharray.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/corelib/tools/qvarlengtharray.h b/src/corelib/tools/qvarlengtharray.h index 4bff61b9b68..3668ebcfc99 100644 --- a/src/corelib/tools/qvarlengtharray.h +++ b/src/corelib/tools/qvarlengtharray.h @@ -67,8 +67,8 @@ public: inline explicit QVarLengthArray(qsizetype size); - inline QVarLengthArray(const QVarLengthArray &other) - : a(Prealloc), s(0), ptr(reinterpret_cast(array)) + QVarLengthArray(const QVarLengthArray &other) + : QVarLengthArray{} { append(other.constData(), other.size()); }