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>
This commit is contained in:
Marc Mutz 2021-11-30 16:35:06 +01:00
parent 574be167fb
commit 7db44f60b1

View File

@ -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;
@ -416,14 +416,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
@ -492,10 +484,6 @@ Q_OUTOFLINE_TEMPLATE void QVarLengthArray<T, Prealloc>::append(const T *abuf, qs
s = asize;
}
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)
{