How to enforce compile time evaluation (and test if it was done at compile time)

Christian Köstlin via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Feb 27 23:41:36 PST 2017


On 28/02/2017 01:20, sarn wrote:
> On Monday, 27 February 2017 at 19:26:06 UTC, Christian Köstlin wrote:
>> How can I make sure, that the calculations are done at compile time?
> 
> If you ever have doubts, you can always use something like this to check:
> 
> assert (__ctfe);
Thanks a lot, actually works as you describe it!
As I understand the only difference between assert and enforce is, that
assert is not compiled into releases?

Thanks!
Christian



More information about the Digitalmars-d-learn mailing list