Why do some T.init evaluate to true while others to false?

ArturG via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri May 27 10:42:17 PDT 2016


On Friday, 27 May 2016 at 16:56:21 UTC, Steven Schveighoffer 
wrote:
> Why are you expecting it to be?
>
> Won't work for enums with first elements that are non-zero 
> either:
>
> enum foo : int {
>  bar = 1;
> }
>
> foo f;
>
> if(f) writeln("this will output too");
>
> -Steve


but by default it works you just changed the default so its ok 
that it doesnt work.


More information about the Digitalmars-d-learn mailing list