Skip to content

Instantly share code, notes, and snippets.

@jsam
Created August 27, 2012 11:49
Show Gist options
  • Save jsam/3487811 to your computer and use it in GitHub Desktop.
Save jsam/3487811 to your computer and use it in GitHub Desktop.
vector remove duplicate template
template<typename T>
void removeDuplicates(std::vector<T>& vec)
{
std::sort(vec.begin(), vec.end());
vec.erase(std::unique(vec.begin(), vec.end()), vec.end());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment