Send empty assoc array to function
Jesse Phillips
Jesse.K.Phillips+D at gmail.com
Fri Jul 10 00:27:53 UTC 2020
On Thursday, 9 July 2020 at 20:08:47 UTC, Anonymouse wrote:
> On Thursday, 9 July 2020 at 19:53:42 UTC, JN wrote:
>> void foo(int[int] bar)
>> {
>> // ...
>> }
>>
>>
>>
>> Is it possible to send an empty array literal?
>>
>> foo( [ 0 : 2 ] ) works
>> foo( [] ) doesn't
>>
>> int[int] empty;
>> foo(empty);
>> works but it's two lines
>
> I always did foo((int[int]).init);
Isn't that just 'null'.
I want to make note that you cannot pass null, modify the aa, and
expect the parent stack to see those changes. Since you aren't
using a variable that is null you are fine.
More information about the Digitalmars-d-learn
mailing list