模板化静态成员函数指针初始化 [英] Templated static member function pointer initialization
本文介绍了模板化静态成员函数指针初始化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
template<class K>
class Cltest
{
public:
static double (K::*fn)(double);
};
template<class K>
double K::*Cltest<K>::fn(double) = NULL;
如何初始化静态成员函数指针?
How can I initialize the static member function pointer?
推荐答案
您需要将*fn
用大括号括起来.
更正的语法:
You need to enclose *fn
in braces.
Corrected syntax:
template<class K>
double (K::*Cltest<K>::fn)(double) = 0;
这篇关于模板化静态成员函数指针初始化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文