#include <iostream>
#include <vector>
#include <boost/bind.hpp>
#include <algorithm>
struct Person {
std::string name;
Person(const std::string& n) : name(n) {}
std::string getName() const { return name; }
};
int main()
{
std::vector<Person*> vec;
vec.push_back(new Person("Arthur"));
vec.push_back(new Person("Chad"));
vec.push_back(new Person("Chad"));
ptrdiff_t num_chads = std::count_if(vec.begin(), vec.end(),
boost::bind(&Person::getName, _1) == "Chad");
std::cout << "There are " << num_chads << " chads\n";
delete vec[0]; delete vec[1]; delete vec[2];
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8dmVjdG9yPgojaW5jbHVkZSA8Ym9vc3QvYmluZC5ocHA+CiNpbmNsdWRlIDxhbGdvcml0aG0+CnN0cnVjdCBQZXJzb24gewogICAgICAgIHN0ZDo6c3RyaW5nIG5hbWU7CiAgICAgICAgUGVyc29uKGNvbnN0IHN0ZDo6c3RyaW5nJiBuKSA6IG5hbWUobikge30KICAgICAgICBzdGQ6OnN0cmluZyBnZXROYW1lKCkgY29uc3QgeyByZXR1cm4gbmFtZTsgfQp9OwoKaW50IG1haW4oKQp7CiAgICAgICAgc3RkOjp2ZWN0b3I8UGVyc29uKj4gdmVjOwogICAgICAgIHZlYy5wdXNoX2JhY2sobmV3IFBlcnNvbigiQXJ0aHVyIikpOwogICAgICAgIHZlYy5wdXNoX2JhY2sobmV3IFBlcnNvbigiQ2hhZCIpKTsKICAgICAgICB2ZWMucHVzaF9iYWNrKG5ldyBQZXJzb24oIkNoYWQiKSk7CgogICAgICAgIHB0cmRpZmZfdCBudW1fY2hhZHMgPSBzdGQ6OmNvdW50X2lmKHZlYy5iZWdpbigpLCB2ZWMuZW5kKCksCiAgICAgICAgICAgICAgICAgICAgICAgIGJvb3N0OjpiaW5kKCZQZXJzb246OmdldE5hbWUsIF8xKSA9PSAiQ2hhZCIpOwoKICAgICAgICBzdGQ6OmNvdXQgPDwgIlRoZXJlIGFyZSAiIDw8IG51bV9jaGFkcyA8PCAiIGNoYWRzXG4iOwogICAgICAgIGRlbGV0ZSB2ZWNbMF07IGRlbGV0ZSB2ZWNbMV07IGRlbGV0ZSB2ZWNbMl07Cn0K