title: Most efficient way to use C++11 unordered_map in a read/write
body: <p>In a part of my program, I want to update a given value of an <code>unordered_map</code>. The problem can be simplified like this:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;unordered_map&gt;
  #include &lt;string&gt;
  int main(int argc, char **argv) {
      std::unordered_map &lt;unsigned long, int&gt; map;
      unsigned long i = 1;
      std::string s;
      while (i != 0) {
          std::cout &lt;&lt; "Give me an unsigned long" &lt;&lt; std::endl;
          std::cin &gt;&gt; s;
          i = strtoul(s.c_str(), NULL, 0);
          if (map.find(i) == map.end()) map[i] = 1;
          else if (map[i] &lt; static_cast&lt;unsigned long&gt;(-1)) map[i] += 1;
      }
  }
  </code></pre>
  
  <p>(Of course, my program does not store user input data, it is just for illustration purposes. My program actually stores integer-encoded strings on a 4-letter alphabet. I need hashes, and not trees, to do so.)</p>
  
  <p>As you see, I need to check the presence of a key, and update it. Since I am storing more than 1 billion integers, I would like to know the most efficient way to do so.</p>
  
  <p>I saw <a href="https://stackoverflow.com/questions/6897737/using-the-operator-efficiently-with-c-unordered-map">this related question</a>, but it does not mention value update.</p>
  
  <p>Many thanks to you all.</p>