title: Defining iterator of my own container
body: <p>I am confused with some concepts about defining my own iterator:</p>
  
  <p>From this: <a href="http://www.cs.northwestern.edu/~riesbeck/programming/c++/stl-iterator-define.html">http://www.cs.northwestern.edu/~riesbeck/programming/c++/stl-iterator-define.html</a>, which seems to suggest using inner iterator class which defines the operators.  Many others inherit the base class <code>iterator</code> to redefine the operators. </p>
  
  <p>I am quite confused about which methods should be used.  Why is there</p>
  
  <pre><code>typedef ptrdiff_t difference_type;
  </code></pre>
  
  <p>for example, at the beginning of the definition of container class?</p>
  
  <p>Thank you very much!</p>