title: C++ nested iterators
body: <p>Is it OK to have a nested iterator like the following?</p>
  
  <pre><code>for (vector&lt;type&gt;::iterator i = list.begin(); i != list.end(); ++i) {
      for (vector&lt;type&gt;::iterator j = i; j != list.end(); ++j) {
          ...
      }
  }
  </code></pre>
  
  <p>Note that <code>j</code> starts at <code>i</code>, and not <code>list.begin()</code>. Since the iterator is random access, can I guarantee that both <code>i</code> and <code>j</code> will have the same order? is there a better way of doing this?</p>