[Kde-pim] [kdepim-runtime] /: Adapt to new api

Milian Wolff mail at milianw.de
Sun Jul 12 14:47:21 BST 2015


On Sunday, July 12, 2015 01:16:48 PM David Faure wrote:
> On Saturday 11 July 2015 13:19:39 Montel Laurent wrote:
> > -        collectionsRetrieved(m_reportedCollections.values());
> > +        collectionsRetrieved(m_reportedCollections.values().toVector());
> 
> Urgh, and this API change is an improvement because... ?
> 
> Yes, QVector is great, but not when the typical implementation uses values()
> (as seems to be the case, based on what I can see in
> c9d099471fce002203620fe2fc8446a91d7b75ed)
> which returns a QList...

Yep, I urge you to add a helper function like this:

template<typename Key, typename Value, template<typename, typename> class 
Container>
QVector<Value> values(const Container<Key, Value>& container)
{
    QVector<Value> values;
    values.reserve(container.size());
    foreach (const Value& value, container) {
        values << value;
    }
    return value;
}

Or similar. Otherwise, you incur the penalty of QList /and/ add the QVector 
conversion overhead on top - no good at all.

Bye, HTH

-- 
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: 181 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-pim/attachments/20150712/64af235a/attachment.sig>
-------------- next part --------------
_______________________________________________
KDE PIM mailing list kde-pim at kde.org
https://mail.kde.org/mailman/listinfo/kde-pim
KDE PIM home page at http://pim.kde.org/


More information about the kde-pim mailing list