[Interest] move methods in QList

André Somers andre at familiesomers.nl
Tue Oct 10 09:11:34 CEST 2017


std::list cannot be compared to QList, and likely neither data structure
is what you are looking for. QList should, IMO, not be used for new code
if it can be avoided, and is certainly not suitable for using with
anying Big. With big as in: bigger than size of a pointer. And
linked-lists like std::list should not be anyones choice of data
structure unless they have very specific requirements that make such
structures outperform other data structures.

André


Op 10/10/2017 om 08:45 schreef Hamish Moffatt:
> 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