[Issue 22723] Cannot allocate a slice on heap

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Feb 2 07:43:32 UTC 2022


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

Basile-z <b2.temp at gmx.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |b2.temp at gmx.com

--- Comment #2 from Basile-z <b2.temp at gmx.com> ---
Isn't the issue more like a request to have a way to allocate the slice payload
on the heap ? Maybe a druntime template should be added for that rare usage,
e.g

```
auto newHeapArray(T)()
{
    import core.memory : GC;

    alias RT = T[];
    return cast(RT*) GC.malloc(RT.sizeof, 0, typeid(T[]));
}  
```

--


More information about the Digitalmars-d-bugs mailing list