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

Steven Schveighoffer schveiguy at gmail.com
Wed Dec 29 14:50:55 UTC 2021


On 12/29/21 3:56 AM, 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

Oof, just let the compiler do its job. Inlining and optimization will 
take care of this for you (for the most part).

-Steve


More information about the Digitalmars-d-learn mailing list