boost:bind原理
时间:2011-03-14 来源:BruceChan
一、获取类的成员方法
class Foo { public: void run(){ cout<<"Foo run;"<<endl; } }; void (Foo::*p)() = &Foo::run;
Foo foo;
(foo.*p)();
二、模板化
template <class T>void call(void(T::*p)(),T t)
{
(t.*p)();
}
Foo foo;
call(&Foo::run,foo);
未完待续。。。
相关阅读 更多 +
排行榜 更多 +