#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <ext/functional>
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(),
                       __gnu_cxx::compose1(
                          std::bind2nd(std::equal_to<std::string>(), "Chad"),
                          std::mem_fun(&Person::getName)));

        std::cout << "There are " << num_chads << " chads\n";
        delete vec[0]; delete vec[1]; delete vec[2];
}
