🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: ANSI compiant explicit template instantation

#2878
From: James Kanze US/ESC 60/3/141 #407...
Date: Thu, 07 Dec 1995 18:25
39 lines
2029 bytes
In article <4a4io5$s0v@cronkite.seas.gwu.edu> bkeefe@seas.gwu.edu
(Brian J. Keefe) writes:

|> The online MSVC4 manual says to use syntax like:

|> template Stack<int,6>;

|> to force class template instantiation for all operations.
|> I did not find this in the ARM. Is it ANSI compliant?

No.  The standard offers no means of forcing template instantiation,
probably because forcing instantiation has no utility.

If you use the template, it is instantiated.  You don't need to force
instantiation.  If you don't use it, why do you want to instantiate
it?  Just to have extra code (which is never called) in your
application.

Note that in most modern implementations, if you use a template in a
library, the implementation will instantiate the template and include
the code of the instantiation in the library automatically.
(Historically, with older link-time instantiation compilers, like
CFront, you had to do this manually.  But while I was very happy to
have CFront back then, it is hardly what I would call state of the art
today.)

--
James Kanze         Tel.: (+33) 88 14 49 00        email: kanze@gabi-soft.fr
GABI Software, Sarl., 8 rue des Francs-Bourgeois, F-67000 Strasbourg, France
Conseils, études et réalisations en logiciel orienté objet --
                -- A la recherche d'une activité dans une region francophone



---
[ 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: <9512071347.AA29456@lts.sel.alcatel.de>
Path: arc1-ca.pugleaf.net!howland.reston.ans.net!agate!agate!Matt
References: <4a4io5$s0v@cronkite.seas.gwu.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!howland.reston.ans.net!agate!agate!Matt
From: James Kanze US/ESC 60/3/141 #40763 <kanze@lts.sel.alcatel.de>
Newsgroups: comp.std.c++
Subject: Re: ANSI compiant explicit template instantation
Date: 07 Dec 1995 18:25:59 GMT
Organization: <none>
Approved: Matt@Austern
Message-ID: <9512071347.AA29456@lts.sel.alcatel.de>
References: <4a4io5$s0v@cronkite.seas.gwu.edu>
NNTP-Posting-Host: austern.hip.berkeley.edu