diff options
author | Oswald Buddenhagen <oswald.buddenhagen@nokia.com> | 2010-02-23 19:44:10 (GMT) |
---|---|---|
committer | Oswald Buddenhagen <oswald.buddenhagen@nokia.com> | 2010-02-25 13:51:12 (GMT) |
commit | 63c002162bda57d0ec5faf108df63fd67ce7e089 (patch) | |
tree | dc36d9e18c2c106b326acf9338f1d6e0a9233c52 /src/corelib/tools/qmap.h | |
parent | f7d3ec31c417445c8bc35b722c1376cf20360642 (diff) | |
download | Qt-63c002162bda57d0ec5faf108df63fd67ce7e089.zip Qt-63c002162bda57d0ec5faf108df63fd67ce7e089.tar.gz Qt-63c002162bda57d0ec5faf108df63fd67ce7e089.tar.bz2 |
use QList::reserve() as appropriate
Diffstat (limited to 'src/corelib/tools/qmap.h')
-rw-r--r-- | src/corelib/tools/qmap.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/corelib/tools/qmap.h b/src/corelib/tools/qmap.h index 2e21547..df0ae46 100644 --- a/src/corelib/tools/qmap.h +++ b/src/corelib/tools/qmap.h @@ -773,6 +773,7 @@ template <class Key, class T> Q_OUTOFLINE_TEMPLATE QList<Key> QMap<Key, T>::uniqueKeys() const { QList<Key> res; + res.reserve(size()); // May be too much, but assume short lifetime const_iterator i = begin(); if (i != end()) { for (;;) { @@ -792,6 +793,7 @@ template <class Key, class T> Q_OUTOFLINE_TEMPLATE QList<Key> QMap<Key, T>::keys() const { QList<Key> res; + res.reserve(size()); const_iterator i = begin(); while (i != end()) { res.append(i.key()); @@ -836,6 +838,7 @@ template <class Key, class T> Q_OUTOFLINE_TEMPLATE QList<T> QMap<Key, T>::values() const { QList<T> res; + res.reserve(size()); const_iterator i = begin(); while (i != end()) { res.append(i.value()); |