Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VC++6 template to VC++7

Status
Not open for further replies.

123qweasdzc

Programmer
Sep 27, 2005
20
0
0
PT
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 :).
 
How exactly do you call this template in the original code?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top