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

Marc Schütz via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri May 27 02:25:55 PDT 2016


On Thursday, 26 May 2016 at 16:45:22 UTC, ArturG wrote:
> im just playing with this template[1] is there anything else i 
> missed? (if you dont mind)
> it basically treats any T.init as false and skips the 
> function/delegate and just returns type.
>
> [1] https://dpaste.dzfl.pl/d159d83e3167

If you just want to check whether something is equal to its 
type's .init value, use the `is` operator, which does a bitwise 
comparison:

     if(value is typeof(value).init) ...


More information about the Digitalmars-d-learn mailing list