std.algorithm.among

bearophile via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Jul 13 13:55:24 PDT 2014


Meta:

> It seems that not even that is the case.
>
> void main()
> {
> 	uint n = 0;
>         //Error
> 	bool b = n;
> }

D doesn't carry the range of mutable variables across different 
expressions.

So write (with the 2.066beta3):

void main() {
     const uint x1 = 0;
     const uint x2 = 1;
     bool b1 = x1;
     bool b2 = x2;
}

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list