Skip to content

Instantly share code, notes, and snippets.

@danlark1
Last active April 18, 2022 22:09
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 danlark1/8f4587e9cecc74dc778bcbd0c062037d to your computer and use it in GitHub Desktop.
Save danlark1/8f4587e9cecc74dc778bcbd0c062037d to your computer and use it in GitHub Desktop.
// We only care about the n entities with the highest scores.
std::partial_sort(vector.begin(),
vector.begin() + n,
vector.end(),
HasHigherScore());
vector.resize(n);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment