find_end,find_first_of
来源:互联网 发布:虚拟试衣淘宝 编辑:程序博客网 时间:2024/05/18 02:02
直接代码:
#include<iostream>#include<string>#include<vector>#include<algorithm>using namespace std;int main(){int a[]={1,2,3,4,5,6,7,8,9,10,1,2,3,4,5,6,7,8,9,10};vector<int>v(a,a+20);vector<int>vv(a+3,a+8);vector<int>::iterator end=v.end();vector<int>::iterator it;it=find_end(v.begin(),v.end(),vv.begin(),vv.end());while(it!=end){cout<<"found "<<distance(v.begin(),it)<<endl;end=it;it=find_end(v.begin(),end,vv.begin(),vv.end());}system("pause");return 0;}
#include<iostream>#include<string>#include<vector>#include<algorithm>#include<functional>using namespace std;int main(){int a[]={1,2,3,4,5,6,7,8,9,10};vector<int>v(a,a+10);vector<int>vv(a+3,a+8);vector<int>::iterator it=find_first_of(v.begin(),v.end(),vv.begin(),vv.end());//cout<<distance(v.begin(),it)<<endl;//cout<<*it<<endl;while(it!=v.end()){cout<<"found"<<distance(v.begin(),it)<<endl;++it;it=find_first_of(it,v.end(),vv.begin(),vv.end());}system("pause");return 0;}
#include<iostream>#include<string>#include<vector>#include<algorithm>#include<functional>bool chenger(int a,int b){return a*2==b;}using namespace std;int main(){int a[]={1,2,3,4,5,6,7,8,9,10};vector<int>v(a,a+10);vector<int>vv(a+3,a+8);for(vector<int>::iterator ite=vv.begin();ite!=vv.end();++ite){cout<<*ite<<" ";}cout<<endl;vector<int>::iterator it=find_first_of(v.begin(),v.end(),vv.begin(),vv.end(),chenger);cout<<*it<<endl;system("pause");return 0;}
#include<iostream>#include<string>#include<vector>#include<algorithm>#include<functional>using namespace std;int main(){int a[]={1,2,3,4,5,6,7,8,9,10};vector<int>v(a,a+10);vector<int>vv(a+3,a+8);vector<int>::iterator first;vector<int>::reverse_iterator last;first=find_first_of(v.begin(),v.end(),vv.begin(),vv.end());last=find_first_of(v.rbegin(),v.rend(),vv.begin(),vv.end());cout<<"the first location: "<<distance(v.begin(),first)<<endl;cout<<"the last locatioin: "<<distance(v.begin(),last.base())<<endl;system("pause");return 0;}
- find_end,find_first_of
- STL 之find,find_if,find_end,find_first_of
- STL 之find,find_if,find_end,find_first_of
- find()、find_end()、find_first_of()、find_if()的使用示例和区别
- find_end
- find_end
- 非变异算法之查询( find(), find_if(), find_first_of, adjacent_find(), find_end(), search(), search_n() )
- find_first_of
- find_first_of
- find_first_of
- find_first_of
- find_first_of
- find_first_of
- 实战c++中的vector系列--vector应用之STL的find、find_if、find_end、find_first_of、find_if_not(C++11)
- algorithm-find_end
- find_end详解
- search & find_end
- find_end, search
- 关于windowsphone中的toast消息推送的小结
- I NEED A OFFER! (0-1背包的乘法)
- search,search_n
- Ubuntu 12.04 LTS 中文txt文件显示乱码问题
- Android多媒体开发(5)————利用Android AudioTrack播放mp3文件
- find_end,find_first_of
- 设计题总结
- poj 1436 Horizontally Visible Segments 线段树求垂直三角形的个数
- C++内存 内存对齐
- 传智播客成都中心“基础加强班”优惠活动最后一期,立马围观。
- 归并排序
- 从一列数中筛除尽可能少的数,使得从左往右看这些数是从小到大再从大到小
- 《纠结学习C++还是Java》之《如何学好java》
- adjacent_find,equal