Battle-plan for CTFE
tsbockman via Digitalmars-d-announce
digitalmars-d-announce at puremagic.com
Tue Aug 30 15:01:45 PDT 2016
On Monday, 29 August 2016 at 08:39:56 UTC, Stefan Koch wrote:
> I just came up with a nifty little patch that makes it possible
> to ensure that a function is _only_ used at ctfe.
> Or the opposite.
>
> static assert(__ctfe, "This function is not supposed to be
> called outside of ctfe");
> and static assert(!__ctfe, "This function is not supposed to be
> called during ctfe");
>
> similarly you can use static if (__ctfe).
>
> Is it worth trying to get it into master ?
Yes, please. I've often wished I could use `__ctfe` in a `static
if`.
More information about the Digitalmars-d-announce
mailing list