4 ms·
<removed incorrect comparison with std::sort()>
by ComputerGuru 3y ago
<removed incorrect comparison with std::sort()>
- ack_complete 3y agoThe situation is not any different for std::sort, which also requires that the supplied comparison operator be well-behaved and can also fail in the same way otherwise. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=41448 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=41448
- ComputerGuru 3y agoNever mind, you're right of course. I blanked for a moment there and completely forgot that you just need to use `std::stable_sort()` for non-deterministic comparison routines.
- microtherion 3y agoIn fact if an implementation of std::sort has this bug, it's worse, because a fix in a template function requires recompiling all clients to go into effect, while qsort can be fixed in one shared library.