#include <iostream>
#include <map>
int main(int argc, char** argv) {
std::map<int, int> tMap ;
tMap[1] = 100 ;
tMap[2] = 200 ;
tMap[3] = 300 ;
tMap[1] = 111 ; // 已经有相同的key了 强制覆盖 tMap[1] == 111
tMap.insert(std::make_pair(1, 111111)) ; // 已经有相同的key了 插入不进去了 tMap[1] == 111
return 0 ;
}
map的两种插入方式
最新推荐文章于 2025-02-12 21:16:32 发布