www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 18765] New: [Arrays] Docs need info on initialization of

https://issues.dlang.org/show_bug.cgi?id=18765

          Issue ID: 18765
           Summary: [Arrays] Docs need info on initialization of static
                    array with element literal
           Product: D
           Version: D2
          Hardware: All
               URL: http://dlang.org/
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P3
         Component: dlang.org
          Assignee: nobody puremagic.com
          Reporter: mrsmith33 yandex.ru

All elements of static array can be initialized to specific value with:

ubyte[4] array = 42;
assert(array == [42, 42, 42, 42]);

Should be added to https://dlang.org/spec/arrays.html#static-init-static

--
Apr 15 2018