Article View: borland.public.cppbuilder.nativeapi
Article #17054Re: template newbie question
From: Pete Fraser
Date: Fri, 11 Apr 2003 14:48
Date: Fri, 11 Apr 2003 14:48
24 lines
1783 bytes
1783 bytes
You can use the automatic conversions for AnsiString.
as in:
AnsiString Str = 1;
AnsiString Str = 1.1;
HTH Pete
"Brian Dumas" <brian@kvdco.com> wrote in message news:3e96d1d8
$1@newsgroups.borland.com...
I have a template defined similar to this
template <typename K, typename T>
class myclass
{
...
}
Now, when values of type K are sent in, I want to convert the value of K to
a string. But, I need to know the type. If K is a string, then I don't need
to change anything. If K is an integer, the I'll use IntToStr, if K is a
double I can use FormatFloat. But how do I determine K's type. I tried using
typeid in a series of if/else statements, but it won't compile. Any
ideas????
thanks, Brian
Technical Details
Message-ID:
<3e96d5b5@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-06!sn-xit-08!supernews.com!newsfeed.news2me.com!canoe.uoregon.edu!logbridge.uoregon.edu!xmission!news-out.spamkiller.net!propagator2-maxim!propagator-maxim!feed.newsfeeds.com!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<3e96d1d8$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,47b5e0a09d9eff11 X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2003-04-11 07:52:09 PST From: "Pete Fraser" <pete.fraser@at.frasersoft.dot.net> Newsgroups: borland.public.cppbuilder.nativeapi References: <3e96d1d8$1@newsgroups.borland.com> Subject: Re: template newbie question Date: Fri, 11 Apr 2003 15:48:20 +0100 Lines: 27 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 NNTP-Posting-Host: 195.12.18.1 Message-ID: <3e96d5b5@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1050072501 195.12.18.1 (11 Apr 2003 07:48:21 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-06!sn-xit-08!supernews.com!newsfeed.news2me.com!canoe.uoregon.edu!logbridge.uoregon.edu!xmission!news-out.spamkiller.net!propagator2-maxim!propagator-maxim!feed.newsfeeds.com!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail