What’s the most efficient way to erase duplicates and sort a vector?
I agree with R. Pate and Todd Gardner; a std::set might be a good idea here. Even if you’re stuck using vectors, if you have enough duplicates, you might be better off creating a set to do the dirty work. Let’s compare three approaches: Just using vector, sort + unique sort( vec.begin(), vec.end() ); vec.erase( … Read more