Boost logo

Boost :

From: Gabriel Dos Reis (gdr_at_[hidden])
Date: 2004-03-09 09:32:02


David Abrahams <dave_at_[hidden]> writes:

| > | > transform(v.begin(), v.vend(), v.begin()
| > | > (auto x) ((int y) auto { return y + x; }) (i));
| > | >
| > |
| > |
| > | Yes, but this is a quite complex and hard to read way to express
| > | something simpler.
|
| Yeah, the corresponding lambda in Python is:
|
| labmbda x,y: x+y
|
| It'd be nice if we could get to something that simple.

Yes, and it is one the simplest common cases. The correspnding
formulation in C++ would be as simple as well, e.g.

    (auto x, auto y) { x + y; }

(three months ago, Bjarne showed another candidate: { x, y; | x + y; })

  The main issue in this discussion, however, concerns what to do when
a reference is made to an automatic variable in an enclosing scope.

-- Gaby


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