Boost logo

Boost :

From: John Torjo (john.lists_at_[hidden])
Date: 2004-04-21 03:51:50

John Torjo wrote:

> michael toksvig wrote:
>> A while back, Erik Niebler was testing the waters for inclusion of
>> his very,
>> very clever looping construct into boost, but nothing really came of it.
>> Erik's technique is described here:
>> Yup, macros are involved and they are yucky, and yup, there already
>> exists a
>> for_each in the standard that works just fine if you care to move
>> your loop
>> body away into a function, and yup, the name BOOST_FOREACH could use a
>> little love.
>> 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;
p.s. no macros involved in the above statement ;)

Boost list run by bdawes at, gregod at, cpdaniel at, john at