Boost logo

Boost :

From: Andy Little (andy_at_[hidden])
Date: 2005-05-02 10:28:54


"Eric Niebler" <eric_at_[hidden]> wrote
> bool first = true;
> BOOST_FOREACH(....)
> {
> if(first)
> {
> do_something();
> first = false;
> }
> }

Wanting the last element is very nearly as common as wanting the first.
Putting this after the loop requires an extra check for an empty container.
Why do you not wish to expose the iterator in BOOST_FOR_EACH ?

regards
Andy Little


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