x__x
I want to do something like this:
typedef long (* fp)(BaseWindow< fp > & wnd, HWND hwnd, long wparam, long lparam);
But I get a compile error:
error C2065: 'fp' : undeclared identifier
Is it possible to implement this somehow?
x__x
I want to do something like this:
typedef long (* fp)(BaseWindow< fp > & wnd, HWND hwnd, long wparam, long lparam);
But I get a compile error:
error C2065: 'fp' : undeclared identifier
Is it possible to implement this somehow?
No it isn't, because the type of the template parameter would include itself. This would yield to an endless recursion in the type.
If instead of the class template specialization, you accept a base-class of it, that's very possible
struct TemplateBase {
};
typedef long (*fpType)(TemplateBase&, HWND, long, long);
template<fpType FP>
struct BaseWindow : TemplateBase {
};
long sampleFunc(TemplateBase &b, HWND hwnd, long wparam, long lparam) {
...
}
int main() {
BaseWindow<sampleFunc> bw;
sampleFunc(bw, ...);
}
What do you want to do with this?
From the related links section on this very page: How can I typedef a function pointer that takes a function of its own type as an argument?