Skip to content

Instantly share code, notes, and snippets.

@picanumber
Created January 11, 2017 11:58
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/c713eb288812ba13452f47cde54d0e6b to your computer and use it in GitHub Desktop.
Save picanumber/c713eb288812ba13452f47cde54d0e6b to your computer and use it in GitHub Desktop.
The sort member function of sorted_view
template <std::size_t I, class F>
void 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 forward<F>(bop)(get<I>(_ts)[lhs], get<I>(_ts)[rhs]);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment