[Interest] move methods in QList
Andrew Ialacci
andrew at dkai.dk
Tue Oct 10 09:07:44 CEST 2017
I personally favor QVector and use it instead of QList.
There are times though when you must use a QList because some class or function requires it. For example many of the Qt JSON classes deal with QLists instead of QVectors.
Take a read over this thread from SO:
https://stackoverflow.com/questions/33609406/qlist-vs-qvector-revisited
Depending on your use case, also check out QVarLengthArray.
On 10/10/17, 8:46 AM, "Interest on behalf of Hamish Moffatt" <interest-bounces+andrew=dkai.dk at qt-project.org on behalf of hamish at risingsoftware.com> wrote:
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