Does a call of unique() on a list also resize the list if repeats are found?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Yes, it does. It removes the duplicate elements. So the size of the list changes as well.
Have a look at the documentation here. It says:
Note that in case of std::list, while erasing an element, only the iterators and references to the erased element are invalidated [23.2.2.3/3].