[libcxx-commits] [PATCH] D96084: Revert "Revert "[libc++] [P0879] constexpr std::nth_element, and rewrite its tests.""
Arthur O'Dwyer via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Feb 5 08:07:07 PST 2021
Quuxplusone planned changes to this revision.
Quuxplusone added a comment.
> Simple "manual" tests can also pay off :-)
Well, actually, before landing this I thought I'd better run some more randomized tests... and I found that this patch //also// has a bug somewhere! Reduced from the randomized tests:
std::vector<int> v2 = { 18, -7, 1, -9, 3, 13, -10, -10, -9, 4, -10, 5, 8, 6, 11, -10, 19 };
std::nth_element(v2.begin(), v2.begin() + 10, v2.end());
assert(std::all_of(v2.begin(), v2.begin() + 10, [&](int x){ return x <= v2[10]; }));
assert(std::all_of(v2.begin() + 10, v2.end(), [&](int x){ return x >= v2[10]; })); // fails!
So I'm still working on this.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D96084/new/
https://reviews.llvm.org/D96084
More information about the libcxx-commits
mailing list