だから持つ:C++この(何がこのような状況で、現在のクラスへのリンクになります)
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);
我々はfuncs.push_back
加入クラスA
内だったら、私は理解している場合、我々は代わりに&a
this
あなたがC++ 0xのであれば、ラムダ式を使用します。 – Puppy