Weird seg fault when erasing from a map
<p>I have the following code:</p>

<pre><code>//update it in the map
      std::map&lt;std::string, std::string&gt;::iterator it;
      for(it = spreadsheets.at(i).cells.begin(); it != spreadsheets.at(i).cells.end(); ++it)
      {
        if(it-&gt;first == change.first)
        {
          if(change.second == "")
          {
            spreadsheets.at(i).cells.erase(change.first);
          }
          else
          {
          it-&gt;second = change.second;
          }
        }
      }
</code></pre>

<p>The code above <strong>runs perfectly on my mac</strong> however when I <strong>run in on a linux computer</strong> it throws a seg fault on <code>spreadsheets.at(i).cells.erase(change.first);</code></p>

<p>Any idea whats causing this error? Ive tried changing <code>erase(change.first)</code> to <code>erase(it)</code> and I am still getting the seg fault.</p>
