title: Get the intersection iteratively
body: <pre><code>intersection.clear();
  int a = distance(leftbound, rightbound);
  {
      set_intersection(leftbound, rightbound, k[str.substr(start_location, i - start_location)].begin(),
           k[str.substr(start_location, i - start_location)].end(), back_inserter(intersection));
  }
  vector&lt;int&gt; test;
  vector&lt;int&gt;::iterator test_it1 = test.begin();
  vector&lt;int&gt;::iterator test_it2 = intersection.begin();
  test.resize(intersection.size());
  for (; test_it1 != test.end(); test_it1++)
  {
      *test_it1 = *test_it2;
      test_it2++;
  }
  leftbound = test.begin();
  rightbound = test.end();
  </code></pre>
  
  <p><code>k[...]</code> will change with <code>i</code>; I believe we can ignore it.</p>
  
  <p>The difficulty to me is how to save the results for the calculated intersection.</p>
  
  <p>So I'm trying to find the intersection iteratively, but the compiler keeps outputting <code>vector iterators incompatible</code>.
  The basic thought is: first I find the intersection of first two, then I save the intersection result and <code>set_intersection</code> with the third one, etc. But it seems not to work, which is really confusing.</p>