[Qt5-feedback] Lambdas

Konstantin Ritt ritt.ks at gmail.com
Wed Jun 29 23:40:30 CEST 2011


2011/6/30 Robin Burchell <viroteck at viroteck.net>

> On 29 June 2011 20:54, Thiago Macieira <thiago at kde.org> wrote:
> > Em Wednesday, 29 de June de 2011, às 21:27:57, Konrad Rosenbaum escreveu:
> >> if(mylist.contains( [](mydata&dat){return dat.name=="hello";} ) )
> >>   doSomething()
> >
> > Like I said, this is a job for external functions, like qFind or STL
> > algorithms.
>
> Why? I'm not sure I agree. Qt exists to make developers' lives easier,
> and even at the Qt3 -> Qt4 transition, when STL was fairly mature on
> many platforms, Qt kept their own container classes (for which I am
> very thankful, as they tend to provide a bit more convenience,
> although a lot of that is things like implicit sharing to make writing
> methods returning complex containers easier and foreach - for
> instance). And isn't this exactly what things like this are about?
> Convenience?
>
> If STL provides the same functionality in its basic containers, that's
> great, but we shouldn't limit ourselves to someone else's subset of
> functionality, should we?
>
completely agree that this job is for functions like qFind/qBinaryFind, etc.
I, personally, see no point in adding a convenience method per container
class if there is an iterator-based function exists (think about
qDeleteAll() as for example)
moreover, using qBinaryFind() in the use-case described above could be some
faster...

Konstantin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt.nokia.com/pipermail/qt5-feedback/attachments/20110630/57783c7d/attachment.html 


More information about the Qt5-feedback mailing list