Click here to Skip to main content
15,921,113 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Template specialization Pin
Don Box26-Jul-07 0:16
Don Box26-Jul-07 0:16 
GeneralRe: Template specialization Pin
Russell'26-Jul-07 0:39
Russell'26-Jul-07 0:39 
AnswerRe: Template specialization Pin
progDes26-Jul-07 1:02
progDes26-Jul-07 1:02 
GeneralRe: Template specialization Pin
Russell'26-Jul-07 2:08
Russell'26-Jul-07 2:08 
GeneralRe: Template specialization Pin
CPallini26-Jul-07 2:21
mveCPallini26-Jul-07 2:21 
GeneralRe: Template specialization Pin
Russell'26-Jul-07 2:45
Russell'26-Jul-07 2:45 
AnswerRe: Template specialization Pin
progDes26-Jul-07 2:53
progDes26-Jul-07 2:53 
AnswerRe: Template specialization Pin
Nelek26-Jul-07 20:57
protectorNelek26-Jul-07 20:57 
I will maybe say something without sense... but... Why don't you make a way of trick to the compiler? I mean...

I make some additions to the SmartList of Simon Hughes here in codeproject. You can look for my article. The fact is...

If a CList can return whatever you give in the TYPE, ARG_TYPE.... Why don't you use that possibility? You can have some intermediate class that use your "typename T" as entry parameter and then you shouldn't have any problem more to return one type or another type of element. The return will depend on what you give to the ARG_TYPE.

I.E:
CMyList < TYPE, ARG_TYPE >& Foo (T tTemp)
{
//do whatever you want with the T parameter tTemp
return tTemp;
}

With that you return T independantly of what type of variable T is, being possible for complex classes too.

In my project I have some main ObjClass that have member variables and methodes that use secondary SubObjClass that have parameters and methodes that use third type of SubSubObjClass, so on till 5 steps in the hierarchy. And The main objects are saved in one of this list. The list can save different type of things and returns what it has saved in. No matter of what.


Im not meaning you should a CList with your elements, but maybe you can rewrite your template to return whatever you need using something like that.

I hope not saying silly things and that it helps you Wink | ;)




Greetings.

--------
M.D.V.

If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?

GeneralRe: Template specialization Pin
Russell'29-Jul-07 22:09
Russell'29-Jul-07 22:09 
QuestionClosing MainFrame window Pin
Anu_Bala25-Jul-07 23:38
Anu_Bala25-Jul-07 23:38 
AnswerRe: Closing MainFrame window Pin
Roger Broomfield26-Jul-07 0:09
Roger Broomfield26-Jul-07 0:09 
AnswerRe: Closing MainFrame window Pin
Mark Salsbery26-Jul-07 5:40
Mark Salsbery26-Jul-07 5:40 
AnswerRe: Closing MainFrame window Pin
Nelek26-Jul-07 21:04
protectorNelek26-Jul-07 21:04 
Questionerror LNK2005: std::basic_string Pin
Mohammed Asif Palimar25-Jul-07 23:23
Mohammed Asif Palimar25-Jul-07 23:23 
AnswerRe: error LNK2005: std::basic_string Pin
mandanani25-Jul-07 23:30
mandanani25-Jul-07 23:30 
AnswerRe: error LNK2005: std::basic_string Pin
Cedric Moonen25-Jul-07 23:39
Cedric Moonen25-Jul-07 23:39 
GeneralRe: error LNK2005: std::basic_string Pin
Mohammed Asif Palimar25-Jul-07 23:48
Mohammed Asif Palimar25-Jul-07 23:48 
AnswerRe: error LNK2005: std::basic_string Pin
Russell'26-Jul-07 0:13
Russell'26-Jul-07 0:13 
GeneralRe: error LNK2005: std::basic_string Pin
Russell'26-Jul-07 0:46
Russell'26-Jul-07 0:46 
GeneralRe: error LNK2005: std::basic_string Pin
Mohammed Asif Palimar26-Jul-07 0:54
Mohammed Asif Palimar26-Jul-07 0:54 
GeneralRe: error LNK2005: std::basic_string Pin
Mohammed Asif Palimar26-Jul-07 0:50
Mohammed Asif Palimar26-Jul-07 0:50 
QuestionHANDLE and FILE* Pin
George_George25-Jul-07 23:20
George_George25-Jul-07 23:20 
AnswerRe: HANDLE and FILE* Pin
Jonathan [Darka]25-Jul-07 23:30
professionalJonathan [Darka]25-Jul-07 23:30 
Answeror... Pin
CPallini25-Jul-07 23:43
mveCPallini25-Jul-07 23:43 
AnswerRe: HANDLE and FILE* Pin
Viorel.26-Jul-07 2:07
Viorel.26-Jul-07 2:07 

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.