使std :: map key const有意义吗? [英] Does it make sense to make std::map key const?
本文介绍了使std :: map key const有意义吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当定义 std :: map
时,是否有必要使键类型 const
?
When defining a std::map
, does it make sense to make the key type const
?
推荐答案
实际上,键已经是 const
,因为键不能改变一次
The key is already const
, actually, because a key cannot change once an element was inserted in the map.
这篇关于使std :: map key const有意义吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文