insert only unique values into vector

Solutions on MaxInterview for insert only unique values into vector by the best coders in the world

showing results for - "insert only unique values into vector"
Elizabeth
06 Jun 2017
1std::vector<std::string> name;
2
3....
4if (std::find(name.begin(), name.end(), someName) == name.end()) {
5  // someName not in name, add it
6  name.push_back(someName);
7}
8