Answers for "find unique elements in vector c++"

2

vector unique in c++

sort(vec.begin(), vec.end());
vec.erase(unique(vec.begin(), vec.end()), vec.end());
Posted by: Guest on June-20-2021
8

erase duplicates and sort a vector

sort( vec.begin(), vec.end() );
vec.erase( unique( vec.begin(), vec.end() ), vec.end() );
Posted by: Guest on May-20-2020

Code answers related to "find unique elements in vector c++"

Browse Popular Code Answers by Language