When I compile this in Visual Studio 2008, I get the following error:
binary '=' : no operator found which takes a right-hand operand of type 'std::_Tree<_Traits>::const_iterator' (or there is no acceptable conversion)
I do not get this error if I pass by value. The map in question is pretty small, so this won't be too bad, but I don't understand why I get the error in the first place.
The const_iterator suggestion covered it. (I had actually prepended the std namespace in the actual code, but forgot to include it when I transcribed it here.