I have a map<string, vector<record>>, how to remove records from vector<record>?
<p>I have tried all possibilities I could, and failed to find solution. Please help</p>

<p>I want to remove records in vector in map while iterating over it.<br></p>

<pre><code>
map &lt string, vector &lt record> >::iterator map_it;
for(map_it = map_records.begin(); map_it != map_records.end(); ++map_it){
    vector &lt record>::iterator vec_it;
    for(vec_it = (*map_it).second.begin(); vec_it != (*map_it).second.end();){
        if(condition){
            cout &lt&lt (*map_it).second.size() &lt&lt endl;
            vec_it = map_it->second.erase(vec_it);
            cout&lt&lt (*map_it).second.size()&lt&lt endl;
        } else {
            ++vec_it;
        }
    }
}
</code></pre>

<p>I tried something like this,<br>
<code>(*map_it).second.erase(vec_it)</code><br>
It give some long number if I query the size of it and program ends with segmentation fault</p>

<p>OUTPUT:<br>
18446744073709551615<br>
18446744073709551615<br>
Segmentation fault</p>

<p>Any help appreciated </p>
