title: How do you iterate backwards through an STL list?
body: <p>I'm writing some cross-platform code between Windows and Mac.</p>
  
  <p>If list::end() "returns an iterator that addresses the location succeeding the last element in a list" and can be checked when traversing a list forward,  what is the best way to traverse backwards?</p>
  
  <p>This code workson the Mac but not on Windows (can't decrement beyond first element):</p>
  
  <pre><code>list&lt;DVFGfxObj*&gt;::iterator iter = m_Objs.end();
  for (iter--; iter!=m_Objs.end(); iter--)// By accident discovered that the iterator is circular ?
  {
  }
  </code></pre>
  
  <p>this works on Windows:</p>
  
  <pre><code>list&lt;DVFGfxObj*&gt;::iterator iter = m_Objs.end();
      do{
          iter--;
      } while (*iter != *m_Objs.begin());
  </code></pre>
  
  <p>Is there another way to traverse backward that could be implemented in a for loop?</p>