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

laurent Montel montel at kde.org
Mon Jul 13 05:42:17 BST 2015


Le Sunday 12 July 2015, 15:47:21 Milian Wolff a écrit :
> 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

Hi,
Thanks 
I will add it.

Regards
-- 
Laurent Montel | laurent.montel at kdab.com | KDE/Qt Senior Software Engineer
KDAB (France) S.A.S., a KDAB Group company
Tel. France +33 (0)4 90 84 08 53,  http://www.kdab.fr


_______________________________________________
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