
21 Apr
2004
21 Apr
'04
12:20 p.m.
"Daniel Wallin" <dalwan01@student.umu.se> wrote in message news:c65o14$n90$1@sea.gmane.org... | 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. but you cannot call break such a loop. With for each + auto we could say for( auto i : cont ) *i += 2; br Thorsten