www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 15792] New: Error Filling an array


          Issue ID: 15792
           Summary: Error Filling an array
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Mac OS X
            Status: NEW
          Severity: major
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: sascha.orlov gmail.com

Didn't find an existing issue for this. Sorry, if missed.

As described here: 
https://forum.dlang.org/post/iizchhylkxistlnbijzd forum.dlang.org

There is an error during an attempt to fill an array of Nullable!uint during
the execution of

void main()
    import std.typecons;
    Nullable!uint[] arr;
    arr.length = 5;
    arr[] = 1;

The suggested workaround is, currently, using a cast:
arr[] = cast(Nullable!uint)1;

Also an option would be: 
import std.algorithm;
fill(arr, 1);

Mar 12 2016