[Qt5-feedback] Lambdas
Ivan Cukic
ivan.cukic at kde.org
Mon Jun 27 11:26:28 CEST 2011
> To be honest, I'd rather we avoid adding more methods to the functional
> and algorithmic parts. We should provide the basic algorithms (qCopy,
> qStableSort, qLowerBind, etc.), but anything else should be just STL.
IDK, but for me, stuff like (not c++ syntax)
list.filter( _ > 0).map( i -> i * i ).reduceLeft( _ + _ )
to calculate sum of squares of positive items
or
list.all(_ > 0)
to check whether all items are greater than 0
Would be quite awesome.
A few days ago I was checking out my student's project that dealt with
some variant of poker. The method for checking for various combinations
would be shorter at least 20 times with methods like the above.
I guess all these can be implemented in a separate non-core-Qt library
(libQFt :) ) to make classes that don't binary-differ (in-memory-wise, not
abi) from QList and others so that those can be used as drop-in
replacements)
Cheerio
--
Sanity is the trademark of a weak mind.
-- Mark Harrold
More information about the Qt5-feedback
mailing list