Q. How do you remove duplicates from a vector?
A. This is how:
void removeDuplicates(std::vector<T>& vec)
vec.erase(std::unique(vec.begin(), vec.end()), vec.end());
If I needed a container to keep itself populated of only unique values, I would probably choose std::set but then choosing the right container depends on so many other different factors as well.
Edit Comment : Corrected above by replacing remove with erase as there isn't such a member function in std::vector. std::erase, however, is and the code works with just that replacement.