Can't delete a record from map
<pre><code>string* Foooood::topFiveFoo(){    
    std::map&lt;std::string, unsigned long&gt; volumes;
    typedef std::map&lt;std::string, unsigned long&gt;::iterator it_type;

    for(i=0;i&lt;nTransactions;i++){
        volumes[tDeque.at(i).fooSymbol] += tDeque.at(i).fooShares;
    }

    string top;
    string result[5];
    int check = 0;

    for(i=0;i&lt;5;i++){
        for(it_type iterator = volumes.begin(); iterator != volumes.end(); iterator++) {
            if(iterator-&gt;second &gt; check){
                top = iterator-&gt;first;
                check = iterator-&gt;second;
            }

            result[i] = top;
            volumes.erase(top);
        }
    }
    return new string[5];
}
</code></pre>

<p>I have only learned about maps less than 12 hours ago, so I am still very confused.<br>
I keep getting the error: "Debug Assertion Failed!" ..... "Expression:map/set iterator not incrementable"  </p>

<p>In my head if I find the top value, store it in the array and then delete it from the map, I will be able to repeat this and generate a top 5 list!?? But I can't delete the top value and I can't figure out why.</p>
