Click here to Skip to main content
16,010,650 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: binding member variables Pin
3-Jul-01 5:29
suss3-Jul-01 5:29 
GeneralReturn variable Pin
Giuseppe Vitali2-Jul-01 0:19
Giuseppe Vitali2-Jul-01 0:19 
GeneralRe: Return variable Pin
Anders Molin2-Jul-01 4:49
professionalAnders Molin2-Jul-01 4:49 
GeneralRe: Return variable Pin
Giuseppe Vitali2-Jul-01 5:54
Giuseppe Vitali2-Jul-01 5:54 
GeneralRe: Return variable Pin
Mukkie2-Jul-01 8:19
Mukkie2-Jul-01 8:19 
Generalxml validator Pin
1-Jul-01 23:55
suss1-Jul-01 23:55 
GeneralRe: xml validator Pin
markkuk2-Jul-01 0:46
markkuk2-Jul-01 0:46 
GeneralTemplate Question Pin
1-Jul-01 23:47
suss1-Jul-01 23:47 
Hi everybody.

I have the following question. Is it possible to get behavour like this from templates.

template < typename T >
class TType
{
public:
CString GetAsString( )
{
CString sValue;

sValue.Format( GetFormat<t>( ), m_tValue );


return sValue;
}

protected:
T m_tValue;
};

Define some function that depended of the type will return different string for formating.

template < class int >
CString GetFormat( )
{
return "%d";
}

template < class float >
CString GetFormat( )
{
return "%.4f";
}



and then when this is used
TType< int > a; // will use template function for int

TType< float > a; // will use template function for float
GeneralRe: Template Question Pin
Martin Vladic2-Jul-01 0:26
Martin Vladic2-Jul-01 0:26 
GeneralRe: Template Question Pin
2-Jul-01 0:41
suss2-Jul-01 0:41 
GeneralRe: Template Question Pin
Martin Vladic2-Jul-01 23:30
Martin Vladic2-Jul-01 23:30 
GeneralRe: Template Question Pin
Martin Vladic2-Jul-01 23:44
Martin Vladic2-Jul-01 23:44 
GeneralRe: Template Question Pin
Tomasz Sowinski2-Jul-01 1:12
Tomasz Sowinski2-Jul-01 1:12 
GeneralDisplaying Graphical Primitives of RichText Format Pin
1-Jul-01 23:26
suss1-Jul-01 23:26 
GeneralFailure in CRecordSet::IsOpen() Pin
Kristian Thelin1-Jul-01 23:09
Kristian Thelin1-Jul-01 23:09 
GeneralRe: Failure in CRecordSet::IsOpen() Pin
olof neumann1-Jul-01 23:15
olof neumann1-Jul-01 23:15 
Generaloverriding CEDIT Pin
1-Jul-01 21:43
suss1-Jul-01 21:43 
GeneralWM_CLOSE Pin
vijayaramaraju1-Jul-01 21:27
vijayaramaraju1-Jul-01 21:27 
GeneralRe: WM_CLOSE Pin
Gert Boddaert2-Jul-01 4:48
Gert Boddaert2-Jul-01 4:48 
GeneralRe: WM_CLOSE Pin
Hadi Rezaee2-Jul-01 8:29
Hadi Rezaee2-Jul-01 8:29 
GeneralRe: WM_CLOSE Pin
Jack Handy2-Jul-01 9:52
Jack Handy2-Jul-01 9:52 
GeneralRe: WM_CLOSE Pin
Hadi Rezaee2-Jul-01 10:40
Hadi Rezaee2-Jul-01 10:40 
GeneralRe: WM_CLOSE Pin
Gert Boddaert2-Jul-01 21:36
Gert Boddaert2-Jul-01 21:36 
Questionnew & modal ... stupid questions ? Pin
1-Jul-01 17:21
suss1-Jul-01 17:21 
AnswerRe: new & modal ... stupid questions ? Pin
Christian Graus1-Jul-01 18:15
protectorChristian Graus1-Jul-01 18:15 

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.