This sort of thing worked in Boost 1.55.0:
#include
#include
#include
struct pred
{
bool operator()(const boost::filesystem::directory_entry & dirent)
const
{
return true;
}
};
int main()
{
const auto dirent_range =
boost::make_iterator_range(boost::filesystem::directory_iterator("/"),
boost::filesystem::directory_iterator());
const auto filtered_dirent_range =
boost::adaptors::filter(dirent_range, pred());
}
Not so in 1.56.0 [output from Apple's clang 3.4]:
boost/concept_check.hpp:210:9: error:
no viable conversion from 'boost::single_pass_traversal_tag' to
'boost::forward_traversal_tag'
Y y = x;
^ ~
The full error output is much more verbose and I can provide it if
desired; but the above is the gist of the situation, as I understand it:
directory_iterators are SinglePass iterators; filter operates on
ForwardTraversal iterators; and the SinglePass iterator cannot be
converted to the ForwardTraversal one.
Is this situation deliberate or an unintended side effect? Is there
some similarly succinct means of filtering a file/directory listing?
--
Braden McDaniel