TypeFunction example creatiing a conversion matrix

Stefan Koch uplink.coder at gmail.com
Fri Oct 2 15:21:30 UTC 2020


On Friday, 2 October 2020 at 15:11:18 UTC, Adam D. Ruppe wrote:
>
> The type function is a clear loser! But this is in part because 
> the template is reusing its cached result.

Indeed.
You can fix that by wrapping the type function inside a template 
to make use of the instance caching, if you are expecting it to 
be called with the same arguments.

I would assume this to happen less in actual use-cases though.
Also keep in mind that CTFE can be sped up by 10x when switching 
to byte code interpreter.
You can't say the same for templates.


More information about the Digitalmars-d mailing list