1sort( vec.begin(), vec.end() );
2vec.erase( unique( vec.begin(), vec.end() ), vec.end() );
1sort( vec.begin(), vec.end() );
2vec.erase( unique( vec.begin(), vec.end() ), vec.end() );
3
1sort( res.begin(), res.end() );
2res.erase( unique( res.begin(), res.end() ), res.end() );
3
4SYNTAX:
5ForwardIterator unique (ForwardIterator first, ForwardIterator last);
6
7first: Forward iterator to the first element in the container.
8last: forward iterator to the last element in the container.
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