I am trying to create a program to retain only unique elements in a vector
for example:
vector<string> i = "one", "one", "two".
the output would be:
vector<string> i = "one", "two"
**** This is an implementation of the answer as a function. I get the error vector iterator incompatible when I run it with a sample vector.
void simplifyVector(vector<string> i){
/*vector<string>*/;
sort(i.begin(), i.end());
auto iter = unique(i.begin(), i.end());
while (iter != i.end())
{
i.erase(iter);
}
for (const auto &s : i)
{
cout << s << " ";
}
cout << endl;
}