diff options
author | Thiago Macieira <thiago.macieira@nokia.com> | 2010-02-20 08:04:29 (GMT) |
---|---|---|
committer | Thiago Macieira <thiago.macieira@nokia.com> | 2010-02-20 08:04:29 (GMT) |
commit | 30b45ba2b11342a9e7cc06b68237b68a68955213 (patch) | |
tree | 1018c188375b3217b31abe9b7a0883ee1184a447 /src/corelib/tools/qvector.h | |
parent | ce27cf24539e0c7971937e55d8539496ad51ee52 (diff) | |
parent | 8f10ca802dee1ed110f301191c4a56a85575033c (diff) | |
download | Qt-30b45ba2b11342a9e7cc06b68237b68a68955213.zip Qt-30b45ba2b11342a9e7cc06b68237b68a68955213.tar.gz Qt-30b45ba2b11342a9e7cc06b68237b68a68955213.tar.bz2 |
Merge remote branch 'origin/master' into qt-master-from-4.6
Conflicts:
configure.exe
src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
src/opengl/qgl.cpp
Diffstat (limited to 'src/corelib/tools/qvector.h')
-rw-r--r-- | src/corelib/tools/qvector.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/corelib/tools/qvector.h b/src/corelib/tools/qvector.h index 60c17a2..c2e2485 100644 --- a/src/corelib/tools/qvector.h +++ b/src/corelib/tools/qvector.h @@ -728,9 +728,10 @@ Q_OUTOFLINE_TEMPLATE QVector<T> QVector<T>::mid(int pos, int length) const length = size() - pos; if (pos == 0 && length == size()) return *this; - QVector<T> copy; if (pos + length > size()) length = size() - pos; + QVector<T> copy; + copy.reserve(length); for (int i = pos; i < pos + length; ++i) copy += at(i); return copy; @@ -740,6 +741,7 @@ template <typename T> Q_OUTOFLINE_TEMPLATE QList<T> QVector<T>::toList() const { QList<T> result; + result.reserve(size()); for (int i = 0; i < size(); ++i) result.append(at(i)); return result; |