template? mixin? template mixins? for modifying a struct setup

Mike Parker aldacron at gmail.com
Fri May 20 02:30:10 UTC 2022


On Friday, 20 May 2022 at 00:12:44 UTC, Chris Katko wrote:

> Yeah that occurred to me as I was falling asleep. Though, do I 
> have to a specify
>
> ```D
> static auto myColor = grey(0.5);
> ```
> to ensure it's done at compile time? It's not the end of the 
> world, but ideally, these are static / hardcoded values that 
> can be used thousands of times a second.

If the declarations are at module scope, `static` has no effect, 
and CTFE will be used for initialization.


More information about the Digitalmars-d-learn mailing list