1,map.find的返回值:
map<int,int> m;
m.insert({1,2});
auto it = m.find(1);
if(it != m.end()){
cout << it->first << " " << it->second;
}
返回值为迭代器,找不到时返回m.end()。
2,string.find的返回值:
string s="abcd";
auto pos = s.find("bc"); //返回值为下标位置
if(pos != string::npos){ //不存在返回string::npos
cout << pos;
}