Created
December 23, 2016 15:43
-
-
Save deque-blog/c0f03af77a93f3b3095a061f76ad8248 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
template<typename ForwardIterator> | |
void stable_sort_forward(ForwardIterator first, ForwardIterator last) | |
{ | |
using Range = std::pair<ForwardIterator, ForwardIterator>; | |
using Counter = binary_counter<merger<ForwardIterator>, Range>; | |
Counter c { merger<ForwardIterator>{}, { last, last } }; | |
for (; first != last; ++first) { | |
c.add(std::make_pair(first, std::next(first))); | |
} | |
auto result = c.reduce(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment