diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2014-08-02 23:40:26 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2014-08-03 01:26:14 +0200 |
commit | 86789a48f73ed2d39cce3ff6596e71cb64e547e7 (patch) | |
tree | c67e782ab6ed3180e302c5f107c88bea6cb16075 /src/corelib | |
parent | 3ce554bef0f2f06768a1b64750f7ba60111d807c (diff) |
QList: add missing reserve() call in the initializer_list ctor
Change-Id: Idc46a347009556d06db4bc1f7ce3e2613fb1a405
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Diffstat (limited to 'src/corelib')
-rw-r--r-- | src/corelib/tools/qlist.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/corelib/tools/qlist.h b/src/corelib/tools/qlist.h index 4c52c22300..8cfd1a8f8b 100644 --- a/src/corelib/tools/qlist.h +++ b/src/corelib/tools/qlist.h @@ -130,7 +130,7 @@ public: #ifdef Q_COMPILER_INITIALIZER_LISTS inline QList(std::initializer_list<T> args) : d(const_cast<QListData::Data *>(&QListData::shared_null)) - { std::copy(args.begin(), args.end(), std::back_inserter(*this)); } + { reserve(args.size()); std::copy(args.begin(), args.end(), std::back_inserter(*this)); } #endif bool operator==(const QList<T> &l) const; inline bool operator!=(const QList<T> &l) const { return !(*this == l); } |