Boost logo

Boost :

From: Russell Hind (rhind_at_[hidden])
Date: 2003-10-10 11:58:57


Glen Knowles wrote:

> I write a lot of those little for loops (one of my "choosen" compilers
> is HP aC++, no lamda, flaky bind, etc, yuck) and I would definitely use
> the macro.
>

I use bcc 5.6.4 and can use bind but not lambda but have just started
using phoenix for simple constructs e.g.

for_each(a.begin(), a.end(),
         phoenix::arg1 = phoenix::arg1 * -1.0);

I'm unsure about the macro. I haven't looked at the
container_traits/sequence_algo mentioned elsewhere in this thread yet.

Its an interesting idea, and I would possibly use it were it accepted
into boost.

One thing that worries me about the inital example is if you forget to
declare i as a reference, then it breaks.

Could the type of the local not be auto-declared? so it becomes

BOOST_FOREACH(i, int_list)
{
...
}

That way, the user doesn't have to remember the & or not.

Cheers

Russell


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