Archive

Posts Tagged ‘lambda functions’

C++0x lambdas suck

June 27, 2010 18 comments
int x = 3 ;
int y = 2 ;
vector<int> v = { 1, 2, 3, 4, 5, 6 } ;

sort(v.begin(), v.end(), [=x, &y](int lhs, int rhs) { return (lhs & x) < (rhs & y); }) ;

Ok – I stretched there to incorporate the capture in all it’s glory (the capture is the [=x,&y]).

Lets be frank here. The purpose of a lambda function is to be able to create a little snippet of code to be executed inside a loop.

Does C++ need it? IMHO, lambda functions are bad. And C++0x’s choice to make them hideously ugly doubly so.

Read more…

Categories: Coding Tags: ,
Follow

Get every new post delivered to your Inbox.

Join 218 other followers