C++ STL 算法:查找算法(4)find_first_of

来源:互联网 发布:windows 挂载iOS 编辑:程序博客网 时间:2024/06/17 20:24
1、find_first_of(b,e,sb,se)
例:find_first_of(ivec.begin(),ivec.end(),searchList.begin(),searchList.end());
cout << "找到了! 位置: " << distance(ivec.begin(), pos) + 1 << endl;
2、find_first_of(b,e,sb,se,bp)
3、没有find_last_of算法,只能使用逆向迭代器
vector<int>::reverse_iterator rpos = find_first_of(ivec.rbegin(), ivec.rend(),searchList.begin(),searchList.end());
cout << "找到的位置: " << distance(ivec.begin(),rpos.base()) << endl;//这里不用加1


0 0
原创粉丝点击