Implicit conversion from null in custom type

Adam D. Ruppe via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu May 28 06:29:23 PDT 2015


On Thursday, 28 May 2015 at 13:12:18 UTC, Andrea Fontana wrote:
> void fun(typeof(null)) { }

You don't have to do that for built-in arrays though.

BTW I literally just wrote a slide on this for my Friday talk 
before reading this thread. I think D could have some implicit 
struct constructors, like C++, I just think C++ got it wrong by 
making implicit the default.

That said, I don't think this is a hugely important language 
feature, and is one I would recommend against using very often, 
but in select places like this - such as emulating built-in 
arrays perfectly - it would be nice to have.


More information about the Digitalmars-d-learn mailing list