64,654
社区成员
发帖
与我相关
我的任务
分享
#include <iostream>
#include <functional>
#include <algorithm>
using namespace std;
int main () {
int numbers[] = {10,20,30,40,50,10};
int cx;
cx = count_if (numbers, numbers+6, bind1st(equal_to<int>(),10) );
cout << "There are " << cx << " elements that are equal to 10.\n";
return 0;
}
这里有个配接器的例子。bind1st