   Vector Iterators
  Hi again,I'm trying to learn more about data structures, so I'm writing my own custom versions of each over time. Right now I'm working on vectors, and I've run into a problem with iterators. I've never used them with vectors before (I've always used []), so I'm wondering what information it would contain. I've used list iterators before, so is it something similar to that?Thanks   
  An iterator to a vector would behave exactly the same way as a pointer into the internal array. The only information they need to contain is a single pointer to an element in the vector. It needs to overload all operators that work with pointers.   ;  Expanding on visitor's post:class MyVector{public:  T* begin() { return buffer; }  T* end() { return buffer + size; }private:  T* buffer;  int size;};;  Of course, the iterator needn't be just a pointer (there might be advantages to it being a unique class). For example, GCC's vector iterator is a __normal_iterator<T, vector<T> >.Also make sure to inherit from std::iterator with suitable template parameters. For example:template <class T>class MyVectorIterator: public std::iterator<std::random_access_iterator_tag, T>{    //...};template <class T>class MyLinkedListIterator: public std::iterator<std::bidirectional_iterator_tag, T>{    //...};(or provide the required typedefs) or else your iterators may not work well with the rest of the STL.   