🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: ANSI compiant explicit template instantation

#2901
From: Jesse Jones
Date: Fri, 08 Dec 1995 08:33
41 lines
2020 bytes
In article <9512071347.AA29456@lts.sel.alcatel.de>, James Kanze US/ESC
60/3/141 #40763 <kanze@lts.sel.alcatel.de> wrote:

> 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.

 [snip]

 Section 14.4 of the draft standard documents explicit template
instantiation: the syntax is "template class Stack<int, 6>;". BTW I know
of two uses for explicit instantiation:

1) It forces every function defined in the template class to be
instantiated. This means that each function is actually compiled: you
don't have to worry about some stupid syntax error in functions that
haven't been used.

2) More importantly there are times when you want to control where the
code is generated. For example, programs that have to run on low end Macs
often segment the code so it doesn't all have to be in memory at once. In
this sort of situation it's very nice to be able to control where the
commonly used template classes go.

  --Jesse


---
[ 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: <jesjones-0712951026490001@blv-pm2-ip29.halcyon.com>
Path: arc1-ca.pugleaf.net!news.mindlink.net!agate!agate!Matt
References: <4a4io5$s0v@cronkite.seas.gwu.edu> <9512071347.AA29456@lts.sel.alcatel.de>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!news.mindlink.net!agate!agate!Matt
From: jesjones@halcyon.com (Jesse Jones)
Newsgroups: comp.std.c++
Subject: Re: ANSI compiant explicit template instantation
Date: 08 Dec 1995 08:33:53 GMT
Organization: Edmark
Approved: Matt@Austern
Message-ID: <jesjones-0712951026490001@blv-pm2-ip29.halcyon.com>
References: <4a4io5$s0v@cronkite.seas.gwu.edu> <9512071347.AA29456@lts.sel.alcatel.de>
NNTP-Posting-Host: austern.hip.berkeley.edu