Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

To get constant-time erasure of list elements, the author should be referring to the Person elements with a std::list<Person>::iterator instead of a Person* . Passing an iterator to erase gives you constant-time erasure.

An iterator is equivalent to a pointer (* and -> get you a Person), but it also lets the implementation access the linked list node.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: