title: How to correctly implement custom iterators and const_iterators?
body: <p>I have a custom container class for which I'd like to write the <code>iterator</code> and <code>const_iterator</code> classes.</p>
  
  <p>I never did this before and I failed to find an appropriate how-to. What are the guidelines regarding iterator creation, and what should I be aware of ?</p>
  
  <p>I'd also like to avoid code duplication (I feel that <code>const_iterator</code> and <code>iterator</code> share many things; should one subclass the other ?).</p>
  
  <p><em>Foot note: I'm pretty sure Boost has something to ease this but I can't use it here, for many stupid reasons.</em></p>