"temporary" templates

Stefan Koch uplink.coder at googlemail.com
Tue Nov 26 18:35:42 UTC 2019


On Tuesday, 26 November 2019 at 17:03:04 UTC, Steven 
Schveighoffer wrote:
> Every time you instantiate a template, it consumes memory in 
> the compiler for the duration of compilation.
>
> [...]

Ahh.

I've  been working on this particular  problem a few years ago.
In _general_ it's not possible to categorize a template  as being 
temporary or  not.
For language semantic reasons it is a requirement  for every 
re-instantiated template to forward  to  exactly the same symbol 
as was generated during the first instantiation.

The solution that  I came up with is to enhance CTFE to be able 
to take types as regular function arguments, and relax the 
semantic constraints on those type-functions.

If there is sufficient interested I can build a proof-of-conecpt.

Cheers,

Stefan


More information about the Digitalmars-d mailing list