Iterators have an interface that "looks" like a pointer (but they are not necessarily pointers, so don't use this metaphor too far).
An iterator provides a link to a single piece of data in a container. You want to access the contents of the container at the position indicated by the iterator. You can access content in the it position with *it . Similarly, you can call methods on the content in the it position (if the content is an object) using it->method() .
This really does not apply to your question, but to spread the error is to be on the lookout (even from time to time I do this time): if the content in the it position is a pointer to an object, to call the methods of the object, the syntax (*it)->method() , since there are two levels of indirection.
source share