erase() and erase_if() are not the only algorithms for which the remove-erase idiom is applicable. Another example is std::unique(), which is used to remove duplicates from a presorted range of elements. Write a little program that fills a vector with a considerably large amount of random integers between 0 and 10'000, sorts this sequence, removes the duplicates, and then prints out the amount of remaining elements.
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here