solve cppcheck defect (preincrement preferred over postincrement) through use of range based for over map.