Click here to Skip to main content
15,892,809 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: vector of template class Pin
forwardsim18-Aug-10 12:22
forwardsim18-Aug-10 12:22 
GeneralRe: vector of template class Pin
Aescleal18-Aug-10 22:15
Aescleal18-Aug-10 22:15 
GeneralRe: vector of template class Pin
Emilio Garavaglia18-Aug-10 22:23
Emilio Garavaglia18-Aug-10 22:23 
GeneralRe: vector of template class Pin
forwardsim19-Aug-10 4:44
forwardsim19-Aug-10 4:44 
AnswerRe: vector of template class Pin
Niklas L19-Aug-10 2:23
Niklas L19-Aug-10 2:23 
GeneralRe: vector of template class Pin
Aescleal19-Aug-10 3:01
Aescleal19-Aug-10 3:01 
GeneralRe: vector of template class Pin
Niklas L19-Aug-10 3:16
Niklas L19-Aug-10 3:16 
GeneralRe: vector of template class Pin
forwardsim19-Aug-10 4:47
forwardsim19-Aug-10 4:47 
Thanks everyone for your great comments!!!!!

I just wondering about something based on this code. In fact, I thought of something pretty similar but I didn't even try it since I was thinking that shouldn't work.

When the calls are made :

base::sum(*all[0], *all[1]);
base::sum(*all[0], *all[0]);


I was just thinking that *all[0] and *all[1] will be both of type 'base' than the dest and source of the static function sum will always be the same. Always ending in this function

template< class T >
static void sum(T &dest, const T &src)
{
    dest.privateadd(src);
}


and never in this one

template<class T, class U>
static void sum(T &dest, const U &src)
{
    // dest and src of different types, ignore
}


Ultimately we will enter the virtualadd of class CTest with different type to handle. Then, the static_cast should fail...

Since you both think it will work, I'm just wondering where I'm wrong...

SV.
GeneralRe: vector of template class Pin
Aescleal19-Aug-10 6:24
Aescleal19-Aug-10 6:24 
GeneralRe: vector of template class Pin
Niklas L19-Aug-10 8:29
Niklas L19-Aug-10 8:29 
GeneralRe: vector of template class [modified] Pin
Paul Michalik20-Aug-10 2:03
Paul Michalik20-Aug-10 2:03 
GeneralRe: vector of template class Pin
Niklas L20-Aug-10 2:22
Niklas L20-Aug-10 2:22 
GeneralRe: vector of template class Pin
Paul Michalik20-Aug-10 4:06
Paul Michalik20-Aug-10 4:06 
Questioncan main() be overloaded?? Pin
AmbiguousName18-Aug-10 6:36
AmbiguousName18-Aug-10 6:36 
AnswerRe: can main() be overloaded?? Pin
Aescleal18-Aug-10 6:50
Aescleal18-Aug-10 6:50 
QuestionRe: can main() be overloaded?? Pin
David Crow18-Aug-10 9:14
David Crow18-Aug-10 9:14 
AnswerRe: can main() be overloaded?? Pin
Aescleal18-Aug-10 10:00
Aescleal18-Aug-10 10:00 
GeneralRe: can main() be overloaded?? Pin
David Crow18-Aug-10 10:21
David Crow18-Aug-10 10:21 
GeneralRe: can main() be overloaded?? Pin
Aescleal18-Aug-10 10:26
Aescleal18-Aug-10 10:26 
GeneralRe: can main() be overloaded?? Pin
David Crow18-Aug-10 10:35
David Crow18-Aug-10 10:35 
GeneralRe: can main() be overloaded?? Pin
Aescleal18-Aug-10 11:20
Aescleal18-Aug-10 11:20 
GeneralRe: can main() be overloaded?? Pin
CPallini18-Aug-10 22:18
mveCPallini18-Aug-10 22:18 
GeneralRe: can main() be overloaded?? Pin
Emilio Garavaglia18-Aug-10 22:40
Emilio Garavaglia18-Aug-10 22:40 
GeneralRe: can main() be overloaded?? Pin
CPallini18-Aug-10 22:51
mveCPallini18-Aug-10 22:51 
GeneralRe: can main() be overloaded?? Pin
Aescleal18-Aug-10 23:12
Aescleal18-Aug-10 23:12 

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.