Comparison of null `Nullable`s

Luís Marques via Digitalmars-d digitalmars-d at puremagic.com
Wed Mar 30 05:06:24 PDT 2016


Have you considered making these work, instead of throwing an 
exception?

     import std.typecons;

     alias T = Nullable!(int, -1);

     void main()
     {
         T a;
         T b;
         assert(a == b);

         T c;
         T d = 42;
         assert(c != d);
     }

It could be a template parameter for Nullable, and the default be 
to preserve the current behavior.


More information about the Digitalmars-d mailing list