Skip to content

Instantly share code, notes, and snippets.

@picanumber
Created January 11, 2017 13:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save picanumber/083a2ab0f64725e06c2832cd8dff0b21 to your computer and use it in GitHub Desktop.
Save picanumber/083a2ab0f64725e06c2832cd8dff0b21 to your computer and use it in GitHub Desktop.
Provides sorting with tie breakers
template <std::size_t I, std::size_t... Is, class F>
void multi_sort(F&& bop) const
{
using namespace std;
_is.resize(get<I>(_ts).size());
iota(begin(_is), end(_is), 0);
std::sort(begin(_is), end(_is), [&](size_t lhs, size_t rhs) {
return detail::use_comparator<I, Is...>::apply(
_ts, lhs, rhs, forward<F>(bop));
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment