Answers for "how to remove only one of the same element from a vector cpp"

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
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 "how to remove only one of the same element from a vector cpp"

Browse Popular Code Answers by Language