Filling an array

user42 via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Mar 13 06:38:53 PDT 2016


On Saturday, 12 March 2016 at 18:33:16 UTC, Alex wrote:
> On Saturday, 12 March 2016 at 16:37:25 UTC, user42 wrote:
>> On Saturday, 12 March 2016 at 14:33:19 UTC, Alex wrote:
>>> /snip
>>
>> I thought this was supposed to halt with an error rather than 
>> compile and set all members to 1.
>> The syntax, to me anyways, doesn't really communicate the 
>> intention of: set all members to 1.
>>>     //arr[] = 1;
>>
>> Whereas the following does
>>>     fill(arr, 1);
>
> Well, this was not the question. As stated here:
> https://dlang.org/spec/arrays.html
> in the section "array setting", it is possible to set an array 
> in such a manner. And my question was, why a specific array 
> behaves not as expected.
> So, either there is a problem with filling an array, or, there 
> is a problem with implicit conversion of a Nullable!T to its 
> underlying type.

Learned something new. I guess I missed that detail when I read 
that page.



More information about the Digitalmars-d-learn mailing list