Quote Originally Posted by aryan1
The purpose is to transform the above code into one so that entries meeting a certain condition can be erased from map on one pass.
I shall paraphrase the example that I often refer to, from Josuttis' The C++ Standard Library:
Code:
for (it = temp.begin(); it != temp.end();)
{
    if (condition)
    {
         temp.erase(it++);
    }
    else
    {
        ++it;
    }
}