Revert "Revert "[libc++] [P0879] constexpr std::nth_element, and rewrite its tests.""

This reverts commit b6ffece32035a90d181101f356bd9c04ea1d3122.

The bug is now fixed (it was a stupid cut-and-paste kind of error),
and the regression test added. The new patch is also simpler than the old one!

Differential Revision: https://reviews.llvm.org/D96084

GitOrigin-RevId: 5d9565634c97a075940041a6756a2583fa1f0bc9
3 files changed