diff options
Diffstat (limited to 'src/corelib/tools/qvector.cpp')
-rw-r--r-- | src/corelib/tools/qvector.cpp | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/corelib/tools/qvector.cpp b/src/corelib/tools/qvector.cpp index b3247b8af5..ef1c9c17b0 100644 --- a/src/corelib/tools/qvector.cpp +++ b/src/corelib/tools/qvector.cpp @@ -502,8 +502,19 @@ /*! \fn void QVector::clear() - Removes all the elements from the vector and releases the memory used by - the vector. + Removes all the elements from the vector. + + \note Until Qt 5.6, this also released the memory used by + the vector. From Qt 5.7, the capacity is preserved. To shed + all capacity, swap with a default-constructed vector: + \code + QVector<T> v ...; + QVector<T>().swap(v); + Q_ASSERT(v.capacity() == 0); + \endcode + or call squeeze(). + + \sa squeeze() */ /*! \fn const T &QVector::at(int i) const |