title: Accessing a nested pair
body: <p>To take apart a pair, the following can be done</p>
  
  <pre><code>boost::bind(&amp;std::pair::second, _1); // returns the value of a pair
  </code></pre>
  
  <p>What about using combinations of different containers, how can a nested pair be accessed?</p>
  
  <p>For example when I wanted to partition a vector into items contained in a supplemental map and items that where not contained in the supplemental map I used the following: </p>
  
  <pre><code>typedef int DWORD; typedef std::pair&lt;std::string, bool&gt; user_info; 
  typedef std::map&lt;DWORD, user_info&gt; USER_MAP; 
  typedef std::vector&lt;DWORD&gt; VEC_STAFF; 
  VEC_STAFF::iterator it = std::partition(
     Staff.begin(), Staff.end(), 
    (bind(&amp;USER_MAP::find, m_Users, _1) != m_Users.end()));
  </code></pre>
  
  <p>Now I have a second problem - during the running of the application the status bool of user_info can change, and later on I want to re-partition the vector with items that have a status bool of true rather than just being contained in the supplemental map.</p>
  
  <p>However I seem to have a problem accessing the second item of a nested pair.</p>
  
  <p>I tried the following but I cannot seem to access the nested pair!</p>
  
  <pre><code>VEC_STAFF::const_iterator itCurEnd = partition(Staff.begin(), Staff.end(),
       bind(&amp;USER_MAP::value_type::second::second, 
       bind(&amp;USER_MAP::find, &amp;m_Users, _1)) == true);
  </code></pre>