title: Iterator for jumping between container C++
body: <p>I have a container of container of ints. Lets say <code>deque&lt; deque&lt;int&gt; &gt;</code>. All the numbers in the <code>deque&lt;int&gt;</code> are sorted in ascending order. So the info in the container looks something like this:</p>
  
  <pre><code>deque&lt;deque&lt;int&gt;&gt; // main container
    5 11 22 44      // deque&lt;int&gt; number 1
    1 7 12          // deque&lt;int&gt; number 2
    4 5 7 9 1112    // deque&lt;int&gt; number 3
  </code></pre>
  
  <p>I want to make an iterator that traverses thru all the numbers in <code>deque&lt;deque&lt;int&gt;&gt;</code> in ascending order. Meaning my iterator can jump between the containers and after I've gone through them all I will have traversed thru the numbers in this order: <code>1 4 5 5 7 7 9 11 12 22 44 1112</code>. How can I accomplish this? I thought of putting all the numbers in one container and sorting them, but later if I want to say <code>*it = 10</code> I won't be able because I don't know to which containers position is <code>it</code> pointing. So any ideas and solutions are welcomed :) </p>