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 16:27:22 UTC 2021


On Wednesday, 29 December 2021 at 15:53:38 UTC, rempas wrote:
> On Wednesday, 29 December 2021 at 11:09:04 UTC, max haughton 
> wrote:
>> If the value is known at compile time the compiler can pretty 
>> easily do that for you unless you're really unlucky.
>
> How is this even possible?

Inlining + constant propagation. Fancier iterations on those 
exist too but 90% of the speedup will come from those since for 
it to matter they likely would've been used in first place.


More information about the Digitalmars-d-learn mailing list