If you simplify the syntax with the appropriate typedef, it is much easier to do:
template<class K>
class Cltest
{
public:
typedef double (K::*Fn)(double);
static Fn fn;
};
template<class K>
typename Cltest<K>::Fn Cltest<K>::fn = 0;
template<class K>
typename Cltest<K>::Fn Cltest<K>::fn = &K::SomeFun;
Using typedef, you actually split the type of the function with the variable name. Now you can see them separately, which simplifies the understanding of the code. For example, Cltest<K>::Fnthere is a type above , and Cltest<K>::Fna variable of this type.
Nawaz source
share