From 7db44f60b1fde67aea9d3fd48b9e0a66c644bb22 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Tue, 30 Nov 2021 16:35:06 +0100 Subject: [PATCH] QVarLengthArray: inline some trivial reallocate() wrappers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit These functions don't deserve to be defined outside the class body, as they're trivial wrappers around reallocate(). Cleans up the header somewhat, in preparation of the upcoming QVLABase/QVLAStorage split. Change-Id: Ib4062eca4214a67e67f472a7c1e4bf4d9813c8a4 Reviewed-by: MÃ¥rten Nordheim --- src/corelib/tools/qvarlengtharray.h | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/src/corelib/tools/qvarlengtharray.h b/src/corelib/tools/qvarlengtharray.h index 72f9e4104c..ab02846ce1 100644 --- a/src/corelib/tools/qvarlengtharray.h +++ b/src/corelib/tools/qvarlengtharray.h @@ -194,12 +194,12 @@ public: return *(end() - 1); } inline bool isEmpty() const { return size() == 0; } - inline void resize(qsizetype size); + void resize(qsizetype sz) { reallocate(sz, qMax(sz, capacity())); } inline void clear() { resize(0); } - inline void squeeze(); + void squeeze() { reallocate(size(), size()); } inline qsizetype capacity() const { return a; } - inline void reserve(qsizetype size); + void reserve(qsizetype sz) { if (sz > capacity()) reallocate(size(), sz); } template inline qsizetype indexOf(const AT &t, qsizetype from = 0) const; @@ -416,14 +416,6 @@ Q_INLINE_TEMPLATE QVarLengthArray::QVarLengthArray(qsizetype asize) } } -template -Q_INLINE_TEMPLATE void QVarLengthArray::resize(qsizetype asize) -{ reallocate(asize, qMax(asize, capacity())); } - -template -Q_INLINE_TEMPLATE void QVarLengthArray::reserve(qsizetype asize) -{ if (asize > capacity()) reallocate(size(), asize); } - template template Q_INLINE_TEMPLATE qsizetype QVarLengthArray::indexOf(const AT &t, qsizetype from) const @@ -492,10 +484,6 @@ Q_OUTOFLINE_TEMPLATE void QVarLengthArray::append(const T *abuf, qs s = asize; } -template -Q_INLINE_TEMPLATE void QVarLengthArray::squeeze() -{ reallocate(size(), size()); } - template Q_OUTOFLINE_TEMPLATE void QVarLengthArray::reallocate(qsizetype asize, qsizetype aalloc) {