What is the simplest way to remove duplicates from a C++ std::vector<std::string>
? I want the order to be kept.
For example:
std::vector<std::string> container;
container.push_back("z");
container.push_back("y");
container.push_back("x");
container.push_back("z");
And at the end, I simply want my vector to contain (in order) : z, y, x.
In order to remove the duplicates, I could simply add each vector item into a set/unordered_set, but it would modify the order based on the criterion of the default comparison object.