[Interest] move methods in QList

Michael Corcoran michael.corcoran at outlook.com
Tue Oct 10 09:04:47 CEST 2017


QList is basically an array of pointers. I'd suggest a read of https://marcmutz.wordpress.com/effective-qt/containers/. That's the best explanation of Qt containers (+ compared to STL) you're likely to find anywhere.

Regards,
Mike
________________________________________
From: Interest <interest-bounces+michael.corcoran=outlook.com at qt-project.org> on behalf of Hamish Moffatt <hamish at risingsoftware.com>
Sent: Tuesday, 10 October 2017 7:45 p.m.
To: interest at qt-project.org
Subject: [Interest] move methods in QList

I'm interested in storing a big structure in QList, and I would like to
move it to the list, but unlike std::list QList does not seem to have
push_back(T&&), insert(..., T&&) etc.

Should I use std::list instead? Or use a QList of pointers (eg
QSharedPointer) to my structure? Or construct a default item and move my
new one over it, as in

Big itemToAppend;
QList<Big> list;
list.append(Big());
list.last() = std::move(itemToAppend);

Are there any plans to add the move methods to QList etc?


Hamish

_______________________________________________
Interest mailing list
Interest at qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest



More information about the Interest mailing list