QList: add missing reserve() call in the initializer_list ctor

Change-Id: Idc46a347009556d06db4bc1f7ce3e2613fb1a405
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
bb10
Marc Mutz 2014-08-02 23:40:26 +02:00
parent 3ce554bef0
commit 86789a48f7
1 changed files with 1 additions and 1 deletions

View File

@ -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); }