title: C++ pair data type issue
body: <p>I am writing a friend recommendation algorithm and in a part I have to store 350 random friendship using the data type <code>std::pair</code> in C++. I basically use an adjacency list (implemented as <em>vector of vectors</em>). I create a vector that stores data type <code>pair&lt;int,int&gt;</code>. I select a random value from the adjacency list and select one of it's friends randomly, however, even though I'm quite sure that I push the data type as pair however I cannot iterate through it.</p>
  
  <p>What could be the possible reason?</p>
  
  <pre><code>int FRIENDS_AND_UNFRIENDS_TO_STORE=350,randomNode=rand()%adjacencyList.size(),randomFriend;
  vector&lt; pair&lt;int,int&gt; &gt;listForPR;
  listForPR.resize(FRIENDS_AND_UNFRIENDS_TO_STORE*2);
  
  for(int i=0;i&lt;FRIENDS_AND_UNFRIENDS_TO_STORE;i++) {
      while(adjacencyList[randomNode].size()&lt;1)
          randomNode=rand()%adjacencyList.size();
      randomFriend=rand()%adjacencyList[randomNode].size();
      listForPR.push_back(make_pair(randomNode,adjacencyList[randomNode][randomFriend]));
  }
  
  for(int i=0;i&lt;350;i++)
      cout&lt;&lt;"Node #"&lt;&lt;listForPR[i].first&lt;&lt;" &amp; It's Friend: "&lt;&lt;listForPR[i].second&lt;&lt;endl;
  </code></pre>
  
  <p>Added this and !mysteriously solved the problem;</p>
  
  <pre><code>for(int i=0;i&lt;FRIENDS_AND_UNFRIENDS_TO_STORE;i++) {
      while(adjacencyList[randomNode].size()&lt;1)
          randomNode=rand()%adjacencyList.size();
      randomFriend=rand()%adjacencyList[randomNode].size();
      pair&lt;int,int&gt; temp=make_pair(randomNode,adjacencyList[randomNode][randomFriend]);//added
      listForPR.push_back(temp);
  }
  </code></pre>