From 86789a48f73ed2d39cce3ff6596e71cb64e547e7 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sat, 2 Aug 2014 23:40:26 +0200 Subject: QList: add missing reserve() call in the initializer_list ctor Change-Id: Idc46a347009556d06db4bc1f7ce3e2613fb1a405 Reviewed-by: Olivier Goffart --- src/corelib/tools/qlist.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') 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 args) : d(const_cast(&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 &l) const; inline bool operator!=(const QList &l) const { return !(*this == l); } -- cgit v1.2.3