string::npos

https://leetcode-cn/u/zhou-zhou-zhou-6/

https://leetcode-cn/u/muten/

https://leetcode-cn/u/zerotrac2/

中文C++手册官网

https://leetcode-cn/u/gemj/

1.map容器的元素插入


方法1:
map<int, int> maps;
maps.insert(pair<int, int> (10, 15));
方法2:
map<int, int> maps;
maps.insert(make_pair(10, 15));
方法3:
map<int, int> maps;
typedef pair<int, int> Int_Pair;
maps.insert(Int_pair(10, 15));
方法4:
map<int, int> maps;
int key = 1;
int value = 2;
maps[key] = value;

 2.查找map中是否存在某个key

map<string,string>::iterator iter;
iter = mapRecv.find("CmdID");
if(iter == mapRecv.end())
{
   cout << "没有找到相关key" << endl;
}

3.常用debug日志

更多推荐

C++代码大全