How to enforce compile time evaluation (and test if it was done at compile time)
Joseph Rushton Wakeling via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Tue Feb 28 15:09:50 PST 2017
On Tuesday, 28 February 2017 at 00:22:28 UTC, sarn wrote:
>> If you ever have doubts, you can always use something like
>> this to check:
>>
>> assert (__ctfe);
>
> Sorry, "enforce" would more appropriate if you're really
> checking.
if (!__ctfe) assert(false);
... might be the best option. That shouldn't be compiled out
even in -release builds.
More information about the Digitalmars-d-learn
mailing list