map::erase() does not return an iterator. It returns nothing unless you call the version that erases all occurrences of a specific value, which returns a count. You've been using an implementation of erase() specific to visual studio, apparently.