Article View: comp.std.c++
Article #2192Re: Determining between classes and built-in t
From: Atman Binstock
Date: Sat, 14 Oct 1995 15:57
Date: Sat, 14 Oct 1995 15:57
26 lines
1589 bytes
1589 bytes
In article <45mor5$fms@jupiter.SJSU.EDU>,
Cay S. Horstmann <horstman@jupiter.SJSU.EDU> wrote:
>clamage@Eng.sun.com (Steve Clamage) wrote:
>
>>In article 100000@gusak, "Brett W. Denner" <dennerbw@cliffy.lfwc.lockheed.com>
> writes:
>>>Is there a way to identify whether a data type in a template function is a
>>>class or a built-in type? For example,
How about using template specialization?
template<class T> bool builtin() { return false; }
template<class T> bool builtin<char>() { return true; }
//etc
I'm not quite sure about the specialization syntax.
This does not cover pointers, though.
Is this allowed by the standard?
template<class T> bool builtin<T*>() { return true; }
or, depending on your needs:
template<class T> bool builtin<T*>() { return builtin<T>(); }
Atman Binstock
ajb@panix.com
[ comp.std.c++ is moderated. Submission address: std-c++@ncar.ucar.edu.
Contact address: std-c++-request@ncar.ucar.edu. The moderation policy
is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]
Technical Details
Message-ID:
<45ns7a$cir@panix.com>Path:
arc1-ca.pugleaf.net!engnews2.Eng.Sun.COM!taumet!clamageReferences:
<Pine.SGI.3.91.951003143924.20596A-100000@gusak> <450v2o$f3g@engnews2.Eng.Sun.COM> <45mor5$fms@jupiter.SJSU.EDU>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!engnews2.Eng.Sun.COM!taumet!clamage From: ajb@panix.com (Atman Binstock) Newsgroups: comp.std.c++ Subject: Re: Determining between classes and built-in t Date: 14 Oct 1995 15:57:31 GMT Organization: Panix Approved: clamage@eng.sun.com (comp.std.c++) Message-ID: <45ns7a$cir@panix.com> References: <Pine.SGI.3.91.951003143924.20596A-100000@gusak> <450v2o$f3g@engnews2.Eng.Sun.COM> <45mor5$fms@jupiter.SJSU.EDU> NNTP-Posting-Host: taumet.eng.sun.com Content-Type: text Content-Length: 810 Originator: clamage@taumet