limited_ins_sort
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
const unsigned __limit = 8; | |
unsigned __count = 0; | |
for (_RandomAccessIterator __i = __j + difference_type(1); __i != __last; ++__i) { | |
if (__comp(*__i, *__j)) { | |
value_type __t(_VSTD::move(*__i)); | |
_RandomAccessIterator __k = __j; | |
__j = __i; | |
do { | |
*__j = _VSTD::move(*__k); | |
__j = __k; | |
} while (__j != __first && __comp(__t, *--__k)); | |
*__j = _VSTD::move(__t); | |
if (++__count == __limit) | |
return ++__i == __last; | |
} | |
__j = __i; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment