How can I delete duplicate elements from a vector but starting from the front?
So
2 3 4 5 2 5
would become 3 4 2 5
1 5 3 1
would become 5 3 1
I would like the solution to be easy to read, and it would be nice if it had good performance as well.
If a container supports bidirectional iterators then it is unimportant from which side of the container you are trying to remove duplicate elements because you can use reverse iterators.
Here is a demonstrative program.
The program output is