title: checking if key exist in map then updating value
body: <p>In my project I want to insert keys to a map. All new keys should get the value 1.0, but existing keys should be incremented by 1.</p>
  
  <p>Here's the code</p>
  
  <pre><code>vector &lt;string&gt; pairs; 
  map&lt;string, float&gt; two;
  map &lt;string, float&gt;::iterator it;
  
  string a = "a";
  string b = "b";
  string c = "a";
  
  pairs.push_back(a);
  pairs.push_back(b);
  pairs.push_back(c);
  
  for(int i=0; i&lt;pairs.size(); i++)
  {
      it = two.find(string(pairs[i]) );
      if(i==0)
      {
          two[string(pairs[i])]=1.0;
      }
      else if ( it == two.end() ) 
      {
          it-&gt;second = it-&gt;second + 1.0;
      //after this line ^,my compiler stop working
      }
      else
      {
          two[string(pairs[i])]=1.0;
      }
  }
  </code></pre>
  
  <p>After this, the object should be</p>
  
  <pre><code>a  2
  b  1
  </code></pre>
  
  <p>How can I do so.</p>