Implicit conversion from null in custom type

Vladimir Panteleev via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu May 28 04:19:10 PDT 2015


I'm trying to write a type which (to some extent) emulates 
built-in AAs.

One thing I'm having trouble with is null function parameters:

void fun(S s) {}
void main() { fun(null); }

How can S implement implicit conversion from null?

I've already tried "alias this" and a constructor taking 
typeof(null).



More information about the Digitalmars-d-learn mailing list