Does it make sense to make std::map key const? [du

2019-01-26 16:03发布

问题:

This question already has an answer here:

  • What is difference between const and non const key? 7 answers

When defining a std::map, does it make sense to make the key type const?

回答1:

The key is already const, actually, because a key cannot change once an element was inserted in the map.



标签: c++ map const