Pointers do satisfy the requirements of the iterator (a pointer satisfies even the most specialized requirements of a random access iterator). Your problem is that when implementing the standard library that you use, the iterators provided, for example, std::vector supports more operations than the iterator requires.
In other words, the standard does not guarantee that ++vi.begin() will work for std::vector iterator vi . It happens that you are working on your standard library implementation, but thatβs implementation detail. An iterator that would not support this is still a perfectly valid iterator.
So, to answer your question: if you want to quickly create a reserve for an iterator that will support all iterator operations, you can certainly use a pointer. If you need fast iterator support that will additionally support all the operations supported by the standard library implementation, in addition to the iterator requirements, you may have to deploy your own class.
source share