
21 Apr
2004
21 Apr
'04
12:09 p.m.
John Torjo wrote:
michael toksvig wrote:
But there is no denying the notational clarity and succinctness of e.g.: foreach(double &d, container) d += 2;
You can also use the rtl (Ranges Template Library): (note: I'll rename the library, wince there's another one with the same name ;))
for( crange<container> r(cont); r; ++r) *r += 2;
xxx::for_each(cont, _1 += 2); IMO C++ isn't missing a loop construct, it's missing a lambda construct. -- Daniel Wallin