Boost logo

Boost :

From: Dave Harris (brangdon_at_[hidden])
Date: 2005-05-09 13:29:40

In-Reply-To: <427F7635.4010303_at_[hidden]>
sstrasser_at_[hidden] (Stefan Strasser) wrote (abridged):
> you might be interested in this document from the new c++0x mailing:
> for the naming discussion, proposed syntax is for(int i : vec)
> (personally I don't care if it's called BOOST_FOREACH or BOOST_FOR)

I don't mind if it is BOOST_FOR_EACH or BOOST_FOR :-)

> I've questioned in the past if it is expected behaviour to do
> "hoisting". the proposal does.

Although it doesn't seem to say whether "vec" is hoisted, and the given
translation suggests that it isn't. I imagine that is an oversight in the
presentation rather than the intended semantics. Interestingly he gives an
example of an adaptor which could potentially be evaluated multiple times.

The proposal says:

   The user is required to include the standard header <iterator>
   in which the default version of begin()/end() is defined

which seems wrong to me. #include<vector> ought to be enough to use for
with std::vector, if it's a built-in facility.

-- Dave Harris, Nottingham, UK.

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