# include <iostream>
# include <vector>
# include <algorithm>
using namespace std;
template <typename numberType>
struct IsMultiple{
numberType m_Divisor;//几的倍数
//构造函数
IsMultiple(const numberType& divisor){
m_Divisor = divisor;
}
bool operator()(const numberType& element) const{//一元谓词
return ( ( element % m_Divisor ) == 0 );
} //判断被 divisor整除数
};
int main(){
vector<int> vecIntegers;
for(int i=22;i<=100;i++){
vecIntegers.push_back(i);
}
IsMultiple<int> a(3);// m_Divisor=3
//第一个被3整除的书
vector<int>::iterator iElement;
iElement = find_if(vecIntegers.begin(),vecIntegers.end(),a);
// iElement = find_if(vecIntegers.begin(),vecIntegers.end(),IsMultiple<int> (3) ); //IsMultiple<int> (3)匿名独享
if(iElement!=vecIntegers.end()){
cout<<*iElement<<endl;
}
return 0;
}