February 10, 2017 Re: Initialization of dynamic multidimensional array | ||||
---|---|---|---|---|
| ||||
Posted in reply to Daniel Kozak | On Friday, 10 February 2017 at 09:25:04 UTC, Daniel Kozak wrote:
>> Now I tried this with a named instead of a magic constant e.g.
>>
>>> immutable VALUE=-1;
>>> arr.each!"a[]=VALUE";
>>
>> And it doesn't work anymore. I've no clue, why... Can you help me?
> Because it does not see VALUE, you need to use delegate insted of string something like this:
>
> arr.each!(a=>a[]=VALUE);
Unfortunately this leeds to the same error... (Or something very simmilar.)
|
February 10, 2017 Re: Initialization of dynamic multidimensional array | ||||
---|---|---|---|---|
| ||||
Posted in reply to berni | On Friday, 10 February 2017 at 09:34:39 UTC, berni wrote:
> On Friday, 10 February 2017 at 09:25:04 UTC, Daniel Kozak wrote:
>>> Now I tried this with a named instead of a magic constant e.g.
>>>
>>>> immutable VALUE=-1;
>>>> arr.each!"a[]=VALUE";
>>>
>>> And it doesn't work anymore. I've no clue, why... Can you help me?
>> Because it does not see VALUE, you need to use delegate insted of string something like this:
>>
>> arr.each!(a=>a[]=VALUE);
>
> Unfortunately this leeds to the same error... (Or something very simmilar.)
Opps, sorry. Taking back everything. It was a typo, that caused the error.
|
Copyright © 1999-2021 by the D Language Foundation