Boost logo

Boost :

Subject: Re: [boost] [filesystem] C++11 range-based for statement and BOOST_FOREACH support
From: Nathan Ridge (zeratul976_at_[hidden])
Date: 2012-07-14 12:25:46

> > Hm.
> >
> > Why not follow this design:
> >
> >
> The implementation would be more elegant, but the user would have to write:
> BOOST_FOREACH(directory_entry& x, directory_range(directory_iterator(".")))
> instead of the simpler:
> BOOST_FOREACH(directory_entry& x, directory_iterator("."))
> I verified the above with an actual implementation and test.

I don't see why that's the case. In the posted link, the function istream_range()
takes an argument of type istream&, which is the same argument type that the
constructor of istream_iterator takes. Notice that istream_range() does *not*
take an actual istream_iterator as its constructor argument.

Similarly, I would expect directory_range() to take a path argument, and return
something like make_iterator_range(directory_iterator(p), directory_iterator()).


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