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;
}
因篇幅问题不能全部显示,请点此查看更多更全内容
Copyright © 2019- bangwoyixia.com 版权所有 湘ICP备2023022004号-2
违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com
本站由北京市万商天勤律师事务所王兴未律师提供法律服务