Skip to content

Remove duplication

C++

1
2
3
4
5
6
template<class T>
std::vector<T> remove_duplication(std::vector<T> v){
    std::sort(v.begin(), v.end());
    v.erase(std::unique(v.begin(), v.end()), v.end());
    return v;
}