Answers for "c++ vector only unique elements"

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
0

remove duplicates from vector c++

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

Code answers related to "c++ vector only unique elements"

Browse Popular Code Answers by Language