template? mixin? template mixins? for modifying a struct setup
Steven Schveighoffer
schveiguy at gmail.com
Fri May 20 00:38:21 UTC 2022
On 5/19/22 8:29 PM, Steven Schveighoffer wrote:
> Given a CTFE function it's very easy to wrap for ensuring compile-time
> usage:
>
> ```d
> enum ctGrey(float f) = grey(f);
>
> auto myColor = ctGrey!(0.5);
> ```
That being said, if it's calculatable at compile time, chances are the
compiler is already going to do it, even for a standard constructor
call, especially if there's no custom constructor.
-Steve
More information about the Digitalmars-d-learn
mailing list