-
-
Save danlark1/3442e67c07b3e9a620b2fc6f2dff5685 to your computer and use it in GitHub Desktop.
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