The problem is that with std::map, the [] operator will insert the key if it is not already in the map. I.e., the [] operator cannot be called on a const map.

Look here for more info:...