In this program, I want to understand the following issues.
(i) how should iter->first or iter->second behave when the container size is zero. Is it risky , is it defined, undefined.
(ii) On linux machine, I see a hang in the second last line
i.e. iter = iter++ , Any idea why....??
When the container is empty begin() == end(). You should never dereference the iterator returned by end(). It should only be used to compare with other iterators to know that you have reached the end. What you are doing is undefined.