I have read here about how boost:bind works, especially that it - besides other things - generates something like this:
struct unspecified_type
{
... some members ...
return_type operator()(int i) const { return instance->*&klass::member(0, i);
}
Now, I'm looking for something which would allow to add an additional indirection to the instance pointer, so that it ultimatively would look like this:
struct unspecified_type
{
... some members ...
return_type operator()(int i) const { return (*p_instance)->*&klass::member(0, i);
}
and could be used like
MyClass* pmc;
auto mfp = boost::bind(&MyClass::some_func, &pmc);
pmc = new MyClass();
mfp();
pmc = new MyClass();
mfp();