How are iterators and pointers related?
c++, iterator, pointers, stl
Solution
Iterators are a generalization of pointers.
An iterator (depending on the variants) have to implement * and ++
So a pointer IS an iterator. But not necessarily the other way round.
If you want to iterate over a complex structure (a tree, a graph...), the iterator will be much more than a pointer, and doesn't make any reference to some actual place in the ram.
Problem
Code with iterators looks pretty much like code with pointers. Iterators are of some obscure type (like `std::vector<int>::iterator` for example). What I don't get is how iterators and pointer are related to each other - is an iterator a wrapper around a pointer with overloaded operations to advance to adjacent elements or is it something else?