This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: The future C++ template model in gcc
- To: Florian Schintke <schintke at zib dot de>
- Subject: Re: The future C++ template model in gcc
- From: Fergus Henderson <fjh at cs dot mu dot oz dot au>
- Date: Mon, 30 Jul 2001 19:41:44 +1000
- Cc: gcc at gcc dot gnu dot org
- References: <20010730101358.C30801@csr-pc2.zib.de>
On 30-Jul-2001, Florian Schintke <schintke@zib.de> wrote:
> Why isn't it possible to generate a generic 'template meta
> instantiation' that works for all possible instantiations?
The short answer is that C++ templates weren't designed to support that
implementation technique. Each different instantiation of a template
may have completely different semantics.
> Is it a performance issue?
No. There are serious semantic problems that prevent a shared-code
implementation of templates.
Performance is the main reason why C++ templates were designed based
on a duplicated-code model rather than a shared-code model, though.
> Are there problems with polymorphism and
> overloaded functions?
Yes. And with implicit and user-defined conversions.
Also there are problems with explicit template specializations.
--
Fergus Henderson <fjh@cs.mu.oz.au> | "I have always known that the pursuit
The University of Melbourne | of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh> | -- the last words of T. S. Garp.