[libcxx-commits] [PATCH] D115312: [libc++] [ranges] Fix bugs in ranges::empty().
Arthur O'Dwyer via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Dec 23 10:46:30 PST 2021
Quuxplusone accepted this revision.
Quuxplusone added a comment.
Accepting-as-libc++ to land this. (@ldionne is out; but his "requested changes" applied to the previous version of this PR, which did a lot of rewriting in addition to the bugfixes. I believe scaling it back to just the bugfixes addresses those comments sufficiently.)
================
Comment at: libcxx/test/std/ranges/range.access/empty.pass.cpp:157-164
assert(std::ranges::empty(a) == true);
DisabledSizeRangeWithBeginEnd d;
assert(std::ranges::empty(d) == true);
BeginEndAndEmpty e;
assert(std::ranges::empty(e) == false); // e.empty()
----------------
philnik wrote:
> Why the `== false` and `== true`? Seems weird.
As mentioned in the other review, these tests don't really verify //return types// at all, so here I infer that the writer was trying to sort of hint at "...and `empty(e)` should return `bool(true)`, not just anything that happens to be truthy." Of course the compiler doesn't care what you're hinting at, so this isn't very useful as a test. ;) I think I'll remove these `== true`s and change `== false` to `!`, but in a separate NFC patch.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D115312/new/
https://reviews.llvm.org/D115312
More information about the libcxx-commits
mailing list