c++ 模板类 静态成员初始化问题

template
class TimerApp
{
//friend class TimerApp;
typedef void (MessageHandlerClass::*HandlerMethod)();

public:
    static void AddTimer(int interval,MessageHandlerClass *handler);

private:
    static int interval_;
    static HandlerMethod handler_method_;     //回调函数指针
    static MessageHandlerClass*    handler_;    //调用对象
    static void OnTimer();

};

template int TimerApp::interval_ = 0;
template MessageHandlerClass * TimerApp::handler_ = 0;

请问handler_method_如何在类外初始化

补充:我尝试template HandlerMethod SubTimerApp::handler_method_ = 0;
报错:error: ‘HandlerMethod’ does not name a type

HandlerMethod handler_method_ = 0
不就行了,加那么多零碎是干嘛?

好吧,是模板啊,那么看这里吧
https://blog.csdn.net/zjq2008wd/article/details/38417859

初始化时把template去掉。

typedef void (MessageHandlerClass::*HandlerMethod)();
把这个放到类外声明