Boost logo

Boost :

From: Eric Niebler (eric_at_[hidden])
Date: 2005-03-11 10:43:08

Martin wrote:
> Is it possible to use the BOOST_FOREACH technology to create something that
> work with objects where end is the default constructor?
> example boost::filesystem
> for (directory_iterator itr("C:\\"); itr != directory_iterator(); ++itr)
> ..
> BOOST_FOREACH_2(directory_iterator itr("C:\\"))

Possible? Yes, but my gut tells me not to. BOOST_FOREACH works with
ranges, not iterators, and i don't want to create confusion about that.

FWIW, you can iterate over a directory like:

directory_iterator begin("C:\\"), end;
BOOST_FOREACH(path p, std::make_pair(begin,end))

Eric Niebler
Boost Consulting

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