Boost logo

Boost :

Subject: [boost] BOOST_FOREACH on a filesystem directory_iterator?
From: Peter Dimov (lists_at_[hidden])
Date: 2018-08-29 10:12:32


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?


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