Hi all!
I have, maybe, a silly question..
Not sure, if
https://forum.dlang.org/post/ibxhuqamgclrcatsy...@forum.dlang.org
has something to do with the topic

Having the following code:

import std.typecons;
import std.algorithm;

void main()
{
    uint[] arr_ref;
    arr_ref.length = 5;
    assert(arr_ref == [0, 0, 0, 0, 0]);
    arr_ref[] = 1;
    assert(arr_ref == [1, 1, 1, 1, 1]);

    Nullable!uint[] arr;
    arr.length = 5;
    bool[] check_arr;
    arr.each!(a => check_arr ~= a.isNull);
    assert(check_arr == [true, true, true, true, true]);

    //arr[] = 1;
    fill(arr, 1);
    assert(arr == [1, 1, 1, 1, 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.

Reply via email to