title: Referencing a Value from a Nested Pair in a Map
body: <p>I have a map which contains an int and a nested pair of two strings: </p>
  
  <pre><code>map&lt;int, pair&lt;string, string&gt; &gt; books;
  </code></pre>
  
  <p>I also have a vector of strings. </p>
  
  <pre><code>vector&lt;string&gt; returned;  
  </code></pre>
  
  <p>And the two iterators which accompany them: </p>
  
  <pre><code>vector&lt;string&gt; returned::iterator it2; 
  map&lt;int, pair&lt;string, string&gt; &gt;::iterator it3; 
  </code></pre>
  
  <p>I am trying to access the first string of the pair which is nested in the map to compare it to the current string of the vector "returned". I am using two iterators to do this. However, I cannot seem to access the first string of the nested pair.  </p>
  
  <pre><code>//PUT BACK BORROWED BOOKS    
  for (it2 = returned.begin(); it2 != returned.end(); it2++){ 
      //SEARCH FOR POSITION OF BOOK 
      for (it3 = books.begin(); it3 != books.end(); it3++){   
                      //PROBLEM IN LINE BELOW
          if(it2 == (it3-&gt;second-&gt; first)) 
              int bookPos = it3 -&gt; first;  
  
  
      }
  }
  </code></pre>
  
  <p>Does anyone know how to reference this first string in the pair? Obviously "it->second-> first" is not the solution.  </p>
  
  <p>Thanks in advance.</p>