I wanted to create a function for a class method from a specific instance. As in the example, I'd like to create a function for this->x
.
class A {
public:
void x(int p) { }
void y() {
function<void(int)> f = std::tr1::bind(
&A::x,
this,
std::tr1::placeholders::_1);
}
};
When I tried to compile this, I got very long error messages. One of them that might make some sense is note: no known conversion for argument 1 from ‘int’ to ‘int&’