This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: The future C++ template model in gcc


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]