title: C++ unordered map with uint8_t
body: <p>I'm having a strange problem using an unordered_map with key type <code>uint64_t</code> and value type <code>uint8_t</code>. (I have a few potentially large integers that I want to count with the <code>uint8_t</code> values.) Here's some code:</p>
  
  <pre><code>std::unordered_map&lt;uint64_t,uint8_t&gt; mymap;
  mymap.emplace(2,1);
  mymap.emplace(20,3);
  mymap.emplace(200,34);
  
  for (auto it = mymap.begin(); it != mymap.end(); ++it) {
      std::cout &lt;&lt; it-&gt;first &lt;&lt; ":" &lt;&lt; it-&gt;second &lt;&lt; std::endl;
      printf("%lld : %d\n", it-&gt;first, it-&gt;second);
  }
  </code></pre>
  
  <p>It appears that the keys and values are saved perfectly fine in the <code>unordered_map</code>. But, the <code>std::cout &lt;&lt; it-&gt;second &lt;&lt; std::endl;</code> code is garbling the output of the <code>uint8_t</code> values. That is,  <code>cout</code> (the first line in the for loop) garbles the output, while the old school cstdio <code>printf</code> (the second line in the for loop) prints out the values just fine. Weird. Any idea as to what is happening here?</p>
  
  <p>If I change the <code>unordered_map</code> to <code>&lt;uint64_t,uint16_t&gt;</code> or <code>&lt;uint64_t,int&gt;</code>, it works perfectly fine. I've tried various terminal and pseudo terminal environments plus text files, all with garbled or missing outputs for the <code>uint8_t</code>s. I'm stumped.</p>
  
  <p>Here is the output:</p>
  
  <pre><code>20:
  20 : 3
  200:"
  200 : 34
  2:
  2 : 1
  </code></pre>