Allocate a string via the GC

Adam D Ruppe destructionator at gmail.com
Mon May 23 11:39:22 UTC 2022


On Monday, 23 May 2022 at 09:38:07 UTC, JG wrote:
> Hi,
>
> Is there any more standard way to achieve something to the 
> effect of:
>
> ```d
>   import std.experimental.allocator;
>   string* name = theAllocator.make!string;
>  ```

Why do you want that?

Easiest way I know of is to just wrap it in a struct, then `new 
that_struct`, which is also a better way for all the use cases I 
know.... but those use cases are pretty rare so there's probably 
a better way to do what you're trying to do.


More information about the Digitalmars-d-learn mailing list