diff options
Diffstat (limited to 'src/corelib/tools/qvarlengtharray.h')
-rw-r--r-- | src/corelib/tools/qvarlengtharray.h | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/corelib/tools/qvarlengtharray.h b/src/corelib/tools/qvarlengtharray.h index 5e57de5767..3a2028057d 100644 --- a/src/corelib/tools/qvarlengtharray.h +++ b/src/corelib/tools/qvarlengtharray.h @@ -50,8 +50,6 @@ #include <string.h> #include <stdlib.h> -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE @@ -103,6 +101,7 @@ public: inline bool isEmpty() const { return (s == 0); } inline void resize(int size); inline void clear() { resize(0); } + inline void squeeze(); inline int capacity() const { return a; } inline void reserve(int size); @@ -244,6 +243,10 @@ Q_OUTOFLINE_TEMPLATE void QVarLengthArray<T, Prealloc>::append(const T *abuf, in } template <class T, int Prealloc> +Q_INLINE_TEMPLATE void QVarLengthArray<T, Prealloc>::squeeze() +{ realloc(s, s); } + +template <class T, int Prealloc> Q_OUTOFLINE_TEMPLATE void QVarLengthArray<T, Prealloc>::realloc(int asize, int aalloc) { Q_ASSERT(aalloc >= asize); @@ -415,6 +418,4 @@ bool operator!=(const QVarLengthArray<T, Prealloc1> &l, const QVarLengthArray<T, QT_END_NAMESPACE -QT_END_HEADER - #endif // QVARLENGTHARRAY_H |