123qweasdzc
Programmer
Hello .
I am facing a problem related to templates. I have a piece of code that uses templates in VC6. I'm compiling the code using .NET VC++7.
typedef void (*HandlerFunction)();
typedef HandlerFunction (*HandlerFunctionSetter)(HandlerFunction);
template<HandlerFunctionSetter handlerFunction>
class HandlerSetter {
const HandlerFunction oldHandler;
static void __defaultHandler() {}
public:
HandlerSetter() : oldHandler(handlerFunction(__defaultHandler)) {}
HandlerSetter(HandlerFunction newHandler) : oldHandler(handlerFunction(newHandler)) {}
~HandlerSetter() { handlerFunction(oldHandler); }
};
error C2946: explicit instantiation; 'HandlerSetter' is not a template-class specialization
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\../include\new.h(87) : error C2874: using-declaration causes a multiple declration of 'std::set_new_handler'
Can someone help me on this? Thanks .
I am facing a problem related to templates. I have a piece of code that uses templates in VC6. I'm compiling the code using .NET VC++7.
typedef void (*HandlerFunction)();
typedef HandlerFunction (*HandlerFunctionSetter)(HandlerFunction);
template<HandlerFunctionSetter handlerFunction>
class HandlerSetter {
const HandlerFunction oldHandler;
static void __defaultHandler() {}
public:
HandlerSetter() : oldHandler(handlerFunction(__defaultHandler)) {}
HandlerSetter(HandlerFunction newHandler) : oldHandler(handlerFunction(newHandler)) {}
~HandlerSetter() { handlerFunction(oldHandler); }
};
error C2946: explicit instantiation; 'HandlerSetter' is not a template-class specialization
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\../include\new.h(87) : error C2874: using-declaration causes a multiple declration of 'std::set_new_handler'
Can someone help me on this? Thanks .