Distinguish between a null array and an empty array

bauss jj_1337 at live.dk
Sun May 24 12:15:21 UTC 2020


On Sunday, 24 May 2020 at 12:12:31 UTC, bauss wrote:
> Is there a way to do that?
>
> Since the following are both true:
>
> int[] a = null;
> int[] b = [];
>
> assert(a is null);
> assert(!a.length);
>
> assert(b is null);
> assert(!b.length);
>
> What I would like is to tell that b is an empty array and a is 
> a null array.

I'm aware that D is special in that they're equal here BUT in my 
use-case I must absolutely handle them differently.


More information about the Digitalmars-d-learn mailing list