#include <iostream>
#include <functional>
#include <iterator>
#include <vector>
#include <algorithm>
using namespace std;
class fun1{
int a;
int b;
public:
fun1(int x,int y):a(x),b(y){}
int get_x(){return a;}
int get_y(){return b;}
void show(){cout<<"a: "<<a<<"b: "<<b<<endl;}
};
bool comp(fun1 &a)
{
if((a.get_x()==2)&&(a.get_y()==3))
return true;
else return false;
}
int main()
{
vector<fun1>coll;vector<fun1>coll2;
coll.push_back(fun1(2,3));
coll.push_back(fun1(12,23));
coll.push_back(fun1(23,22));
int num=count_if(coll.begin(),coll.end(),comp);
#include <functional>
#include <iterator>
#include <vector>
#include <algorithm>
using namespace std;
class fun1{
int a;
int b;
public:
fun1(int x,int y):a(x),b(y){}
int get_x(){return a;}
int get_y(){return b;}
void show(){cout<<"a: "<<a<<"b: "<<b<<endl;}
};
bool comp(fun1 &a)
{
if((a.get_x()==2)&&(a.get_y()==3))
return true;
else return false;
}
int main()
{
vector<fun1>coll;vector<fun1>coll2;
coll.push_back(fun1(2,3));
coll.push_back(fun1(12,23));
coll.push_back(fun1(23,22));
int num=count_if(coll.begin(),coll.end(),comp);
for_each(coll.begin(),coll.end(),mem_fun_ref(&fun1::show));
return 0;
}