Click here to Skip to main content
16,013,747 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralMS Excel automation Pin
28-May-02 22:53
suss28-May-02 22:53 
GeneralRe: MS Excel automation Pin
KarstenK29-May-02 0:14
mveKarstenK29-May-02 0:14 
QuestionSimple template function question? Pin
28-May-02 22:12
suss28-May-02 22:12 
AnswerRe: Simple template function question? Pin
Mike Nordell28-May-02 23:00
Mike Nordell28-May-02 23:00 
AnswerRe: Simple template function question? Pin
Rutger Ellen28-May-02 23:54
Rutger Ellen28-May-02 23:54 
AnswerRe: Simple template function question? Pin
_Magnus_29-May-02 0:14
_Magnus_29-May-02 0:14 
AnswerRe: Simple template function question? Pin
29-May-02 2:32
suss29-May-02 2:32 
GeneralRe: Simple template function question? Pin
Rutger Ellen29-May-02 3:36
Rutger Ellen29-May-02 3:36 
So at compile time you 'know' when what item is being passed to the function? If so it's possible to do it with templates.

Keep all your code (except for the pseudocode ofcourse) and make a few extra template functions that call the proper method.

Using templates will *not* work if your objecttype has to be determined at runtime!

You could make a template function as follows
template <Type2> static HelperFunc(Type2* pProjection,UINT32 uNum)
{
   pProjection->SetNumElements(uNum);
}

the above being the generic type.
template <> static HelperFunc(vector* pProjection,UINT32 uNum)
{
   pProjection->->resize(uNum);
}

This is the specialization for vectors. Now make a function wrapper for each of the properties that are different and it should work.
GeneralRe: Simple template function question? Pin
30-May-02 16:12
suss30-May-02 16:12 
GeneralMAKEWPARAM Pin
Arjan Schouten28-May-02 21:41
Arjan Schouten28-May-02 21:41 
GeneralRe: MAKEWPARAM Pin
Arjan Schouten28-May-02 23:23
Arjan Schouten28-May-02 23:23 
GeneralRe: MAKEWPARAM Pin
Mike Nordell28-May-02 23:40
Mike Nordell28-May-02 23:40 
GeneralRe: MAKEWPARAM Pin
Alex Cramer29-May-02 0:01
Alex Cramer29-May-02 0:01 
GeneralRe: MAKEWPARAM Pin
Arjan Schouten29-May-02 0:05
Arjan Schouten29-May-02 0:05 
Generalsize and position of a control like a button or static text. Pin
aldeba28-May-02 21:26
aldeba28-May-02 21:26 
GeneralRe: size and position of a control like a button or static text. Pin
Eugene Pustovoyt28-May-02 21:36
Eugene Pustovoyt28-May-02 21:36 
GeneralRe: size and position of a control like a button or static text. Pin
Mike Nordell28-May-02 21:33
Mike Nordell28-May-02 21:33 
GeneralRe: size and position of a control like a button or static text. Pin
Joaquín M López Muñoz28-May-02 21:42
Joaquín M López Muñoz28-May-02 21:42 
GeneralRe: size and position of a control like a button or static text. Pin
aldeba28-May-02 21:58
aldeba28-May-02 21:58 
GeneralRe: size and position of a control like a button or static text. Pin
Mike Nordell28-May-02 22:51
Mike Nordell28-May-02 22:51 
GeneralRe: size and position of a control like a button or static text. Pin
aldeba30-May-02 0:45
aldeba30-May-02 0:45 
GeneralConverting from CString to std::string Pin
Poul Haahr Klemmensen28-May-02 20:33
Poul Haahr Klemmensen28-May-02 20:33 
GeneralRe: Converting from CString to std::string Pin
Joaquín M López Muñoz28-May-02 20:49
Joaquín M López Muñoz28-May-02 20:49 
GeneralRe: Converting from CString to std::string Pin
Bernhard28-May-02 20:56
Bernhard28-May-02 20:56 
GeneralRe: Converting from CString to std::string Pin
Poul Haahr Klemmensen29-May-02 7:17
Poul Haahr Klemmensen29-May-02 7:17 

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.