<h3>Duplicate:</h3>
<blockquote>
<p><a href="https://stackoverflow.com/questions/263945/what-happens-if-you-call-erase-on-a-map-element-while-iterating-from-begin-to-e">What happens if you call erase on a map element while iterating from begin to end</a></p>
<p><a href="https://stackoverflow.com/questions/180516/how-to-filter-items-from-a-stdmap">How to filter items from a stdmap</a><br></p>
</blockquote>
<p>I have a map <code>map1&lt;string,vector&lt;string&gt;&gt;</code> i have a iterator for this map &quot;itr&quot;.
i want to delete the entry from this map which is pointed by &quot;itr&quot;.
i can use the function map1.erase(itr); after this line the iterator &quot;itr&quot; becomes invalid.
as per my requirement in my project,the iterator must point to the next element. can any body help me regerding this
thans in advance:)
santhosh</p>

```
```
map<...>::iterator tmp(iter++);
map1.erase(tmp);
```
```