[Issue 8280] std.array.uninitializedArrayExtend, std.array.initializedArray

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Fri Jun 13 13:45:47 PDT 2014


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

--- Comment #3 from bearophile_hugs at eml.cc ---
(In reply to bearophile_hugs from comment #1)

> auto data = initializedArray!(char[])(100, ' ');
> 
> It is equivalent to:
> 
> auto data = uninitializedArray!(char[])(100);
> data[] = ' ';
> 
> 
> Another example usage (note the result is immutable):
> 
> immutable data = initializedArray!(int[])(50, i => i);

Perhaps there is one case where there is some ambiguity:

auto funcs = initializedArray!(int function(int)[])(10, i => i);

--


More information about the Digitalmars-d-bugs mailing list