This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// *__m is median. partition [__first, __m) < *__m and | |
// *__m <= [__m, __last) | |
// | |
// Special handling for almost sorted targets | |
while (true) { | |
while (__comp(*++__i, *__m)); | |
while (!__comp(*--__j, *__m)); | |
if (__i > __j) break; | |
swap(*__i, *__j); | |
} | |
swap(*__i, *__m); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment