[libcxx-commits] [libcxx] [libc++] [sort] Improve performance of std::sort (PR #76616)
Christopher Di Bella via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Jan 2 10:57:01 PST 2024
================
@@ -68,8 +68,7 @@ void test_same() {
auto snapshot_custom_v = v;
std::sort(v.begin(), v.end());
std::sort(snapshot_v.begin(), snapshot_v.end());
- std::sort(snapshot_custom_v.begin(), snapshot_custom_v.end(),
- [](const EqualType&, const EqualType&) { return false; });
----------------
cjdb wrote:
It's worth noting that this is in `test/libcxx`, not `test/std`, and so there's more lenience for tests that are coupled with the implementation. I do think that we should avoid this practice though.
It's also worth noting that this lambda doesn't meet the requirements of `Compare` because it doesn't impose a [strict weak order](https://eel.is/c++draft/algorithms#alg.sorting.general-4) on its elements, so replacing it with something that does is a good idea.
https://github.com/llvm/llvm-project/pull/76616
More information about the libcxx-commits
mailing list