Why do moest DUContext functions return a QVector and most DUChain use QList?
Milian Wolff
mail at milianw.de
Sun Oct 25 22:00:46 UTC 2009
Hi there, especially David once again :)
Could you elaborate why most of the DUContext methods return a QVector of
pointers, and not a QList? To quote the documentation:
> For most purposes, QList is the right class to use. Operations like
> prepend() and insert() are usually faster than with QVector because of the
> way QList stores its items in memory (see Algorithmic Complexity for
> details), and its index-based API is more convenient than QLinkedList's
> iterator-based API. It also expands to less code in your executable.
And (emphasise added)
> If you want the items to occupy adjacent memory positions, or if your items
> are **larger than a pointer** and you want to avoid the overhead of
> allocating them on the heap individually at insertion time, then use
> QVector.
There are lots of methods that return lists of pointers in a QVector. If I
read the docs, I'd say those should be QLists? Of course things like
importedParentContexts should stay the same.
--
Milian Wolff
mail at milianw.de
http://milianw.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20091025/763809fc/attachment.sig>
More information about the KDevelop-devel
mailing list