Filling an array
Mike Parker via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sat Mar 12 07:44:00 PST 2016
On Saturday, 12 March 2016 at 14:33:19 UTC, Alex wrote:
> //arr[] = 1;
>
> The question is, why the commented out line throws the error:
> Error: cannot implicitly convert expression (1) of type int to
> Nullable!uint[],
> while the line after that works.
Looks like a bug somewhere. The work around is to cast:
arr[] = cast(Nullable!uint)1;
I suggest you file this in the bug tracker [1] if it isn't there
already. Just use he minimal code that shows the problem:
void main()
{
import std.typecons;
Nullable!uint[] arr;
arr.length = 5;
arr[] = 1;
}
[1] https://dlang.org/bugstats.php
More information about the Digitalmars-d-learn
mailing list