C ++ this(在这种情况下将是当前类的链接)

所以有:
struct A { void foo(int) { } }; 

typedef std::function<void(int)>   Function;
typedef std::vector<Function>      FunctionSequence;
typedef FunctionSequence::iterator FunctionIterator;

FunctionSequence funcs;

A a;

funcs.push_back(std::bind(&A::foo, &a, std::placeholders::_1));
funcs.push_back(std::bind(&B::bar, &b, std::placeholders::_1));

// this calls a.foo(42) then b.bar(42):
for (FunctionIterator it(funcs.begin()); it != funcs.end(); ++it)
    (*it)(42);
如果我们在课堂上
A
订阅
funcs.push_back
,我们会说而不是
&a
this
    
已邀请:
如果我理解你的问题,答案应该是肯定的。
&variable
总是等于
this
,如通过
variable
调用的实例方法所见。     
是的,这听起来合乎逻辑,但这只是猜测。 从
A
里面订阅,你想将回调存储到这个特定的
A
实例。如果是,那么你需要
this
。 我们不知道您的需求,我可以想象所有三种变体(
&a
&b
this
)都是正确的情况。     

要回复问题请先登录注册