I am trying to erase all the duplicate words from a vector. I found a function unique(); I wrote a program using this function but it doesn't work as I wanted.
std::unique only works if the elements are sorted. If you don't mind that the elements get sorted you can use std::sort to sort the vector before using std::unique.