summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@qt.io>2021-11-30 16:35:06 +0100
committerMarc Mutz <marc.mutz@qt.io>2021-12-09 18:49:33 +0100
commit7db44f60b1fde67aea9d3fd48b9e0a66c644bb22 (patch)
tree8601fb39492566b85dea7add52afbb23b188a6d7
parent574be167fbe578ce2967bb3588cdfd4d65a88a45 (diff)
QVarLengthArray: inline some trivial reallocate() wrappers
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 <marten.nordheim@qt.io>
-rw-r--r--src/corelib/tools/qvarlengtharray.h18
1 files 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 <typename AT = T>
inline qsizetype indexOf(const AT &t, qsizetype from = 0) const;
@@ -417,14 +417,6 @@ Q_INLINE_TEMPLATE QVarLengthArray<T, Prealloc>::QVarLengthArray(qsizetype asize)
}
template <class T, qsizetype Prealloc>
-Q_INLINE_TEMPLATE void QVarLengthArray<T, Prealloc>::resize(qsizetype asize)
-{ reallocate(asize, qMax(asize, capacity())); }
-
-template <class T, qsizetype Prealloc>
-Q_INLINE_TEMPLATE void QVarLengthArray<T, Prealloc>::reserve(qsizetype asize)
-{ if (asize > capacity()) reallocate(size(), asize); }
-
-template <class T, qsizetype Prealloc>
template <typename AT>
Q_INLINE_TEMPLATE qsizetype QVarLengthArray<T, Prealloc>::indexOf(const AT &t, qsizetype from) const
{
@@ -493,10 +485,6 @@ Q_OUTOFLINE_TEMPLATE void QVarLengthArray<T, Prealloc>::append(const T *abuf, qs
}
template <class T, qsizetype Prealloc>
-Q_INLINE_TEMPLATE void QVarLengthArray<T, Prealloc>::squeeze()
-{ reallocate(size(), size()); }
-
-template <class T, qsizetype Prealloc>
Q_OUTOFLINE_TEMPLATE void QVarLengthArray<T, Prealloc>::reallocate(qsizetype asize, qsizetype aalloc)
{
Q_ASSERT(aalloc >= asize);