[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 13:02:48 PST 2021
Quuxplusone added a comment.
In D96084#2545452 <https://reviews.llvm.org/D96084#2545452>, @rupprecht wrote:
> FWIW, I applied this patch and was able to make it pass this pretty exhaustive test: [...]
@rupprecht: I'm looking at adding a similar test to the libc++ test suite, but, I don't really understand what this test is doing. You're running `nth_element` repeatedly on the same array with increasing `m` and `n`, which is kind of a selection sort on the first `len-1` elements? And then `next_permutation` takes it from `4 3 2 1 0 5` to `4 3 2 1 5 0` and we selection-sort the first `n-1` elements again to get `5 4 3 2 1 0`, and then the second `next_permutation` kicks us out to increment `len`?
I thought maybe you were going for the "try all permutations of 64 elements" exhaustive test, but that would take 64! iterations which is heat-death-of-the-universe territory.
Is there a subtle logic to the particular sequence your test is actually doing?
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
More information about the libcxx-commits