标准模板10

#include<functional>
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
using namespace placeholders;
int main()
{
int intArr[]={30,90,10,40,70,50,20,80};
const int N=sizeof(intArr)/sizeof(int);
vector<int>a(intArr,intArr+N);
auto p=find_if(a.begin(),a.end(),bind(greater<>(),_1,40));
if(p==a.end())
cout<<"no element greater than 40"<<endl;
else
cout<<"first element greater than 40 is: "<<*p<<endl;
return 0;
}

posted @ 2023-05-12 20:48  不会JAVA的小袁  阅读(3)  评论(0编辑  收藏  举报