Boost logo

Boost :

From: Joel Eidsath (jeidsath_at_[hidden])
Date: 2005-08-30 09:39:06


I like the BOOST_FOREACH macro, and I'm going to be spending a lot of
time playing around with it.

For working with iterator ranges, however, this sort of thing seems to
be the best that I can come up with:

//pFirst and pLast are iterators that return an int on dereference
//they could be some_containter<int>.rbegin() and
some_container<int>.rend(), for example
BOOST_FOREACH(int i, vector<int>(pFirst,pLast));

It's not that ugly, but creating a new vector to do a loop is quite an
efficiency hit. Is there an better way to do this?

Joel Eidsath


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