Boost logo

Boost :

From: Brian McNamara (lorgon_at_[hidden])
Date: 2003-10-09 14:32:27


On Thu, Oct 09, 2003 at 12:05:29PM -0700, Eric Niebler wrote:
> Resending. Based on the number of private replies I got, I suspect there
> is some interest in adding a foreach looping construct to Boost. The
> lack of public discussion makes me wonder, though. Does no one want to
> publically support an Ugly Macro? :-) Or is this just not compelling enough?

I have mixed feelings about it.

On the one hand, I very much like the idea of being able to say

   BOOST_FOREACH( int &i, int_list ) {
      yadda();
   }

instead of the heavy

   for( list<int>::iterator b = int_list.begin(), e = int_list.end();
                            b != e; ++b ) {
      int &i = *b;
      yadda();
   }

On the other hand, I use this idiom rarely enough that having to type a
lot doesn't bother me much. The Ugly Macro stigma is there too. And
accepting something like this opens the door to other
container-facades, like

   BOOST_TRANSFORM( int_list, f )
   // means std::transform( int_list.begin(), int_list.end(), f )

and it's unclear to me that this is a road I want to go down.

So, I dunno. I'm mildly in favor of it, but I don't like the idea of
it setting a precedent.

-- 
-Brian McNamara (lorgon_at_[hidden])

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