How can I use a static function pointer member in my class template?
I'm working with C++ in Visual Studio, and my code looks similar to the following:
template<typename T>
class ClassTemplate
{
public:
static T* CallIt() { return ClassTemplate<T>::mFunctionPointer(); }
private:
static T* (*mFunctionPointer)();
};
When I compile I get an "unresolved external symbol" error. I think I'm supposed to do something like this outside of the class declaration:
template<typename T>
T* (ClassTemplate<T>::*mFunctionPointer)() = NULL;
Unfortunately then I get C2998, "cannot be a template definition".
Any ideas?