<p>Suppose I have a hash_map and a code like</p>

<pre><code>// i is an iterator
i = hash_map.erase(i)
</code></pre>

<p>But GCC's STL doesn't return iterator in erase, but a void. Now is a code like</p>

<pre><code>hash_map.erase(i++)
</code></pre>

<p>safe (i.e. does not invalidate the iterator or does any other unexpected or unpleasant things)? Please note this is a hash_map.</p>

Yes, this is safe, because the value of
```
i
```
will have been set to the next value, before the current value is erased.
According to the
SGI documentation about hashed containers
invalidation does not occur for non-erased elements, nor even for resizing (there is no word on whether insertions cause resizing, so to be careful I admit that as a possibility)---but in the latter case, the iteration order will be changed. But this doesn't apply here, unless you go out of your way to resize the container during traversal or something. :-)