RFC: Value range propagation for if-else

bearophile via Digitalmars-d digitalmars-d at puremagic.com
Sun Jun 22 14:10:30 PDT 2014


Nordlöw:

> auto pow(T)(T arg, uint n)
> {
>     enum vr = __traits(valueRange, arg);
>     static if (vr.min == vr.max) // if arg is constant

I think that unfortunately this currently can't work, you can't 
tell the range of the input value like that. I have explained why 
in one of my posts in this thread. Please try to explain me why 
I'm wrong.

Bye,
bearophile


More information about the Digitalmars-d mailing list