[Qt5-feedback] Why lambdas would be very good to have

vivainio at gmail.com vivainio at gmail.com
Tue Jun 14 08:20:04 CEST 2011


Why would functors be better than lambdas for some things, given that among lambda can invoke a functor? Execution speed?

Lähetetty Nokia-puhelimestani
---- alkuperäinen viesti ----
Lähettäjä: Charley Bay
Lähetetty:  12.06.2011, 15:40 
To: Timur Kristóf
Cc: qt5-feedback at qt.nokia.com
Aihe: Re: [Qt5-feedback] Why lambdas would be very good to have


Timur spaketh:

> There was an initiative I've seen in
> http://labs.qt.nokia.com/2011/05/26/cpp0x-in-qt/ that Qt intends to
> support features included in C++0x, including lambdas. <snip>



> I have implemented a class that provides a simplistic implementation of
> the above and put together a small example code to demonstrate how it
> works.
> http://pastebin.com/tZdkJQCd
> http://pastebin.com/WiC6MTNn
> I think a similar class (or the implementation of these methods in QList
> itself) could be a reasonable improvement in Qt.
>
> The other area where I would love to see lambdas is signal-slot
> connections <snip>


I'm curious, what do you guys think about these?
> As for me, I'd love to see these feature in Qt 5.
>

+1

(1) Lambdas for signal/slot
(2) Lambdas for LINQ-like set filtering
(3) ???
(4) Profit!

I like that your  "Queryable" example explicitly handles "Zero-Or-One" and
"Zero-Or-Many" (IMHO explicit both are required).

I also have implemented my own version of "lambdas" with Functors, and it
works nicely.  For the trivial stuff, lambdas would probably be easier; for
the "heavy" stuff, Functors are probably better.

--charley

_______________________________________________
Qt5-feedback mailing list
Qt5-feedback at qt.nokia.com
http://lists.qt.nokia.com/mailman/listinfo/qt5-feedback


More information about the Qt5-feedback mailing list