Click here to Skip to main content
15,917,968 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Runing the MFC program in Silent Mode. Pin
Avi Berger18-Feb-10 15:44
Avi Berger18-Feb-10 15:44 
GeneralRe: Runing the MFC program in Silent Mode. Pin
Maximilien19-Feb-10 0:35
Maximilien19-Feb-10 0:35 
GeneralRe: Runing the MFC program in Silent Mode. Pin
Avi Berger19-Feb-10 11:50
Avi Berger19-Feb-10 11:50 
GeneralRe: Runing the MFC program in Silent Mode. Pin
Rozis21-Feb-10 10:58
Rozis21-Feb-10 10:58 
GeneralRe: Runing the MFC program in Silent Mode. Pin
Avi Berger23-Feb-10 7:02
Avi Berger23-Feb-10 7:02 
Questioncan one use vectors of subclasses in a parameter list? Pin
genush18-Feb-10 8:42
genush18-Feb-10 8:42 
AnswerRe: can one use vectors of subclasses in a parameter list? Pin
Kevin McFarlane18-Feb-10 9:25
Kevin McFarlane18-Feb-10 9:25 
AnswerRe: can one use vectors of subclasses in a parameter list? [modified] Pin
Avi Berger18-Feb-10 10:14
Avi Berger18-Feb-10 10:14 
This would be a no, since vector< subclass > is not a subclass of vector< baseclass >. (Note that in the implementation the internal arrays may have different size entries. If you somehow forced this into one function, your single function would be using the wrong entry size and be reading misaligned garbage rather than valid objects.)

My first quick thought is that you could use a vector< std::tr1::shared_ptr< baseclass > > in both cases. This would, however, impact the rest of your software, and might not be acceptable.

My second thought is that you could turn your function into a template itself. This changes your maintenance to 1 place, but really still leaves you with 2 compiled function bodies.

My third thought would be to provide a wrapper ( internally akin to a discriminated union ) with forwarding functions. I believe this would be a bad idea and extra effort without real benefit.

Maybe someone else has a better idea, I've run out for now. It looks to me that making your function into a template function is about the best you will do.
Please do not read this signature.
modified on Thursday, February 18, 2010 4:22 PM

GeneralRe: can one use vectors of subclasses in a parameter list? Pin
genush18-Feb-10 10:35
genush18-Feb-10 10:35 
AnswerRe: can one use vectors of subclasses in a parameter list? Pin
Chris Losinger18-Feb-10 12:57
professionalChris Losinger18-Feb-10 12:57 
GeneralRe: can one use vectors of subclasses in a parameter list? Pin
Stephen Hewitt20-Feb-10 3:28
Stephen Hewitt20-Feb-10 3:28 
QuestionHow to detect EBCDIC Pin
Hans Dietrich18-Feb-10 8:28
mentorHans Dietrich18-Feb-10 8:28 
AnswerRe: How to detect EBCDIC Pin
Garth J Lancaster18-Feb-10 10:16
professionalGarth J Lancaster18-Feb-10 10:16 
GeneralRe: How to detect EBCDIC Pin
Hans Dietrich18-Feb-10 10:36
mentorHans Dietrich18-Feb-10 10:36 
QuestionRe: How to detect EBCDIC Pin
David Crow18-Feb-10 15:22
David Crow18-Feb-10 15:22 
AnswerRe: How to detect EBCDIC Pin
Luc Pattyn18-Feb-10 10:25
sitebuilderLuc Pattyn18-Feb-10 10:25 
GeneralRe: How to detect EBCDIC Pin
Garth J Lancaster18-Feb-10 10:46
professionalGarth J Lancaster18-Feb-10 10:46 
GeneralRe: How to detect EBCDIC Pin
Hans Dietrich18-Feb-10 10:55
mentorHans Dietrich18-Feb-10 10:55 
RantRe: How to detect EBCDIC (not a helpful answer, just a comment) Pin
Gary R. Wheeler21-Feb-10 1:56
Gary R. Wheeler21-Feb-10 1:56 
GeneralRe: How to detect EBCDIC (not a helpful answer, just a comment) Pin
Rozis21-Feb-10 11:00
Rozis21-Feb-10 11:00 
QuestionMAPIEx Libraries when OutLook is offline Pin
kasi1418-Feb-10 7:17
kasi1418-Feb-10 7:17 
QuestionERROR_INVALID_FUNCTION when calling WriteFile Pin
krishiyengar18-Feb-10 6:08
krishiyengar18-Feb-10 6:08 
QuestionMessage Removed Pin
18-Feb-10 5:25
tokime18-Feb-10 5:25 
AnswerRe: problem with neural network.. Pin
Richard Andrew x6418-Feb-10 5:34
professionalRichard Andrew x6418-Feb-10 5:34 
AnswerRe: problem with neural network.. Pin
Tim Craig18-Feb-10 7:45
Tim Craig18-Feb-10 7:45 

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.