Skip to content

Instantly share code, notes, and snippets.

Created April 12, 2022 19:30
What would you like to do?
template <class _Compare, class _ForwardIterator>
unsigned __sort5(_ForwardIterator __x1, _ForwardIterator __x2, _ForwardIterator __x3,
_ForwardIterator __x4, _ForwardIterator __x5, _Compare __c) {
unsigned __r = _VSTD::__sort4<_Compare>(__x1, __x2, __x3, __x4, __c);
if (__c(*__x5, *__x4)) {
swap(*__x4, *__x5);
if (__c(*__x4, *__x3)) {
swap(*__x3, *__x4);
if (__c(*__x3, *__x2)) {
swap(*__x2, *__x3);
if (__c(*__x2, *__x1)) {
swap(*__x1, *__x2);
return __r;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment