mirror of
https://github.com/dlang/phobos.git
synced 2025-04-29 14:40:30 +03:00
Improve Issue 10220 fix.
Improves pull #1329. Issue URL: http://d.puremagic.com/issues/show_bug.cgi?id=10220
This commit is contained in:
parent
7b0a1219fd
commit
51a5bad3e6
1 changed files with 11 additions and 4 deletions
|
@ -342,11 +342,18 @@ if(allSatisfy!(isIntegral, I))
|
|||
alias typeof(T.init[0]) E;
|
||||
|
||||
auto ptr = (__ctfe) ?
|
||||
{
|
||||
static if(__traits(compiles, new E[1]))
|
||||
{
|
||||
return (new E[sizes[0]]).ptr;
|
||||
}
|
||||
else
|
||||
{
|
||||
E[] arr;
|
||||
foreach (i; 0 .. sizes[0])
|
||||
arr ~= E.init;
|
||||
return arr.ptr;
|
||||
}
|
||||
}() :
|
||||
cast(E*) GC.malloc(sizes[0] * E.sizeof, blockAttribute!(E));
|
||||
auto ret = ptr[0..sizes[0]];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue