BOOST_FOREACH on a filesystem directory_iterator?

Boost.Filesystem apparently contains support for BOOST_FOREACH: https://github.com/boostorg/filesystem/blob/5a93351bfdf859ee47245e0429739226... But it doesn't work: #include <boost/filesystem.hpp> #include <boost/foreach.hpp> namespace fs = boost::filesystem; int main() { fs::directory_iterator it; BOOST_FOREACH( fs::path const& p, it ) { } } 1>c:\boost-git\develop\boost/range/end.hpp(48) : error C2039: 'end' : is not a member of 'boost::filesystem::directory_iterator' The fix is trivial, but I wonder... how did nobody notice? Is this feature never used?

On Wed, Aug 29, 2018 at 6:12 AM Peter Dimov via Boost <boost@lists.boost.org> wrote:
Boost.Filesystem apparently contains support for BOOST_FOREACH:
https://github.com/boostorg/filesystem/blob/5a93351bfdf859ee47245e0429739226...
But it doesn't work:
...
The fix is trivial, but I wonder... how did nobody notice? Is this feature never used?
I haven't tried that before, but I would be concerned about the ability to iterate cleanly in the presence of concurrent changes. I had hoped boost filesystem uses a replaceable back-end so I could target it against other filesystem providers (other than POSIX, Win32), but I don't see that architecture internally. :( Would be nice to have a complete back-end abstraction so one could provide their own. - Jim
participants (2)
-
James E. King III
-
Peter Dimov