function for dealing with duplicates in an array

--
Last edited on
std::unique
I can't use anything from the algorithm library.
And therefore you cannot read the reference documentation for std::unique, which does show one possible implementation for std::unique. If I would copy-paste it here, you could not read it, right?


You are looking at two consecutive items and end up in trouble. So don't.

What if you had a bucket 'src' and bucket 'dst'? You take one item from src. If it is the same as the top item in dst, then toss it away. Else place it in dst. Rinse and repeat until the src is empty.
Topic archived. No new replies allowed.