Boost logo

Boost :

From: Jaakko Jarvi (jajarvi_at_[hidden])
Date: 2002-03-18 10:22:06


> > I haven't look at any of the technical issues, but from a purely
> > esthetic view I prefer the familiar, explicit "lambda(x, y, x + y)".
>
> Sometimes the choice is not so clear-cut.
>
> std::for_each(v.begin(), v.end(), std::cout << _1 << '\n');
>
> vs
>
> std::for_each(v.begin(), v.end(), lambda(x, std::cout << x << '\n'));
>
> In general, I find that every non-pure-functional use looks better with the
> _N syntax; lambda() implies a pure function as far as I'm concerned.
>

The difference is really just syntactical.
Even with lambda(x, y, ...) the variables x and y are still predefined
placeholder names, defined by the FACT library, not real formal parameter
names.

Jaakko


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk