summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@qt.io>2021-11-26 14:52:56 +0100
committerMarc Mutz <marc.mutz@qt.io>2021-11-30 06:38:40 +0100
commit0265b923aca1695a5275a5d0d7081de3b826f13f (patch)
tree781e5aee206e9d876d3890c1deaa27aeac97d720
parent6855b80eae71d8339b2b5d6d45b71f2306293584 (diff)
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 <thiago.macieira@intel.com>
-rw-r--r--src/corelib/tools/qvarlengtharray.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/corelib/tools/qvarlengtharray.h b/src/corelib/tools/qvarlengtharray.h
index 4bff61b9b6..3668ebcfc9 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<T, Prealloc> &other)
- : a(Prealloc), s(0), ptr(reinterpret_cast<T *>(array))
+ QVarLengthArray(const QVarLengthArray &other)
+ : QVarLengthArray{}
{
append(other.constData(), other.size());
}