Null argument and function resolution

Andrea Fontana via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed May 27 07:12:46 PDT 2015


The first answer is the one I was looking for. Very useful.
You should add to next "this week in d" tips.

On Wednesday, 27 May 2015 at 14:09:48 UTC, Adam D. Ruppe wrote:
> Two options:
>
> 1) add an overload that takes typeof(null)
>
> this(typeof(null)) { /* handles the null literal specially */ }
>
> 2) Cast null to a specific type when making it:
>
> new YourClass(cast(ubyte*) null);



More information about the Digitalmars-d-learn mailing list