resetting a global iterator to a list 
<pre><code>#include&lt;list&gt;
#include&lt;iostream&gt;

using namespace std;

list&lt;int&gt; DL,TRS;
list&lt;int&gt;::iterator gitr;

void exchange();

int main() {
  DL.push_back(10);
  gitr=DL.begin();
  TRS.push_back(11);
  TRS.push_back(12);
  exchange();
  cout&lt;&lt;(*gitr)&lt;&lt;endl;
}

void exchange() {
  list&lt;int&gt; tdl;
  tdl=DL;
  DL.clear();
  DL=TRS;
  list&lt;int&gt;::iterator tmpitr=DL.begin();
  for(;tmpitr!=DL.end();++tmpitr)
     cout&lt;&lt;(*tmpitr)&lt;&lt;endl;
  DL.clear();
  DL=tdl;
}
</code></pre>

<p>This outputs 11 instead of 10. Why?</p>
