`alias this` pointers and typeof(null)
Benjamin Thaut via Digitalmars-d
digitalmars-d at puremagic.com
Fri Jan 29 07:38:26 PST 2016
On Friday, 29 January 2016 at 13:38:20 UTC, Tomer Filiba wrote:
>
> I can change all such invocations into ``func(FooPtr(null))``
> but it's tedious and basically requires me to compile tens of
> times before I'd cover everything. Is there some workaround to
> make null implicitly convertible to my alias-this type? I mean,
> it's Foo* would accept `typeof(null)` so why can't FooPtr with
> an alias-this to Foo* do so too?
>
> -tomer
Unfortunately D is strictly against implict conversion, so there
is no way to do this. I also hit this issue a couple of times
already. But implicitly calling a constructor in C++ is
considered error prone and therefor not supported in D.
Kind Regards
Benjamin Thaut
More information about the Digitalmars-d
mailing list