Is there a way to make a function parameter accept only values that can be checked at compile time?

max haughton maxhaton at gmail.com
Wed Dec 29 11:09:04 UTC 2021


On Wednesday, 29 December 2021 at 08:56:47 UTC, rempas wrote:
> On Tuesday, 28 December 2021 at 22:26:33 UTC, max haughton 
> wrote:
>> Why do you need this? What's wrong with a normal branch in 
>> this case.
>
> Runtime performance. I want the value to get checked at compile 
> time and use "static if" with it

If the value is known at compile time the compiler can pretty 
easily do that for you unless you're really unlucky.


More information about the Digitalmars-d-learn mailing list