map<string, int>::key_type v1;//v1 string map<string, int>::value_type v2;//v2 pair<const string,int>
为何后者的key_type 是const?而 mapped_type 又不是const?
学习是最好的投资!
Because you cannot change the key of a K/V pair that has been added to the Map, you can only change the value. If you want to make changes to the key, you can only delete this one and add a new one.
Because you cannot change the key of a K/V pair that has been added to the Map, you can only change the value.
If you want to make changes to the key, you can only delete this one and add a new one.