🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #17053

template newbie question

#17053
From: Brian Dumas
Date: Fri, 11 Apr 2003 14:31
16 lines
1422 bytes
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: <3e96d1d8$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-01!sn-xit-08!supernews.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,47b5e0a09d9eff11,start
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-04-11 07:44:24 PST
Reply-To: "Brian Dumas" <brian@kvdco.com>
From: "Brian Dumas" <brian@kvdco.com>
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: template newbie question
Date: Fri, 11 Apr 2003 08:31:55 -0600
Lines: 18
Organization: KVD
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2720.3000
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000
NNTP-Posting-Host: 68.64.20.130
Message-ID: <3e96d1d8$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1050071512 68.64.20.130 (11 Apr 2003 07:31:52 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-01!sn-xit-08!supernews.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail