#include <iostream>
#include <string>
#include <tr1/functional>
struct A {
A(const std::string& n) : name_(n) {}
void printit(const std::string& s)
{
std::cout << name_ << " says " << s << std::endl;
}
private:
const std::string name_;
};
int main()
{
A a("Joe");
std::tr1::function<void(const std::string&)> f = std::tr1::bind(&A::printit, &a, std::tr1::placeholders::_1);
f("Hi");
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8c3RyaW5nPgojaW5jbHVkZSA8dHIxL2Z1bmN0aW9uYWw+CgpzdHJ1Y3QgQSB7CiAgICBBKGNvbnN0IHN0ZDo6c3RyaW5nJiBuKSA6IG5hbWVfKG4pIHt9CiAgICB2b2lkIHByaW50aXQoY29uc3Qgc3RkOjpzdHJpbmcmIHMpIAogICAgewogICAgICAgIHN0ZDo6Y291dCA8PCBuYW1lXyA8PCAiIHNheXMgIiA8PCBzIDw8IHN0ZDo6ZW5kbDsKICAgIH0KcHJpdmF0ZToKICAgIGNvbnN0IHN0ZDo6c3RyaW5nIG5hbWVfOwp9OwoKaW50IG1haW4oKQp7CiAgICBBIGEoIkpvZSIpOwogICAgc3RkOjp0cjE6OmZ1bmN0aW9uPHZvaWQoY29uc3Qgc3RkOjpzdHJpbmcmKT4gZiA9IHN0ZDo6dHIxOjpiaW5kKCZBOjpwcmludGl0LCAmYSwgc3RkOjp0cjE6OnBsYWNlaG9sZGVyczo6XzEpOwogICAgZigiSGkiKTsKfQo=