title: How i can return a std::map containing the differences of two maps in c++?
body: <p>i have two maps and i need to find the differences and create a new map that only has the differences. Not sure how to do this. I tried using set_difference but don't really understand how it works. Any help would be appreciated. thanks </p>
  
  <pre><code>// header file
  typedef std::map&lt;std::string, int&gt; MapCol;
  typedef std::map&lt;std::string, MapCol&gt; MapRow;
  MapRow m_mapRows;
  
  //.cpp fle
  CheckForDifferences( const Table&amp; rhs )
  {
      Table diffTable;
      vector&lt;string&gt; v;                           
      vector&lt;string&gt;::iterator it;
      it=set_difference (m_mapRows.begin(), m_mapRows.end(), diffTable.m_mapRows.begin(), diffTable.m_mapRows.end, v.begin());
  }
  </code></pre>
  
  <p>edit:</p>
  
  <pre><code>std::set_difference( m_mapRows.begin(), m_mapRows.end(),
  rhs.m_mapRows.begin(), rhs.m_mapRows.end(), diffTable.m_mapRows.begin());
  </code></pre>
  
  <p>ok this is what i tried, but i get errors, the first one being
   error C2678: binary '=' : no operator found which takes a left-hand operand of type 'const std::string' (or there is no acceptable conversion)</p>
  
  <p>any ideas?</p>