BOOST_FOREACH on a filesystem directory_iterator?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

BOOST_FOREACH on a filesystem directory_iterator?

Boost - Dev mailing list
Boost.Filesystem apparently contains support for BOOST_FOREACH:

https://github.com/boostorg/filesystem/blob/5a93351bfdf859ee47245e0429739226767ef0d7/include/boost/filesystem/operations.hpp#L962

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?


_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: BOOST_FOREACH on a filesystem directory_iterator?

Boost - Dev mailing list
On Wed, Aug 29, 2018 at 6:12 AM Peter Dimov via Boost <[hidden email]>
wrote:

> Boost.Filesystem apparently contains support for BOOST_FOREACH:
>
>
> https://github.com/boostorg/filesystem/blob/5a93351bfdf859ee47245e0429739226767ef0d7/include/boost/filesystem/operations.hpp#L962
>
> 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

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost