title: c++ vector of pairs of pointers screw up
body: <p>so I have a vector of pairs of pointers in c++:</p>
  <pre><code>vector&lt;pair&lt;Move *,Piece *&gt; &gt; moveList;
  </code></pre>
  <p>where Move is an object and Piece is an object...
  Piece has the class variables type and side</p>
  <p>so I add stuff to moveList:</p>
  <pre><code>    pair &lt;Move *, Piece *&gt; pr (&amp;m,&amp;(p));
  
  
      moveList.push_back(pr);
  </code></pre>
  <p>where m is a Move object and p is a Piece object</p>
  <p>but whenever I call the moveList.back(), method, for some reason it would modify the values of Piece</p>
  <p>so I do</p>
  <pre><code>Move * j = moveList.back().first;
  </code></pre>
  <p>Piece should have its &quot;type&quot; variable's value set to 'X'</p>
  <p>but when I debug, it turns out that right after the line above, for some reason, Piece's &quot;type&quot; variable's value gets set to some crazy number such as -56 '\310'.....</p>
  <p>what am I doing wrong?</p>
  <h2>EDIT</h2>
  <p>also moveList is set as a class variable</p>
  <p>and the pushing into moveList and the getting the back() of moveList were done on different methods in that class</p>