lmi
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lmi] [PATCH] C++ m11n: range-based for loops


From: Vadim Zeitlin
Subject: Re: [lmi] [PATCH] C++ m11n: range-based for loops
Date: Fri, 13 Jan 2017 17:49:31 +0100

 Sorry, I must have dreamed testing this patch because I have no
explanation how could it have worked for me :-( It's true that C++17
std::filesystem includes support for iterating over the directory contents
using range-based for, see

http://en.cppreference.com/w/cpp/experimental/fs/directory_iterator/begin

but even in C++17 this can't be done by iterating over the path itself,
which just iterates over its components, see

        http://en.cppreference.com/w/cpp/experimental/fs/path/begin

and Boost 1.33 doesn't have begin/end() overloads taking directory_iterator
at all.

 So what I _intended_ to write was surely

        for(auto const& p: fs::directory_iterator(path))

instead of

        for(auto const& p: path)

that I actually wrote. But, of course, the former version wouldn't
compile...

 The fix is to either revert these changes or, IMHO preferably, add our own
trivial begin()/end() implementations. The attached patch does the latter
and does pass the test suite now, but please let me know if you'd prefer to
be more conservative and revert these changes instead.

 And sorry again for somehow not noticing the test failures :-( I know it's
entirely my fault for not being attentive enough, but I'd still like to
note that it's too easy to not see the failures in the huge amount of
output from "make unit_tests". Compare this with the IMHO much nicer output
from Automake-generated "make check" target which looks like this:

============================================================================
Testsuite summary for LMI 1.0.0
============================================================================
# TOTAL: 63
# PASS:  58
# SKIP:  0
# XFAIL: 0
# FAIL:  5
# XPASS: 0
# ERROR: 0

(it's even coloured, with both "FAIL" and the header highlighted in red)
and, of course, "make check" exits with non-zero exit status in this case.

VZ

Attachment: fix_fs_iter.patch
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]