🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c++
Article #1826

Re: Template instantiation question

#1826
From: Lars Farm
Date: Wed, 23 Aug 1995 15:25
24 lines
1531 bytes
In article <41b09t$ltj@engnews2.Eng.Sun.COM>,
clamage@Eng (Steve Clamage) wrote:

>In the mean time, you could write a specialization of Foo<X>::compare
>that throws an exception or invokes "assert(0)" to allow your code
>to compile and link. That is, for example, if you use Foo<complex>,
>you could provide the specialization
>	int Foo<complex>::compare(const complex&) { assert(0); return 0; }
>which will prevent the compiler from generating a version from the template,
>and will thus allow your program to compile and link.

Can you specialize just that one function for complex or do you have to
specialize the whole class Foo<complex> with all its members to change the
implementation of Foo<complex>::compare?

  - lars


--
lars.farm@nts.mh.se

[ 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: <AC60F6E1966821CF0@sleipner.nts.mh.se>
Path: arc1-ca.pugleaf.net!engnews2.Eng.Sun.COM!taumet!clamage
References: <41b09t$ltj@engnews2.Eng.Sun.COM>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!engnews2.Eng.Sun.COM!taumet!clamage
From: lars.farm@nts.mh.se (Lars Farm)
Newsgroups: comp.std.c++
Subject: Re: Template instantiation question
Date: 23 Aug 1995 15:25:02 GMT
Organization: pv
Approved: clamage@eng.sun.com (comp.std.c++)
Distribution: world
Message-ID: <AC60F6E1966821CF0@sleipner.nts.mh.se>
References: <41b09t$ltj@engnews2.Eng.Sun.COM>
NNTP-Posting-Host: taumet.eng.sun.com
Content-Type: text
X-Nntp-Posting-Host: @sleipner.nts.mh.se
Content-Length: 754
X-Lines: 20
Originator: clamage@taumet