[Issue 12444] std.array uninitializedArray & minimallyInitializedArray missing APPENDABLE attribute / capacity info
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Mar 24 01:59:13 PDT 2014
https://d.puremagic.com/issues/show_bug.cgi?id=12444
monarchdodra at gmail.com changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |REOPENED
CC| |monarchdodra at gmail.com
Resolution|INVALID |
--- Comment #2 from monarchdodra at gmail.com 2014-03-24 01:58:57 PDT ---
Just to be clear, this issue is NOT invalid. It's just that your proposed
solution doesn't work.
An implementation that could work is:
T[] uninitializedArray(T)(size_t n)
{
T[] buff; //Declare buff.
//Use the GC to do an Appendable allocation
buff.reserve(n);
//Slice out of bounds....
buff = buff.ptr[0 .. n];
//And tell the GC what the actual new bounds are.
buff = assumeSafeAppend(buff);
return buff;
}
This could not work up until now, because `assumeSafeAppend` was not nothrow.
It's not nothrow anymore, but it's not yet pure either, so it still isn't
useable.
--
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list