www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 18223] New: std.experimental.allocator

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

          Issue ID: 18223
           Summary: std.experimental.allocator uninitializedFillDefault
                    could use memset
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: n8sh.secondary hotmail.com

Current function in std.experimental.allocator.package:
```
private T[] uninitializedFillDefault(T)(T[] array) nothrow
{
    T t = T.init;
    fillWithMemcpy(array, t);
    return array;
}
```

When we can statically determine that the representation of T.init consists of
nothing but zeroes we could instead use memset. char and wchar could also be
special-cased.

--
Jan 10 2018