[Development] Container benchmark was HEADS UP: Don't use QList, use Q_DECLARE_TYPEINFO

Mark Gaiser markg85 at gmail.com
Fri Jul 17 15:01:21 CEST 2015


On Fri, Jul 17, 2015 at 2:13 PM, André Somers <andre at familiesomers.nl>
wrote:

> Mark Gaiser schreef op 17-7-2015 om 13:44:
> >
> > You can use std::find_if for that on any container.
> > Works for C++11 and even before that. C++11 gives the benefit of using
> > a lambda in the std::find_if UnaryPredicate.
> Sure, but wouldn't that revert you back to a linear search? That sounds
> like getting the worst of both worlds: using a complicated red/black
> tree data structure and then iterating over it lineary to find an item
> that I could have found using the structure itself in logarithmic
> time... Or am I overlooking some very clever specialization in the
> find_if algorithm then?
>
> André


Yes, that would give you linear search indeed.
Guess you have to use that C++14 function then :)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20150717/9294933a/attachment.html>


More information about the Development mailing list