This gist further discusses how to remove duplicates from a C++ container. A previous gist discussed the removal of duplicates from random access containers. But not every container supports random access; more precisely, not every container supports random access iterators.
Let us discuss removing duplicates when the container interface is the most basic one: only supporting forward iterators. Moreover, we will not require that the elements support comparisons.
A very basic and naive algorithm works in-place and runs in quadratic time.