counting frequency of integers take together
<p>I need to count the frequencies of different integers together in a binary file, how can I do this? I do not wish to convert to string, because that would slow down my program down.. I think...</p>

<pre><code>vector&lt;uint32_t&gt; buf(2);
map&lt;uint32_t, uint32_t&gt; mymap;

if(file.is_open())
{
    while (file.read(reinterpret_cast&lt;char*&gt;(&amp;buf[0]), sizeof(uint32_t)*numcols))
    {
        for(size_t i = 0; i &lt; numcols; ++i)
        {
            mymap[buf[i]]++; // **---&gt; I need help here**
        }
    }
}
file.close();
</code></pre>

<p>How can I make the key to the map so that it always counts those integers together</p>

<p>Yep.. how many times I see integer pairs consecutively, like how many times (1,2), or (8, 14), or (7,3).</p>

<pre><code>1 2
1 2
7 3
8 14
8 14
8 14

1 2 --&gt; 2 times
7 3 --&gt; 1 time
8 14 --&gt; 3 times
</code></pre>

<p>numcols == 2 correct.</p>
