[Development] Q_MOVABLE_TYPE of Q${Container}

Milian Wolff mail at milianw.de
Fri Aug 2 13:56:33 CEST 2013

On Friday 02 August 2013 13:47:58 Milian Wolff wrote:
> Hey!
> Are there any reasons why none of the container classes are declared as
> movable in Qt5? Would a patch adding that be accepted, or does it break the
> ABI or anything?
> Especially interesting to me is that none of the containers such as QString,
> QVector, QList, QMap, QHash, QByteArray, QSet etc. pp. is declared movable.
> But QStringList is :]

Note: My grepping skills failed me, and Peppe just showed me 

But what about QString/QByteArray? Do I also miss that somewhere?

> To my knowledge, none of the containers above are implemented in a way that
> prevents safe move operations.
> I know that these are implicitly shared, so the copying is not that slow,
> but still - saving the atomic operations on the refcounter is certainly
> worth it.
> I've added the movable declarations to many structs in KDevelop codebase,
> which also contain containers and so far did not find any bugs or issues
> with it. Only tested on x86 though. I.e. I've successfully done stuff like:
> struct Foo {
>  QContainer<Asdf> blub;
> }
> QVector<Foo> foos;
Milian Wolff
mail at milianw.de

More information about the Development mailing list