April 11, 2017 Tell compiler not to try and CTFE template? | ||||
---|---|---|---|---|
| ||||
I have a template that that takes no arguments. It takes a while to compile, but if I simply create a dummy argument, D compiles much quicker. e.g., void foo(string s)(); // slow, void foo(string s)(int x); // fast. (I, of course, pass a dummy value for x) This is because the compiler doesn't try to evaluate foo as a CTFE. I'd like inform it not to do this in the first place. |
April 10, 2017 Re: Tell compiler not to try and CTFE template? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jethro | On Tuesday, April 11, 2017 01:53:07 Jethro via Digitalmars-d-learn wrote:
> I have a template that that takes no arguments. It takes a while to compile, but if I simply create a dummy argument, D compiles much quicker.
>
> e.g.,
>
> void foo(string s)(); // slow,
>
> void foo(string s)(int x); // fast. (I, of course, pass a dummy
> value for x)
>
> This is because the compiler doesn't try to evaluate foo as a CTFE.
>
> I'd like inform it not to do this in the first place.
Please provide a compilable code sample showing what you're talking about.
- Jonathan M Davis
|
Copyright © 1999-2021 by the D Language Foundation