64,644
社区成员
发帖
与我相关
我的任务
分享
template <typename Functor>
class RunnableAdapter;
template <typename R>
class RunnableAdapter<R(*)()> {
public:
typedef R (RunType)();
explicit RunnableAdapter(R(*function)())
: function_(function) {
}
R Run() {
return function_();
}
private:
R (*function_)();
};
void fun()
{
cout<<"Hello world!"<<endl;
}
int _tmain(int argc, _TCHAR* argv[])
{
RunnableAdapter<void(__cdecl*)(void)> b(&fun);
b.Run();
system("pause");
return 0;
}