[Development] Q_MOVABLE_TYPE of Q${Container}
Milian Wolff
mail at milianw.de
Fri Aug 2 13:47:58 CEST 2013
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 :]
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;
}
Q_DECLARE_TYPEINFO(Foo, Q_MOVABLE_TYPE);
QVector<Foo> foos;
--
Milian Wolff
mail at milianw.de
http://milianw.de
More information about the Development
mailing list