是否有可能在c ++调用类方法中显式传递第一个"this"参数呢?
像这样的东西:
struct A
{
void some() {}
};
....
A a;
A::some(&a); // ~ a.some();
Run Code Online (Sandbox Code Playgroud)
对于合理的问题"为什么?":我需要实现std :: bind analogue,它适用于这样的结构:
void f(int);
bind(f, 3);
Run Code Online (Sandbox Code Playgroud)
但这不起作用:
bind(&A::some, &a);
Run Code Online (Sandbox Code Playgroud)
更新: 大家好,我的问题显然不是很清楚.我知道如何使用std :: bind,我想知道如何处理这个param显式传递给它的构造:std :: bind(&A :: some,&a);