P
Phil
Ok, I have a template function for any pointer to type T:
template <typename T>
void func(T* p)
{
DoSomethingGeneric(p);
}
Can I specialize this template for pointers to functions (or pointers
to member functions, or pointers to anything)? I would like to do
something like this:
typedef void (*FUNCPTR)();
template <>
void func(FUNCPTR p)
{
DoSomethingSpecialWithFuncPtr(p);
}
but my compiler (Visual C++ 6) won't let me. I know VC6 is lacking in
support for templates, but I'd like to know if this is even legal
anyway. Thanks.
template <typename T>
void func(T* p)
{
DoSomethingGeneric(p);
}
Can I specialize this template for pointers to functions (or pointers
to member functions, or pointers to anything)? I would like to do
something like this:
typedef void (*FUNCPTR)();
template <>
void func(FUNCPTR p)
{
DoSomethingSpecialWithFuncPtr(p);
}
but my compiler (Visual C++ 6) won't let me. I know VC6 is lacking in
support for templates, but I'd like to know if this is even legal
anyway. Thanks.