On 5/24/20 8:12 AM, 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(b is null);

What I would like is to tell that b is an empty array and a is a null array.

The issue is simply that [] is the same as null.

Try this:

T[] emptyArr(T)() @trusted
   T* p = null;
   return p[1 .. 1];

int[] b = emptyArr!int;

assert(b !is null);


Reply via email to