Click here to Skip to main content
15,915,702 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Errors in createthread file. Need help! Pin
Anonymous5-Feb-03 5:56
Anonymous5-Feb-03 5:56 
GeneralRe: Errors in createthread file. Need help! Pin
-=jarl=-5-Feb-03 6:54
-=jarl=-5-Feb-03 6:54 
GeneralRe: Errors in createthread file. Need help! Pin
Pecan2045-Feb-03 8:15
Pecan2045-Feb-03 8:15 
GeneralGUI Dll Problems Pin
Ricky_TheBard5-Feb-03 5:08
Ricky_TheBard5-Feb-03 5:08 
GeneralGetDlgItem question. Pin
Maximilien5-Feb-03 4:13
Maximilien5-Feb-03 4:13 
GeneralRe: GetDlgItem question. Pin
Paul M Watt5-Feb-03 8:13
mentorPaul M Watt5-Feb-03 8:13 
GeneralRe: GetDlgItem question. Pin
Abbas_Riazi5-Feb-03 22:24
professionalAbbas_Riazi5-Feb-03 22:24 
Questionusing template functions as part of a class? is it possible? Pin
Joan M5-Feb-03 4:09
professionalJoan M5-Feb-03 4:09 
Hello,

I need to use a template function, but I need that that template function be a class member...

Let's say that I've tried to do:
INSIDE THE HEADER FILE:
template<class T> void MyClass::MyFunction(T& Parameter);
-------------------------------------------------------------------
INSIDE THE IMPLEMENTATION FILE:
template<class T> void CMyClass::MyFunction(T& Parameter)
{
  SomeOperations...
}
-------------------------------------------------------------------
HOW DO I CALL THE FUNCTION:
bool b = false;
MyFunction(b);
The fact is that using this code I get a lot of errors (one in each MyFunction call) like:
...MyFile.cpp(119) : error C2893: Failed to specialize function template 'void __thiscall CMyclass::MyFunction(T &)'<br />
        With the following template arguments:<br />
        'bool'


The strange thing is that if I remove the declaration from the class (I've commented it out) and I call the function as a non class member, then it executes well...

I need to be able to call that function while that function would be a part of CMyClass.

Is this possible? and if it is possible, what do I'm doing wrong?

Thank you in advance.

NOTE:
Somebody has told me that this is a weakness of the VC++ compiler, but I continue searching because I need it, what do you believe?
AnswerRe: using template functions as part of a class? is it possible? Pin
-=jarl=-5-Feb-03 4:36
-=jarl=-5-Feb-03 4:36 
GeneralRe: using template functions as part of a class? is it possible? Pin
Joan M5-Feb-03 4:44
professionalJoan M5-Feb-03 4:44 
GeneralRe: using template functions as part of a class? is it possible? Pin
-=jarl=-5-Feb-03 4:46
-=jarl=-5-Feb-03 4:46 
GeneralRe: using template functions as part of a class? is it possible? Pin
-=jarl=-5-Feb-03 4:48
-=jarl=-5-Feb-03 4:48 
AnswerRe: using template functions as part of a class? is it possible? Pin
Joaquín M López Muñoz5-Feb-03 8:14
Joaquín M López Muñoz5-Feb-03 8:14 
GeneralRe: using template functions as part of a class? is it possible? Pin
Joan M5-Feb-03 4:44
professionalJoan M5-Feb-03 4:44 
GeneralRe: using template functions as part of a class? is it possible? Pin
Joan M5-Feb-03 20:27
professionalJoan M5-Feb-03 20:27 
GeneralRe: using template functions as part of a class? is it possible? Pin
-=jarl=-5-Feb-03 4:57
-=jarl=-5-Feb-03 4:57 
Generalnew panel in statusbar is tiny! Pin
ns5-Feb-03 4:03
ns5-Feb-03 4:03 
Generaladditional bit of info Pin
ns5-Feb-03 4:11
ns5-Feb-03 4:11 
GeneralRe: new panel in statusbar is tiny! Pin
Maximilien5-Feb-03 4:19
Maximilien5-Feb-03 4:19 
GeneralA big thank you!! Pin
ns5-Feb-03 4:23
ns5-Feb-03 4:23 
QuestionProblems with Class Wizard? Pin
aslm5-Feb-03 3:53
aslm5-Feb-03 3:53 
AnswerRe: Problems with Class Wizard? Pin
Joan M5-Feb-03 4:14
professionalJoan M5-Feb-03 4:14 
GeneralRe: Problems with Class Wizard? Pin
Harold Bamford6-Feb-03 9:39
Harold Bamford6-Feb-03 9:39 
Generalcapturing keypressing events when focus is on different window Pin
sulaxan5-Feb-03 3:12
sulaxan5-Feb-03 3:12 
GeneralRe: capturing keypressing events when focus is on different window Pin
Jeremy Falcon5-Feb-03 3:39
professionalJeremy Falcon5-Feb-03 3:39 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.