how to remove duplicated elements from a vector without allocating space for another vector code example
Example 1: erase duplicates and sort a vector
sort( vec.begin(), vec.end() );
vec.erase( unique( vec.begin(), vec.end() ), vec.end() );
Example 2: remove duplicates from vector c++
sort( vec.begin(), vec.end() );
vec.erase( unique( vec.begin(), vec.end() ), vec.end() );